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

This commit is contained in:
疯狂的狮子Li 2023-07-04 16:39:05 +08:00
parent d930b15104
commit 40175c150c

View File

@ -34,6 +34,8 @@ export default {
},
async zip(url: string, name: string) {
url = baseURL + url;
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
try {
const res = await axios({
method: 'get',
url: url,
@ -50,6 +52,12 @@ export default {
} else {
this.printErrMsg(res.data);
}
downloadLoadingInstance.close();
} catch (r) {
console.error(r)
ElMessage.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
}
},
async printErrMsg(data: any) {
const resText = await data.text();