jinhui.wang

校验逻辑修改

......@@ -175,7 +175,7 @@ export default {
let fileSum = 0;
let fileSize = 0;
let fileNameArray = [];
let errorTip = "";
let errorTip = this.errorTip;
this.fileData.forEach((item) => {
fileSum = Number(fileSum) + Number(item.files.length);
item.files.forEach((file) => {
......@@ -185,16 +185,17 @@ export default {
});
if (fileSum + 1 > 100) {
if (this.errorTip == "") {
errorTip = "The total number of uploaded files should not exceed 100 files.";
this.$message.warning(this.errorTip);
errorTip =
"The total number of uploaded files should not exceed 100 files.";
}
} else if ((Number(fileSize) + Number(val.size)) / 1024 / 1024 > 95) {
if (this.errorTip == "") {
errorTip = "The total size of all uploaded files should not exceed 95MB.";
errorTip =
"The total size of all uploaded files should not exceed 95MB.";
}
} else if (fileNameArray.includes(val.name)) {
if (this.errorTip == "") {
errorTip = "Duplicate file name uploaded!";
errorTip = `'${val.name}'.Duplicate file name uploaded!`;
}
}
......