From 3bde6582408bf58cc7fcf13c2fc6ef0e6566890b Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 26 May 2022 12:00:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=97=A0jira=20=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=8A=A5=E9=94=99=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/input/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index cb24385ab..a7040bdc2 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -568,7 +568,7 @@ }); } else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { // 文件大小不支持 - BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error", wrap.maxSize), { level: "error" }); + BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error", Math.cell(wrap.maxSize / 1024)), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 1, file: item From 75db7729b14bc0e3317f4a20a3b53f3c1b94715f Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 26 May 2022 14:59:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=97=A0jira=20=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=8A=A5=E9=94=99=E6=94=AF=E6=8C=81?= =?UTF-8?q?errorText=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/editor/editor.multifile.js | 3 ++- src/base/single/input/file.js | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index 1175d01c7..7aec220f0 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/src/base/single/editor/editor.multifile.js @@ -31,7 +31,8 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { accept: o.accept, maxSize: o.maxSize, maxLength: o.maxLength, - title: o.title + title: o.title, + errorText: o.errorText, }); this.file.on(BI.File.EVENT_CHANGE, function () { self.fireEvent(BI.MultifileEditor.EVENT_CHANGE, arguments); diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index a7040bdc2..963a20f3d 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -445,8 +445,9 @@ url: "", multiple: true, accept: "", // .png,.pdf,image/jpg,image/* 等 - maxSize: -1, // 1024 * 1024 - maxLength: -1 // 无限制, 与multiple配合使用 + maxSize: -1, // 1024 * 1024 单位b + maxLength: -1, // 无限制, 与multiple配合使用 + errorText: BI.emptyFn, }); }, @@ -472,12 +473,10 @@ // handlers _wrap.onloadstart = function (rpe, xhr) { - // BI.Msg.toast("loadstart"); self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments); }; _wrap.onprogress = function (rpe, xhr) { - // BI.Msg.toast("onprogress"); // percent for each bar // fileSize is -1 only if browser does not support file info access @@ -561,21 +560,26 @@ var validateFileType = fileTypeValidate(value, wrap.fileType); if (!validateFileType) { // 文件类型不支持 - BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" }); + BI.Msg.toast(o.errorText({ + errorType: 0, + file: item + }) || BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 0, file: item }); } else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { // 文件大小不支持 - BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error", Math.cell(wrap.maxSize / 1024)), { level: "error" }); + BI.Msg.toast(o.errorText({ + errorType: 1, + file: item + }) || BI.i18nText("BI-Upload_File_Size_Error", Math.cell(wrap.maxSize / 1024 / 1024)), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 1, file: item }); } else { wrap.files.unshift(item); - // BI.Msg.toast(value); } } } From 1833843bec94484ac999c41aed79686c7d6746ec Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 26 May 2022 15:04:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=A0jira=20=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=8A=A5=E9=94=99=E6=94=AF=E6=8C=81?= =?UTF-8?q?errorText=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/input/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 963a20f3d..b86963f41 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -573,7 +573,7 @@ BI.Msg.toast(o.errorText({ errorType: 1, file: item - }) || BI.i18nText("BI-Upload_File_Size_Error", Math.cell(wrap.maxSize / 1024 / 1024)), { level: "error" }); + }) || BI.i18nText("BI-Upload_File_Size_Error", Math.ceil(wrap.maxSize / 1024 / 1024)), { level: "error" }); self.fireEvent(BI.File.EVENT_ERROR, { errorType: 1, file: item