| | |
| | | |
| | | <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> |
| | |
| | | <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'], |
| | |
| | | }, |
| | | 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> |