Commit 4aed8e54 by qinjianhui

Merge branch 'dev' into 'master'

Dev

See merge request !54
parents a5382b41 50481cae
...@@ -1921,23 +1921,28 @@ const handleDownload = async (row: PodUsOrderListData, type: string) => { ...@@ -1921,23 +1921,28 @@ const handleDownload = async (row: PodUsOrderListData, type: string) => {
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const url = filePath + (type === 'png' ? row.url : row.tiffUrl) const url =
type === 'png'
? filePath + row.url
: `https://ps.jomalls.com/tiff/` + row.tiffUrl
fetch(url) const response = await fetch(url)
.then((res) => res.blob()) if (!response.ok) {
.then((blob) => { throw new Error('网络响应错误')
}
const blob = await response.blob()
const link = document.createElement('a') const link = document.createElement('a')
link.href = URL.createObjectURL(blob) link.href = URL.createObjectURL(blob)
link.download = url ? url.split('/').pop() || 'download' : 'download' link.download = url ? url.split('/').pop() || 'download' : 'download'
link.click() link.click()
})
.then(() => { await batchDownloadDownloadApi({ id: row.id, type })
batchDownloadDownloadApi({ id: row.id, type })
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
loadTabData() loadTabData()
})
} catch (e) { } catch (e) {
ElMessage.error('下载失败')
console.error(e) console.error(e)
} finally { } finally {
loading.close() loading.close()
......
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