董国庆
2025-12-17 10638dc89f1cd2a20c4035383a66192da5dfbccd
culture/src/views/strainReportLibrary/reportLibraryOneFour/add.vue
@@ -160,7 +160,7 @@
import { Card } from 'element-ui';
import AiEditor from '@/components/AiEditor'
import ChooseProject from '@/components/chooseProject/index.vue'
import { customUploadRequest, getFullUrl } from "@/utils/utils";
import { customUploadRequest, getFullUrl ,downloadFileByUrl,getAllocateIp,isImageFile} from "@/utils/utils";
import SelectMember from '@/components/SelectMember'
import { add, getDetail, update } from './service'
@@ -281,10 +281,24 @@
    },
    methods: {
        handlePreview(file) {
            if (file.url) {
                window.open(file.url, '_blank');
            } else {
                this.$message.warning('无可预览地址');
            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 {
                        let newUrl = getAllocateIp() + file.url;
                        console.log('图片链接', newUrl)
                        window.open(newUrl, '_blank');
                    }
                } else {
                    // 非图片文件:使用下载方式
                    downloadFileByUrl(file.url, file.name);
                }
            }
        },