update 优化 下载zip方法增加遮罩层

This commit is contained in:
疯狂的狮子Li
2023-07-04 16:38:56 +08:00
parent e4a041154a
commit 413c55fdcb
2 changed files with 14 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ export default {
const isBlob = blobValidate(res.data);
if (isBlob) {
const blob = new Blob([res.data], { type: 'application/octet-stream' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
} else {
this.printErrMsg(res.data);
}
@@ -34,6 +34,7 @@ export default {
},
zip(url, name) {
var url = baseURL + url
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
axios({
method: 'get',
url: url,
@@ -50,6 +51,11 @@ export default {
} else {
this.printErrMsg(res.data);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
},
saveAs(text, name, opts) {