From 94a0ecfdc4c68bc00502d0a054f4d82fc6fd4af3 Mon Sep 17 00:00:00 2001 From: haml-707 <845831435@qq.com> Date: Mon, 3 Jun 2024 15:15:02 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E6=8A=A5=E9=94=99=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=90=8E=E7=AB=AFmsg=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/axios/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/axios/index.ts b/src/shared/axios/index.ts index df7a8d1..89c0f1d 100644 --- a/src/shared/axios/index.ts +++ b/src/shared/axios/index.ts @@ -19,6 +19,9 @@ interface RequestConfig extends AxiosRequestConfig { $doException?: boolean; // 是否弹出错误提示框 global?: boolean; // 是否为全局请求, 全局请求在清除请求池时,不清除 } +interface ErrorResponse { + msg: string; +} // 全局loading let loadingInstance: LoadingInstance | null = null; @@ -135,9 +138,11 @@ const responseInterceptorId = request.interceptors.response.use( } const { config } = err; if (!(config as RequestConfig).$doException) { + const response = err.response as AxiosResponse; + const message = response?.data?.msg || err.message; ElMessage({ type: 'error', - message: err.toString(), + message, }); } // 非取消请求发生异常,同样将请求移除请求池 -- Gitee From 119363fa4e5594e7d525eacf69f1ea247e31aa71 Mon Sep 17 00:00:00 2001 From: haml-707 <845831435@qq.com> Date: Mon, 3 Jun 2024 15:16:48 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E9=95=BF=E5=BA=A6=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppVerify.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/AppVerify.vue b/src/components/AppVerify.vue index 2fd7c73..8aa1471 100644 --- a/src/components/AppVerify.vue +++ b/src/components/AppVerify.vue @@ -50,9 +50,13 @@ const { t, locale } = useI18n();