From 029ab94f0675447c050a1324838f8965e657b216 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Tue, 25 Jun 2024 19:31:22 +0800 Subject: [PATCH 1/2] Update axios.js --- src/utils/axios.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/axios.js b/src/utils/axios.js index a869df9..7ac0991 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -35,21 +35,20 @@ axios.interceptors.response.use( } } } - if(res.config.headers['action'] == 53211) { // 导出文件 + if(!res.request || res.request.responseType === 'blob') { // 特殊情况处理,导出文件 return res; } - const ret = res.data; // token过期 - if (ret.code === 3004) { + if (res.data.code === 3004) { localRemove("token"); ElMessage.closeAll(); - ElMessage.error(ret.message || "Token异常,请重新登录"); + ElMessage.error(res.data.message || "Token异常,请重新登录"); router.push({ path: "/login" }); - return Promise.reject(ret); + return Promise.reject(res.data); } - return ret; + return Promise.resolve(res.data); }, (error) => { ElMessage.closeAll(); From c2b89ef2ad3107b0259ac56a6d9808a609a414c9 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Tue, 25 Jun 2024 21:17:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infoApi.js | 1 - src/components/AddSet.vue | 3 +-- src/components/ViewSet.vue | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 93b5b1b..45eba25 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -119,7 +119,6 @@ const infoApi = { return postPBRequest('/driver', null, 54001) }, // 查询查询驱动下设备的可用模板列表 - // 查询驱动配置项 getTxTemplate(params) { return postPBRequest("/driver", params, 54011, params.driver_name); }, diff --git a/src/components/AddSet.vue b/src/components/AddSet.vue index 2d951af..26a6478 100644 --- a/src/components/AddSet.vue +++ b/src/components/AddSet.vue @@ -70,7 +70,6 @@ export default { driver_name: props.formData.name } const res = await infoApi.getTxTemplate(param); - if (res.code == 0) { // 获取数据 state.modelArr = []; @@ -84,7 +83,7 @@ export default { } state.addForm.template_name = state.modelArr[0].name; } else { - ElMessage.error(res.data || res.messgae); + ElMessage.error(res.data || res.message); } }; const closeDialog = () => { diff --git a/src/components/ViewSet.vue b/src/components/ViewSet.vue index 83ae594..8172dfa 100644 --- a/src/components/ViewSet.vue +++ b/src/components/ViewSet.vue @@ -79,6 +79,7 @@ export default { if (res.code == 0) { state.propertiesData = res.data || []; } else { + ElMessage.error(res.data || res.message); } }; const closeDialog = () => {