From dbe4ea990907b07e599c7592a61fcf183829457d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Fri, 27 Feb 2026 17:29:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9418=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/store/modules/user/index.ts | 9 +++++++++ web/src/utils/http/helpers.ts | 4 ++++ web/src/utils/http/index.ts | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/src/store/modules/user/index.ts b/web/src/store/modules/user/index.ts index 42f8bec2..099c38f8 100644 --- a/web/src/store/modules/user/index.ts +++ b/web/src/store/modules/user/index.ts @@ -30,6 +30,15 @@ export const useUserStore = defineStore('user', { resetRouter() this.$reset() toLogin() + }, + refresh() { + const { resetTabs } = useTabStore() + const { resetPermission } = usePermissionStore() + resetPermission() + resetTabs() + resetRouter() + this.$reset() + window.location.reload() } }, persist: true diff --git a/web/src/utils/http/helpers.ts b/web/src/utils/http/helpers.ts index 81782f19..948f2f43 100644 --- a/web/src/utils/http/helpers.ts +++ b/web/src/utils/http/helpers.ts @@ -10,6 +10,10 @@ export function resolveResError(code: number | string | undefined, msg = ''): st msg = msg ?? '登录已过期' useUserStore().logout() break + case 418: + msg = msg ?? '登录已过期' + useUserStore().refresh() + break case 403: msg = msg ?? '没有权限' break diff --git a/web/src/utils/http/index.ts b/web/src/utils/http/index.ts index a9263aaa..ecd52c6c 100644 --- a/web/src/utils/http/index.ts +++ b/web/src/utils/http/index.ts @@ -35,7 +35,7 @@ export const http = createAlova({ if (!noAlert) { if (code === 422) { window.$message.error(msg) - } else if (code !== 401) { + } else if (code !== 401 && code !== 418) { window.$dialog.error({ title: '错误', content: msg,