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) } },