From b89425404eeb533dea42d7ee348b05d9fe9d040c Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 27 Nov 2024 13:02:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=B6=85=E6=97=B6=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/config/axios/service.ts | 8 +++++++- core/core-frontend/src/locales/zh-CN.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index 4db5140287..341a335446 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -16,7 +16,6 @@ import { config } from './config' import { configHandler } from './refresh' import { isMobile } from '@/utils/utils' import { useRequestStoreWithOut } from '@/store/modules/request' - type AxiosErrorWidthLoading = T & { config: { loading?: boolean @@ -32,6 +31,8 @@ import router from '@/router' const { result_code } = config import { useCache } from '@/hooks/web/useCache' +import { useI18n } from '@/hooks/web/useI18n' +const { t } = useI18n() const { wsCache } = useCache() const requestStore = useRequestStoreWithOut() @@ -207,6 +208,11 @@ service.interceptors.response.use( (error: AxiosErrorWidthLoading) => { if (error.message?.includes('timeout of')) { requestStore.resetLoadingMap() + ElMessage({ + type: 'error', + message: '请求超时,请稍后再试', + showClose: true + }) } if (!error?.response) { diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index cdd949d121..2f94defae4 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1,5 +1,6 @@ export default { common: { + timeout_tips: '请求超时,请稍后再试', component: { input: '单行输入', textarea: '多行输入',