Browse Source

BI-92633 fix: 上传文件会停顿1s

es6
Zhenfei.Li 3 years ago
parent
commit
ebea78994c
  1. 29
      src/base/single/input/file.js

29
src/base/single/input/file.js

@ -520,22 +520,21 @@
setTimeout(function () { setTimeout(function () {
self_.clean(); // remove files from list self_.clean(); // remove files from list
self_.hide(); // hide progress bars and enable input file self_.hide(); // hide progress bars and enable input file
if (200 > xhr.status || xhr.status > 399) {
BI.Msg.toast(BI.i18nText("BI-Upload_File_Error"), { level: "error" });
self.fireEvent(BI.File.EVENT_ERROR);
return;
}
var error = BI.some(_wrap.attach_array, function (index, attach) {
if (attach.errorCode) {
BI.Msg.toast(BI.i18nText(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 // enable again the submit button/element
}, 1000); }, 100);
if (200 > xhr.status || xhr.status > 399) {
BI.Msg.toast(BI.i18nText("BI-Upload_File_Error"), { level: "error" });
self.fireEvent(BI.File.EVENT_ERROR);
return;
}
var error = BI.some(_wrap.attach_array, function (index, attach) {
if (attach.errorCode) {
BI.Msg.toast(BI.i18nText(attach.errorMsg), { level: "error" });
self.fireEvent(BI.File.EVENT_ERROR, attach);
return true;
}
});
!error && self.fireEvent(BI.File.EVENT_UPLOADED);
}; };
_wrap.url = o.url; _wrap.url = o.url;
_wrap.fileType = o.accept; // 文件类型限制 _wrap.fileType = o.accept; // 文件类型限制

Loading…
Cancel
Save