瀏覽代碼

修改行李详情照片

zhaoke 1 年之前
父節點
當前提交
9f40f0affb
共有 1 個文件被更改,包括 20 次插入3 次删除
  1. 20 3
      src/views/newBagDetails/index.vue

+ 20 - 3
src/views/newBagDetails/index.vue

@@ -52,8 +52,14 @@
           <el-scrollbar style="height: 100%;">
             <el-row :gutter="20">
               <el-col style="margin-bottom: 20px;" v-for="(item,index) in srcUrl" :key="index" :span="8">
-                <el-image :src="'data:image/gif;base64,'+item.picData" :preview-src-list="srcList">
-                </el-image>
+                <template v-if="isBase64(item.picData)">
+                  <el-image style="height:100px;width: 100%;" :src="item.picData" :preview-src-list="srcList">
+                  </el-image>
+                </template>
+                <template v-else>
+                  <el-image style="height:100px;width: 100%;" :src="'data:image/gif;base64,'+item.picData" :preview-src-list="srcList">
+                  </el-image>
+                </template>
               </el-col>
             </el-row>
           </el-scrollbar>
@@ -135,6 +141,13 @@ export default {
     this.query = query
   },
   methods: {
+    isBase64 (base) {
+      if (base.includes('base64')) {
+        return true
+      } else {
+        return false
+      }
+    },
     //获取表头数据
     async getColumnData (auth_id) {
       try {
@@ -270,7 +283,11 @@ export default {
         this.srcUrl = returnData
         const datas = [...returnData]
         datas.forEach(item => {
-          urls.push('data:image/gif;base64,' + item.picData)
+          if (item.picData.includes('base64')) {
+            urls.push(item.picData)
+          } else {
+            urls.push('data:image/gif;base64,' + item.picData)
+          }
         })
         this.srcList = urls
       } else {