Quellcode durchsuchen

Merge branch 'master' of http://60.205.254.193:3000/GCLS/GCLS_Page_Textbook

dusenyao vor 1 Jahr
Ursprung
Commit
77c731152a

+ 11 - 2
src/views/book/courseware/create/components/base/common/UploadFile.vue

@@ -49,6 +49,7 @@
 import { fileUpload } from '@/api/app';
 import { conversionSize } from '@/utils/common';
 import FillDescribe from '../../common/FillDescribe';
+import { login } from '@/api/user';
 
 export default {
   name: 'UploadFile',
@@ -138,7 +139,14 @@ export default {
       fileList.forEach((file) => {
         if (!file.progress || file.progress <= 0) file.progress = 0;
       });
-      this.content.file_list.push(file);
+      const lists = this.$refs.upload.uploadFiles;
+      if (lists.length === 0) return;
+      lists.forEach((item) => {
+        let _index = this.content.file_list.findIndex((p) => p.uid === item.uid);
+        if (_index <= -1) {
+          this.content.file_list.push(item);
+        }
+      });
     },
 
     // 删除文件
@@ -159,7 +167,7 @@ export default {
     // 文件校验
     afterSelectFile(file) {
       const fileName = file.name;
-      let singleSizeTip = `文件[${fileName}]大小超过 ${this.singleSize}MB,被移除!`;
+      let singleSizeTip = `文件[${fileName}]大小超过${conversionSize(this.singleSize * 1024 * 1024)},被移除!`;
       if (file.size > this.singleSize * 1024 * 1024) {
         this.$message.error(singleSizeTip);
         this.$refs.upload.handleRemove(file);
@@ -228,6 +236,7 @@ export default {
               file_url: file_info_list[0].file_url,
             };
             this.content.file_id_list.push(file_info_list[0].file_id);
+            this.$refs.upload.uploadFiles = [];
           }
         });
       });