| | |
| | | </div> |
| | | </div> |
| | | <el-form-item prop="name" style="margin-top: 38px"> |
| | | <el-upload action="#" :file-list="fileList" disabled list-type="text" :on-preview="handlePreview"> |
| | | <el-upload action="#" :file-list="fileList" disabled list-type="text" |
| | | :on-preview="handlePreview"> |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | <div slot="tip" class="el-upload__tip">支持任意格式文件上传</div> |
| | | </el-upload> |
| | |
| | | import ApprovalProcess from '@/components/approvalProcess' |
| | | import AiEditor from '@/components/AiEditor' |
| | | import { getDetail } from '../../service'; |
| | | import { getAllocateIp, downloadFileByUrl, isImageFile } from '@/utils/utils'; |
| | | |
| | | |
| | | export default { |
| | |
| | | this.getList() |
| | | }, |
| | | handlePreview(file) { |
| | | if (file.url) { |
| | | if (file && file.url) { |
| | | // 判断是否为图片文件 |
| | | const isImage = isImageFile(file.url); |
| | | |
| | | if (isImage) { |
| | | // 图片文件:使用 window.open 预览 |
| | | if (file.url && file.url.startsWith(getAllocateIp())) { |
| | | console.log('图片链接', file.url) |
| | | window.open(file.url, '_blank'); |
| | | } else { |
| | | this.$message.warning('无可预览地址'); |
| | | let newUrl = getAllocateIp() + file.url; |
| | | console.log('图片链接', newUrl) |
| | | window.open(newUrl, '_blank'); |
| | | } |
| | | } else { |
| | | // 非图片文件:使用下载方式 |
| | | downloadFileByUrl(file.url, file.name); |
| | | } |
| | | } |
| | | }, |
| | | }, |