From 6f992ce86ff558b6cbfff7ce757d56d313af3871 Mon Sep 17 00:00:00 2001 From: dailer Date: Tue, 16 Jul 2019 18:51:53 +0800 Subject: [PATCH] =?UTF-8?q?BI-48098=20fix:=20=E3=80=90512=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E6=95=B0=E6=8D=AE=E5=87=86=E5=A4=87=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E6=94=B9=E4=B8=8B=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/input/file.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index ce8876c7e..51fc59158 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -270,9 +270,13 @@ handler.attach_array.push(attachO); } } catch (e) { - if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);} + if (isFunction(handler.onerror)) { + handler.onerror(rpe, event || _global.event); + } + } + if (isFunction(handler.onload)) { + handler.onload(rpe, {responseText: responseText}); } - if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});} }, target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); try { // IE < 8 does not accept enctype attribute ... @@ -483,7 +487,14 @@ self.fireEvent(BI.File.EVENT_ERROR); return; } - self.fireEvent(BI.File.EVENT_UPLOADED); + var error = BI.some(_wrap.attach_array, function (index, attach) { + if (attach.errorCode) { + BI.Msg.toast(attach.errorMsg, {level: "error"}); + self.fireEvent(BI.File.EVENT_ERROR, attach); + return true; + } + }); + !error && self.fireEvent(BI.File.EVENT_UPLOADED); // enable again the submit button/element }, 1000); };