From 5579f0042f5e911f9a4545db2fbcc958395d7aea Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Tue, 15 Apr 2025 09:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../child/importantMatterForm.js | 84 ------------------- .../child/importantMatterForm.html | 8 +- 2 files changed, 4 insertions(+), 88 deletions(-) diff --git a/src/main/resources/static/js/imageUpload/importantMatter/child/importantMatterForm.js b/src/main/resources/static/js/imageUpload/importantMatter/child/importantMatterForm.js index 8bb562f..850a4c5 100644 --- a/src/main/resources/static/js/imageUpload/importantMatter/child/importantMatterForm.js +++ b/src/main/resources/static/js/imageUpload/importantMatter/child/importantMatterForm.js @@ -24,90 +24,6 @@ layui.use(['laydate', 'upload'], function () { sourceTypeName: "重要事项及宣传照片" // 来源类型名称 }) - // 已上传图片计数 - var uploadedCount = 0; - // 最大允许上传数量 - var maxCount = 9; - // 渲染上传组件 - upload.render({ - elem: '#uploadBtn', // 绑定按钮 - url: '/imgTool/sys/file/uploadFile?token=' + tokens, // 上传接口地址 - accept: 'images', // 只允许上传图片 - multiple: true, // 允许多文件上传 - auto: true, // 选择文件后自动上传 - number: 9, // 每次最多选择3个文件 - field: 'files', - data: {params: violation}, - choose: function(obj){ // 选择文件后的回调 - debugger; - // 检查已上传数量 - var files = obj.pushFile(); - console.log(files) - alert(uploadedCount) - // 如果已上传+新选择的数量超过限制 - alert(files.length) - if(uploadedCount + files.length > maxCount){ - var canUpload = maxCount - uploadedCount; - layer.msg('最多上传'+maxCount+'张图片,还可上传'+canUpload+'张'); - // 截断文件数组,只保留可上传数量 - this.files = files.slice(0, canUpload); - // 如果已经没有可上传数量,则阻止上传 - if(canUpload <= 0){ - return false; - } - } - - // 预览图片 - obj.preview(function(index, file, result){ - $('#previewBox').append( - '