From 5f20f4bba739f0f81101a2c1d99f494647125e05 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 三月 2024 17:19:18 +0800 Subject: [PATCH] 2024.3.21 --- src/api/fysp/evaluateApi.js | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/api/fysp/evaluateApi.js b/src/api/fysp/evaluateApi.js index 0c75408..aef8028 100644 --- a/src/api/fysp/evaluateApi.js +++ b/src/api/fysp/evaluateApi.js @@ -26,16 +26,22 @@ return $fysp .post(`evaluation/auto/record/download`, param, { responseType: 'blob' }) .then((res) => { - // return res.data; - const name = Base64.decode(res.headers.get('filename')); - const url = window.URL.createObjectURL(res.data); - const link = document.createElement('a'); - link.href = url; - link.setAttribute('download', name); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - window.URL.revokeObjectURL(url); + // 鏂囨。鏈敓鎴愶紝宸插惎鍔ㄦ枃妗g敓鎴愬悗鍙颁换鍔� + if (res.data.type == 'application/json') { + return false + } + // 鏂囨。宸插瓨鍦紝鐩存帴涓嬭浇 + else { + const name = Base64.decode(res.headers.get('filename')); + const url = window.URL.createObjectURL(res.data); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', name); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + } }); - }, + } }; -- Gitblit v1.9.3