From 07393f59c44baba1c129ebe11271e1946b8face1 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 27 Jul 2020 11:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=BC=A0=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/view/api/upload.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/admin/view/api/upload.js b/app/admin/view/api/upload.js index ef9659a72..d3ab98700 100644 --- a/app/admin/view/api/upload.js +++ b/app/admin/view/api/upload.js @@ -19,6 +19,7 @@ define(['md5'], function (SparkMD5, allowExtsMimes) { options.loading = $.msg.loading('上传进度 0%'); options.count.total++, options.files[i].index = i, options.cache[i] = options.files[i], delete options.files[i]; md5file(options.cache[i]).then(function (file) { + options.element.trigger('upHash', md5file); jQuery.ajax("{:url('admin/api.upload/state')}", { data: {xkey: file.xkey, uptype: options.uptype, safe: options.safe, name: file.name}, method: 'post', success: function (ret) { file.xurl = ret.data.url; @@ -47,8 +48,10 @@ define(['md5'], function (SparkMD5, allowExtsMimes) { }); } }, progress: function (n) { + options.element.trigger('upProgress', arguments[3]); $('[data-upload-progress]').html(n + '%'); }, done: function (ret, index) { + options.element.trigger('upDone', options.cache[index], ret); if (++options.count.uploaded >= options.count.total) layer.close(options.loading); if (typeof ret.code === 'number' && parseInt(ret.code) === 0) return $.msg.tips(ret.info || '文件上传失败!'); if (typeof options.cache[index].xurl !== 'string') return $.msg.tips('无效的文件对象!');