From 8d0463a58db220af99d8a23153438efaf80a75ab Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Thu, 2 Mar 2023 18:04:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=8C=E8=A7=86=E9=A2=91?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addPropaganda.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/project/huizhili/AppCooperationPropaganda/addPropaganda.vue b/src/project/huizhili/AppCooperationPropaganda/addPropaganda.vue index 67f645aa..3c43545c 100644 --- a/src/project/huizhili/AppCooperationPropaganda/addPropaganda.vue +++ b/src/project/huizhili/AppCooperationPropaganda/addPropaganda.vue @@ -315,15 +315,34 @@ export default { sizeType: ['compressed'], sourceType: ['album'], success: (res) => { + console.log(res); let count = this.files?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0) if (count > 9) { return this.$u.toast(`不能超过9个`) } + let maxImage = 10 * 1024 // 10M + let maxVideo = 10 * 1024 // 10M + let maxFile = 20 * 1024 // 20M if (res.tempFiles) { + if(type == "image") { + if(res.tempFiles.every(e=> e.size > maxImage)) { + return this.$u.toast(`图片最大不能超过10M`) + } + } + if(type == "file") { + if(res.tempFiles.every(e=> e.size > maxFile)) { + return this.$u.toast(`文件最大不能超过20M`) + } + } res.tempFiles?.map((item) => { this.uploadFile(item,type) }) } else if (res?.tempFile) { + if(type == "video") { + if(res.tempFile.size > maxVideo) { + return this.$u.toast(`视频最大不能超过10M`) + } + } this.uploadFile(res.tempFile,type) } },