@newview/file-ui 1.1.45 → 1.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/file-ui.js +16 -3
- package/dist/file-ui.umd.cjs +1 -1
- package/package.json +1 -1
- package/types/ComFormUp.d.ts +1904 -1
package/README.md
CHANGED
package/dist/file-ui.js
CHANGED
|
@@ -353,19 +353,32 @@ let UploadFileInstance$1 = class UploadFileInstance extends BaseInstance {
|
|
|
353
353
|
__publicField(this, "doBeforeUpload", (file) => {
|
|
354
354
|
return new Promise(async (resolve, reject) => {
|
|
355
355
|
let flag = true;
|
|
356
|
+
const allowedExtensions = ["doc", "docx", "ppt", "pptx", "xls", "xlsx"];
|
|
357
|
+
const fileName = file.name;
|
|
358
|
+
const temp = fileName.split(".");
|
|
359
|
+
const ext = temp[temp.length - 1].toLowerCase();
|
|
360
|
+
if (allowedExtensions.includes(ext)) {
|
|
361
|
+
const fileNameWithoutExt = fileName.slice(0, -(ext.length + 1));
|
|
362
|
+
if (fileNameWithoutExt.length > 20) {
|
|
363
|
+
this.message.warning("文件名长度不能超过20个字符");
|
|
364
|
+
flag = false;
|
|
365
|
+
return reject();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
356
368
|
if (this.props.uploadQuantity > 0) {
|
|
357
|
-
let apiResult = await this.fileInfoApi.getEntities(
|
|
369
|
+
let apiResult = await this.fileInfoApi.getEntities(
|
|
370
|
+
QueryWrapper.create().eq("Token", this.currentToken)
|
|
371
|
+
);
|
|
358
372
|
const result = this.utilities.parseApiResult(apiResult);
|
|
359
373
|
if (result && result.length >= this.props.uploadQuantity) {
|
|
360
374
|
this.message.warning(`仅能上传${this.props.uploadQuantity}个附件`);
|
|
361
375
|
flag = false;
|
|
362
376
|
}
|
|
363
|
-
} else {
|
|
364
|
-
flag = true;
|
|
365
377
|
}
|
|
366
378
|
if (flag) {
|
|
367
379
|
this.message.info("文件上传中,请稍等");
|
|
368
380
|
this.multipartUpload(file);
|
|
381
|
+
resolve(true);
|
|
369
382
|
} else {
|
|
370
383
|
reject();
|
|
371
384
|
}
|