Prechádzať zdrojové kódy

优化上传组件的预览

natasha 1 mesiac pred
rodič
commit
47b568c9ba

+ 11 - 9
src/views/book/courseware/preview/components/upload_preview/UploadPreviewPreview.vue

@@ -114,13 +114,6 @@ export default {
         } else {
           this.source_list[2].push(item);
         }
-        GetFileURLMap({ file_id_list: [item.file_id] }).then(({ url_map }) => {
-          this.$set(
-            item,
-            'newpath',
-            `${this.file_preview_url}onlinePreview?url=${Base64.encode(url_map[item.file_id])}`,
-          );
-        });
       });
     },
     //   下载表格
@@ -147,8 +140,17 @@ export default {
     },
     // 预览
     viewDialog(file) {
-      this.visible = true;
-      this.newpath = file.newpath;
+      this.newpath = '';
+      GetFileURLMap({ file_id_list: [file.file_id] }).then(({ url_map }) => {
+        // this.$set(
+        //   item,
+        //   'newpath',
+        //   `${this.file_preview_url}onlinePreview?url=${Base64.encode(url_map[item.file_id])}`,
+        // );
+        console.log(url_map[file.file_id]);
+        this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(url_map[file.file_id])}`;
+        this.visible = true;
+      });
     },
   },
 };