import { Button, Descriptions, Modal, Space, message } from "antd"; import PreviewImg from "zy-react-library/components/PreviewImg"; import PreviewPdf from "zy-react-library/components/PreviewPdf"; import { getFileName, getFileSuffix, getFileUrl } from "zy-react-library/utils"; const ViewQualificationDetailsModal = (props) => { const handleDownload = async (file) => { const baseUrl = getFileUrl(); const fileUrl = file.url || (file.filePath ? `${baseUrl}${file.filePath}` : ""); const fileName = file.fileName || file.name || getFileName(file.filePath || fileUrl); if (!fileUrl) { message.error("文件地址不存在"); return; } try { const response = await fetch(fileUrl); const blob = await response.blob(); const link = document.createElement("a"); const blobUrl = window.URL.createObjectURL(blob); link.href = blobUrl; link.download = fileName; link.style.display = "none"; document.body.appendChild(link); link.click(); document.body.removeChild(link); window.URL.revokeObjectURL(blobUrl); } catch { message.error("下载失败"); } }; const previewFile = () => { const files = props.data.files || []; const imgFiles = []; const pdfFiles = []; const compressedFiles = []; for (let i = 0; i < files.length; i++) { const file = files[i]; const suffix = getFileSuffix(file.fileName || file.name || "").toLowerCase(); if (suffix === "pdf") { pdfFiles.push(file); } else if (suffix === "zip" || suffix === "rar") { compressedFiles.push(file); } else { imgFiles.push(file); } } const compressedFileNodes = compressedFiles.length > 0 && (