From 4ef6c36c631c3aa3916e0861fd211dec9b03231b Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期一, 08 一月 2024 09:54:05 +0800 Subject: [PATCH] 修改跳转 --- src/views/notCoalMine/nCertificateList/components/certificateDialog.vue | 35 +++++++++++++++++++++++++++++------ 1 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue b/src/views/notCoalMine/nCertificateList/components/certificateDialog.vue index abb4e1c..c0316e1 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,7 @@ <script> // import {getExpertTypes,addExpertInfo,uploadFile} from '@/api/system/form' // import { verifySimplePhone, verifyIdCard } from "@/utils/validate"; +import axios from "axios"; export default { name: "nCertificateDialog", dicts: ['sys_nation_code'], @@ -314,7 +318,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