From 99798ae19180e5b1f0534dfd0edae134c5feef0e Mon Sep 17 00:00:00 2001 From: liupf <525833532@qq.com> Date: Sat, 26 Feb 2022 19:23:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=9A=E5=9B=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0data-number=20=E5=8F=AF=E8=AE=BE=E7=BD=AE=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/admin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/static/admin.js b/public/static/admin.js index 5514cc6ea..54601a6b3 100644 --- a/public/static/admin.js +++ b/public/static/admin.js @@ -588,7 +588,7 @@ $(function () { $.fn.uploadMultipleImage = function () { return this.each(function () { if ($(this).data('inited')) return true; else $(this).data('inited', true); - var $in = $(this), $bt = $(''), imgs = this.value ? this.value.split('|') : [] + var $in = $(this), $bt = $(''), imgs = this.value ? this.value.split('|') : [], num = $in.data('number') || 0 $in.after($bt.attr('data-size', $in.data('size') || 0).attr('data-type', $in.data('type') || 'png,jpg,gif,jpeg').uploadFile(function (src) { imgs.push(src), $in.val(imgs.join('|')), showImageContainer([src]); })), (imgs.length > 0 && showImageContainer(imgs)); @@ -603,8 +603,10 @@ $(function () { imgs = [], $bt.prevAll('.uploadimage').map(function () { imgs.push($(this).attr('data-tips-image')); }); + if(num > 0 && imgs.length < num) $bt.show(); imgs.reverse(), $in.val(imgs.join('|')); }), $bt.before($image); + if(num > 0 && imgs.length >= num) $bt.hide(); }); } });