update 优化 下载zip方法增加遮罩层
This commit is contained in:
parent
d930b15104
commit
40175c150c
@ -34,6 +34,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async zip(url: string, name: string) {
|
async zip(url: string, name: string) {
|
||||||
url = baseURL + url;
|
url = baseURL + url;
|
||||||
|
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
|
||||||
|
try {
|
||||||
const res = await axios({
|
const res = await axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: url,
|
url: url,
|
||||||
@ -50,6 +52,12 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.printErrMsg(res.data);
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
|
downloadLoadingInstance.close();
|
||||||
|
} catch (r) {
|
||||||
|
console.error(r)
|
||||||
|
ElMessage.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async printErrMsg(data: any) {
|
async printErrMsg(data: any) {
|
||||||
const resText = await data.text();
|
const resText = await data.text();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user