Commit a23fa209 authored by 乐宝呗666's avatar 乐宝呗666

修改视频上传限制

parent 53886abc
......@@ -55,7 +55,7 @@
v-model="form.num"
placeholder="请输入观影人数"
input-align="right"
:rules="[{ pattern: /^[1-9]\d*$/, message: '请输入正确内容' }]"
:rules="[{ pattern: /^[1-9]\d{1,9}$/, message: '请输入正确内容,最多10位数' }]"
/>
<van-field
label="管理员账号"
......@@ -97,7 +97,7 @@
<img src="@/assets/images/applets/tip.png" alt />
<span>
最多支持上传
<b>3</b> 段视频,每段时长 <b>30s</b>
<b>3</b> 段视频,每段大小不能超过 <b>5MB</b>
</span>
</div>
</div>
......@@ -200,30 +200,18 @@ export default {
this.showBoard = false;
},
beforeVideo(file) {
this.timeOutVideo = false
let isOver = true
if(Array.isArray(file)){
file.forEach(item=>{
this.createVideo(item)
})
isOver = file.every(item=>item <= 5*1024*1024)
}else{
this.createVideo(file)
isOver = file.size <= 5*1024*1024
}
if(!isOver){
this.$toast.fail("上传文件大小不能超过 5MB");
return false
}else{
return true
}
return true
},
createVideo(file){
let _URL = window.URL || window.webkitURL;
let videoUrl = _URL.createObjectURL(file);
let audioElement = new Audio(videoUrl);
audioElement.addEventListener("loadedmetadata", () => {
let duration = audioElement.duration; //时长为秒,小数,182.36
console.log(duration)
if (duration > 31) {
this.timeOutVideo = true
this.fileList = []
this.$toast.fail("上传视频时长不能超过30秒");
return false;
}
});
},
// 打开日历
onDisplay() {
......@@ -515,6 +503,7 @@ export default {
::v-deep .field-textarea {
min-height: 80px;
padding: 0;
margin-bottom: 150px;
.van-field__value {
background-color: #f5f5f5;
}
......
......@@ -166,6 +166,9 @@ export default {
padding: 24px 0px;
height: calc(100% - 200px);
overflow-y: auto;
.van-pull-refresh {
margin-bottom: 50px;
}
.van-cell {
padding-left: 0;
padding-right: 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment