From 479942bb466db1767896b58d351475bc9d435baa Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 7 Feb 2024 11:16:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ID1000403=E3=80=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flossom-ui/src/views/system/mode/index.vue | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/flossom-ui/src/views/system/mode/index.vue b/flossom-ui/src/views/system/mode/index.vue index 20bc1fd..29bd40b 100644 --- a/flossom-ui/src/views/system/mode/index.vue +++ b/flossom-ui/src/views/system/mode/index.vue @@ -229,14 +229,16 @@ 点击上传 - 只能上传视频文件,且不超过50M + 只能上传视频文件(mp4,avi,mov,wmv格式),且不超过50M @@ -723,6 +725,23 @@ export default { handlePreview(file) { console.log(file); }, + limitUploadFileType(file) { + const type = ['video/mp4','video/avi','video/mov','video/rmvb','video/rm','video/flv','video/3gp'] + const isVideo = type.includes(file.type) + // 检验文件格式 + if (!isVideo) { + this.$message.error(`视频格式错误!`) + return false + } + // 校检文件大小 + const fileSize = 50; + const isLt = file.size / 1024 / 1024 < fileSize + if (!isLt) { + this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`) + return false + } + return true + }, // 文件上传成功处理 handleFileSuccess(response, file, fileList, item) { console.log('上传后的结果==>',JSON.stringify(response))