|
@@ -448,7 +448,7 @@ export class RepositoryManageAddComponent implements OnInit {
|
448
|
448
|
beforeUpload = (file: UploadFile) => {
|
449
|
449
|
let index = file.name.lastIndexOf('.')
|
450
|
450
|
let type = file.name.slice(index + 1)
|
451
|
|
- console.log('type===',type)
|
|
451
|
+ const isSize = file.size / 1024 / 1024 < 10;
|
452
|
452
|
const isPic = (type === 'xlsx' || type === 'pdf' ||
|
453
|
453
|
type === 'xls' || type === 'ppt' || type === 'pptx' ||
|
454
|
454
|
type === 'txt' || type === 'doc' || type === 'docx');
|
|
@@ -456,6 +456,10 @@ export class RepositoryManageAddComponent implements OnInit {
|
456
|
456
|
this.message.error('只能上传PDF、word、ppt、excel、txt等文件类型格式!');
|
457
|
457
|
return false;
|
458
|
458
|
}
|
|
459
|
+ if (!isSize) {
|
|
460
|
+ this.message.error('文件大小不能大于10MB!');
|
|
461
|
+ return false;
|
|
462
|
+ }
|
459
|
463
|
this.fileData = this.fileData.concat(file);
|
460
|
464
|
return false;
|
461
|
465
|
};
|