Commit c39eb70b by zhuzhequan

Merge branch 'dev' into 'master'

Dev

See merge request !48
parents 1c7e5845 c2b3c106
......@@ -2231,11 +2231,31 @@ const downloadTif = async (type: string) => {
type === 'tiff'
? `https://ps.jomalls.com/tiff/` + res.message
: filePath + res.message
window.open(url, '_blank')
if (type === 'tiff') {
window.open(url, '_blank')
tifDownloadLoading.value = false
} else {
pngDownloadLoading.value = false
fetch(url)
.then(response => {
// 确保响应是 OK
if (!response.ok) {
throw new Error('网络响应错误')
}
// 返回图片的二进制数据(Blob)
return response.blob()
})
.then(blob => {
const a = document.createElement('a')
a.href = window.URL.createObjectURL(blob)
a.target = '_blank'
a.download = (res.message as string).split('/')[ (res.message as string).split('/').length - 1]
a.click()
pngDownloadLoading.value = false
})
.catch(error => {
console.error('下载图片时出错:', error)
pngDownloadLoading.value = false
})
}
} catch (e) {
console.log(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment