Переглянути джерело

fix oss列表 jpeg 不回显问题

疯狂的狮子li 3 роки тому
батько
коміт
0ec756cf58
1 змінених файлів з 8 додано та 2 видалено
  1. 8 2
      ruoyi-ui/src/views/system/oss/index.vue

+ 8 - 2
ruoyi-ui/src/views/system/oss/index.vue

@@ -109,12 +109,12 @@
       <el-table-column label="文件展示" align="center" prop="url">
         <template slot-scope="scope">
           <el-image
-            v-if="previewListResource && scope.row.fileSuffix.indexOf('png','jpg','jpeg') > 0"
+            v-if="previewListResource && checkFileSuffix(scope.row.fileSuffix)"
             style="width: 100px; height: 100px;"
             :src="scope.row.url"
             :preview-src-list="[scope.row.url]"/>
           <span v-text="scope.row.url"
-                v-if="scope.row.fileSuffix.indexOf('png','jpg','jpeg') < 0 || !previewListResource"/>
+                v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource"/>
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -247,6 +247,12 @@ export default {
         this.loading = false;
       });
     },
+    checkFileSuffix(fileSuffix) {
+      let arr = ["png", "jpg", "jpeg"];
+      return arr.some(type => {
+        return fileSuffix.indexOf(type) > -1;
+      });
+    },
     // 取消按钮
     cancel() {
       this.open = false;