From 02d69a5c13eeca54efeef225e3c5fd91be1c9d5f Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 7 Feb 2024 15:22:59 +0800 Subject: [PATCH] =?UTF-8?q?Bug=EF=BC=9A=E3=80=90ID1000410=E3=80=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=AE=A1=E7=90=86-=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=EF=BC=8CIOT=E4=BB=AA=E5=99=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E5=BC=B9=E5=87=BA=E8=A7=86=E9=A2=91=E7=AA=97?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E5=92=8C=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=B8=8E?= =?UTF-8?q?=E5=8E=9F=E5=9E=8B=E8=AE=BE=E8=AE=A1=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flossom-ui/src/views/system/mode/index.vue | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/flossom-ui/src/views/system/mode/index.vue b/flossom-ui/src/views/system/mode/index.vue index 0ff2604..b335fa0 100644 --- a/flossom-ui/src/views/system/mode/index.vue +++ b/flossom-ui/src/views/system/mode/index.vue @@ -85,6 +85,8 @@ :on-success="handleOpenSourceFileSuccess" :headers="upload.headers" :file-list="fileOpenSourceList" + :before-upload="limitFileType" + accept=".jpeg,.jpg,.png,.svg,.mp4,.avi,.mov,.rmvb,.rm,.flv,.3gp,.GIF,.gif" > 点击上传
只能上传视频/图片文件,且不超过50M
@@ -246,7 +248,29 @@ 添加弹窗 - + + + @@ -752,6 +776,16 @@ export default { return true; }, + limitFileType(file) { + const imageType = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg', ['image/jpeg', 'image/jpg', 'image/png', 'image/svg', 'video/mp4','video/avi','video/mov','video/rmvb','video/rm','video/flv','video/3gp']] + let isVideo = imageType.includes(file.type) + // 检验文件格式 + if (!isVideo) { + this.$message.error(`文件格式错误!`) + return false + } + return true; + }, limitImageFileType(file) { const imageType = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg'] let isVideo = imageType.includes(file.type)