From 30366ce37d401335720ba12bd33c5f25f355e34e Mon Sep 17 00:00:00 2001 From: Anyon Date: Sun, 8 Apr 2018 14:45:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E5=A4=8D=E5=A4=9A?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E9=87=8D=E5=A4=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/plugs/upfile.html | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/application/admin/view/plugs/upfile.html b/application/admin/view/plugs/upfile.html index 3f4f80530..3bb3976ec 100644 --- a/application/admin/view/plugs/upfile.html +++ b/application/admin/view/plugs/upfile.html @@ -47,35 +47,35 @@ top.$('[name="{$field}"]').map(function () { top.$(this).attr('data-srcs', ret.url).attr('data-md5', file.md5).val(url).trigger('change'); }); - var index = top.layer.getFrameIndex(window.name); - top.layer.close(index); - /*{/if} {$mode}*/ + top.layer.close(top.layer.getFrameIndex(window.name)); + /*{/if}*/ } - function confirmSelected() { - var srcs = new Array(), md5s = new Array(); - $('[data-md5] .success').map(function () { - var $li = $(this).parents('[data-md5]'); - md5s.push($li.attr('data-md5')); - srcs.push($li.attr('data-src')); - }); - if (srcs.length < 1) { - return top.$.msg.tips('还没有选择文件,请勾选需要使用的文件!'); - } - top.$('[name="{$field}"]').map(function () { - top.$(this).attr('data-srcs', srcs.join('|')).attr('data-md5', md5s.join('|')).val(srcs.join('|')).trigger('change'); - }); - var index = top.layer.getFrameIndex(window.name); - top.layer.close(index); - } + var isSuccessState = false; function completed() { var btnHTML = '完成上传'; - $('.uploadBtn').on('click', function () { - if (this.innerHTML === btnHTML) { - confirmSelected.call(this); + $('.uploadBtn').html(btnHTML).on('click', successSelected); + + function successSelected() { + if (!isSuccessState && this.innerHTML === btnHTML) { + isSuccessState = true; + console.log(btnHTML); + var srcs = [], md5s = []; + $('[data-md5] .success').map(function () { + var $li = $(this).parents('[data-md5]'); + md5s.push($li.attr('data-md5')); + srcs.push($li.attr('data-src')); + }); + if (srcs.length < 1) { + return top.$.msg.tips('还没有选择文件,请勾选需要使用的文件!'); + } + top.$('[name="{$field}"]').map(function () { + top.$(this).attr('data-srcs', srcs.join('|')).attr('data-md5', md5s.join('|')).val(srcs.join('|')).trigger('change'); + }); + top.layer.close(top.layer.getFrameIndex(window.name)); } - }).html(btnHTML); + } } // 当domReady的时候开始初始化