| | |
| | | import ApprovalProcess from "@/components/approvalProcess"; |
| | | import AiEditor from "@/components/AiEditor"; |
| | | import { getDetail } from "../../service"; |
| | | import { customUploadRequest, getFullUrl, getAllocateIp } from "@/utils/utils"; |
| | | import { customUploadRequest, getFullUrl, getAllocateIp, downloadFileByUrl, isImageFile } from "@/utils/utils"; |
| | | import apiConfig from '@/utils/baseurl'; |
| | | |
| | | export default { |
| | |
| | | methods: { |
| | | getFullUrl, |
| | | handlePreview(file) { |
| | | console.log('url', file) |
| | | if (file && file.url) { |
| | | if (file.url && file.url.startsWith(getAllocateIp())) { |
| | | window.open(file.url, '_blank'); |
| | | // 判断是否为图片文件 |
| | | 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 { |
| | | let newUrl = getAllocateIp() + file.url; |
| | | console.log('图片链接', newUrl) |
| | | window.open(newUrl, '_blank'); |
| | | } |
| | | } else { |
| | | let newUrl = getAllocateIp() + file.url; |
| | | window.open(newUrl, '_blank'); |
| | | // 非图片文件:使用下载方式 |
| | | downloadFileByUrl(file.url, file.name); |
| | | } |
| | | } |
| | | }, |