From db905ecd14f63dba9337b4f4715584ef2d7e8c7e Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 07 三月 2025 14:45:00 +0800
Subject: [PATCH] 修改

---
 src/views/notCoalMine/nCertificateList/components/certificateDialog.vue |   58 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue b/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue
index abb4e1c..6334ecc 100644
--- a/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue
+++ b/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue
@@ -92,11 +92,14 @@
 
         <el-row>
           <el-col :span="20">
-            <el-form-item label="图片查看" prop="imgPath">
-              <el-image
-                style="width: 100px; height: 100px"
-                :src="imgPath"
-                fit="fill"></el-image>
+<!--            <el-form-item label="图片查看" prop="imgPath">-->
+<!--              <el-image-->
+<!--                style="width: 100px; height: 100px"-->
+<!--                src="http://inspurtestcx.saws.org.cn/zwfile/zwdownload?filePath=QRCODE/2020/12/01/QRCODE362421197712217718_A12000036320030846.jpg"-->
+<!--                fit="fill"></el-image>-->
+<!--            </el-form-item>-->
+            <el-form-item label="图片查看">
+              <el-link type="primary" style="margin-right: 20px" @click="downloadFile(form.imgPath)" target="_blank">点击查看</el-link>
             </el-form-item>
           </el-col>
         </el-row>
@@ -115,6 +118,8 @@
 <script>
 // import {getExpertTypes,addExpertInfo,uploadFile} from '@/api/system/form'
 // import { verifySimplePhone, verifyIdCard } from "@/utils/validate";
+import { getToken } from "@/utils/auth";
+import axios from "axios";
 export default {
   name: "nCertificateDialog",
   dicts: ['sys_nation_code'],
@@ -211,17 +216,17 @@
       return key in obj
     },
 
-    async getExpertsType(){
-      const res = await getExpertTypes()
-      if(res.code == 200){
-        this.expertsType = res.data
-      }else{
-        this.$message({
-          type: 'warning',
-          message: res.msg
-        });
-      }
-    },
+    // async getExpertsType(){
+    //   const res = await getExpertTypes()
+    //   if(res.code == 200){
+    //     this.expertsType = res.data
+    //   }else{
+    //     this.$message({
+    //       type: 'warning',
+    //       message: res.msg
+    //     });
+    //   }
+    // },
     avatorChange(file, fileList) {
       this.fileList = fileList;
     },
@@ -314,7 +319,26 @@
     },
     changeSource(num){
       this.form.source = num
-    }
+    },
+
+    downloadFile(file){
+      const t = this
+      axios.get(file,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob'}).then(res=>{
+        if (res) {
+          const link = document.createElement('a')
+          let blob = new Blob([res.data],{type: res.data.type})
+          link.style.display = "none";
+          link.href = URL.createObjectURL(blob); // 创建URL
+          window.open(link.href)
+          // link.setAttribute("download", file.name);
+          // document.body.appendChild(link);
+          // link.click();
+          // document.body.removeChild(link);
+        } else {
+          this.$message.error('获取文件失败')
+        }
+      })
+    },
   }
 };
 </script>

--
Gitblit v1.9.2