预告警单

This commit is contained in:
sjl
2025-12-31 08:36:14 +08:00
parent 38028b5cb0
commit 72b1f39814
5 changed files with 17 additions and 11 deletions

View File

@@ -55,9 +55,10 @@ function removeLastDotSuffix(str: string) {
export const previewFile = async (urls: any) => {
//console.log('预览', urls)
let url = ''
//console.log('urls', decodeURI(urls))
await downloadFile({ filePath: decodeURI(urls) })
.then((res: any) => {
// 1. 确定文件MIME类型优化用更简洁的方式
const getFileType = (url: string) => {
const ext = url.split('.').pop()?.toLowerCase() || ''
@@ -74,7 +75,7 @@ export const previewFile = async (urls: any) => {
}
return mimeMap[ext] || ''
}
const blob = new Blob([res], { type: getFileType(decodeURI(urls)) })