mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修复多文件上传重复问题
This commit is contained in:
parent
4c89480a8e
commit
30366ce37d
@ -47,35 +47,35 @@
|
|||||||
top.$('[name="{$field}"]').map(function () {
|
top.$('[name="{$field}"]').map(function () {
|
||||||
top.$(this).attr('data-srcs', ret.url).attr('data-md5', file.md5).val(url).trigger('change');
|
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(top.layer.getFrameIndex(window.name));
|
||||||
top.layer.close(index);
|
/*{/if}*/
|
||||||
/*{/if} {$mode}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmSelected() {
|
var isSuccessState = false;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
function completed() {
|
function completed() {
|
||||||
var btnHTML = '完成上传';
|
var btnHTML = '完成上传';
|
||||||
$('.uploadBtn').on('click', function () {
|
$('.uploadBtn').html(btnHTML).on('click', successSelected);
|
||||||
if (this.innerHTML === btnHTML) {
|
|
||||||
confirmSelected.call(this);
|
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的时候开始初始化
|
// 当domReady的时候开始初始化
|
||||||
|
Loading…
x
Reference in New Issue
Block a user