Bläddra i källkod

增加图标加载失败fallback,删除不必要代码

Danj0rr 1 år sedan
förälder
incheckning
ea9fc41d6b
1 ändrade filer med 4 tillägg och 37 borttagningar
  1. 4 37
      src/views/system/modelModify.vue

+ 4 - 37
src/views/system/modelModify.vue

@@ -51,8 +51,7 @@
                                 <el-button icon="el-icon-download" @click="downloadFile">下载</el-button>
                             </div>
                             <el-image :src="getFileIcon" ref="icon" class="bordered-image" fit="scale-down"
-                                      style="width: 40px" alt="Image"
-                                      @mouseover="showDetails" slot="reference"></el-image>
+                                      style="width: 40px" alt="Image" slot="reference"></el-image>
 
                         </el-popover>
                     </el-form-item>
@@ -99,7 +98,6 @@ export default {
 
     data() {
         return {
-            tooltipText: "提示",
             modelId: this.$route.query.modelId,
             modelNo: this.$route.query.modelNo,
             modelName: this.$route.query.modelName,
@@ -117,8 +115,6 @@ export default {
             model_type: "",
             output_list: [],
             fileIcon: "",
-            isDetailsVisible: false,
-            fileName: "",
             type_list: [
                 {
                     key: 1,
@@ -136,7 +132,6 @@ export default {
             ],
             suffix_idx: ["jar", "py", "war"],
 
-            // model_type: this.type_list[this.$route.query.modelType - 1].label,
         }
     },
     computed: {
@@ -150,48 +145,20 @@ export default {
             } else if (suffix == "py") {
                 this.fileIcon = "py.png";
             }
-            return require(`@/assets/${this.fileIcon}`);
-        },
-        overlayStyle() {
-            if (this.iconRect) {
-                return {
-                    position: 'absolute',
-                    left: this.iconRect.left + 'px',
-                    top: this.iconRect.top + 'px'
-                };
-            } else {
-                return {}; // 默认样式
+            else {
+                this.fileIcon = "404.png";
             }
+            return require(`@/assets/${this.fileIcon}`);
         },
 
     },
     mounted() {
-        this.iconRect = this.$refs.icon.getBoundingClientRect();
         this.model_type = this.type_list[this.$route.query.modelType - 1].key;
-
-        // const filename = this.filePath.split('/').pop();
-        // const index = filename.lastIndexOf(".");
-        // const suffix = filename.substr(index + 1).toLowerCase();
-        //
-        // if(suffix=="jar")
-        // {
-        //     this.fileIcon="../../assets/jar.png";
-        // }
-        // else if(suffix=="py")
-        // {
-        //     this.fileIcon="../../assets/py.png";
-        // }
     },
     methods: {
         getFileName() {
             return this.filePath.split('/').pop();
         },
-        showDetails() {
-            this.isDetailsVisible = true;
-        },
-        hideDetails() {
-            this.isDetailsVisible = false;
-        },
         downloadFile() {
             const filename = this.filePath.split('/').pop(); // 要下载的文件名
             request.get(`/othermodel/download/${filename}`).then(res => {