From 0ec756cf5858fa840e4938fff949a0defafe6de0 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 04 八月 2021 13:09:43 +0800
Subject: [PATCH] fix oss列表 jpeg 不回显问题

---
 ruoyi-ui/src/views/system/oss/index.vue |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ruoyi-ui/src/views/system/oss/index.vue b/ruoyi-ui/src/views/system/oss/index.vue
index 88fd105..a183938 100644
--- a/ruoyi-ui/src/views/system/oss/index.vue
+++ b/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 @@
         this.loading = false;
       });
     },
+    checkFileSuffix(fileSuffix) {
+      let arr = ["png", "jpg", "jpeg"];
+      return arr.some(type => {
+        return fileSuffix.indexOf(type) > -1;
+      });
+    },
     // 鍙栨秷鎸夐挳
     cancel() {
       this.open = false;

--
Gitblit v1.9.3