From 9dd7bf89909a0473ed02a7f1df7442973dd96c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 20 Nov 2024 11:25:51 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E4=B8=8Etoken=E8=BF=87=E6=9C=9F=E7=99=BB?= =?UTF-8?q?=E5=87=BA=E8=B7=B3=E8=BD=AC=E8=A1=8C=E4=B8=BA=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Navbar.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 617c5da..bfe339e 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -98,6 +98,7 @@ import { getTenantList } from '@/api/login'; import { dynamicClear, dynamicTenant } from '@/api/system/tenant'; import { TenantVO } from '@/api/types'; import notice from './notice/index.vue'; +import router from "@/router"; const appStore = useAppStore(); const userStore = useUserStore(); @@ -163,8 +164,14 @@ const logout = async () => { cancelButtonText: '取消', type: 'warning' }); - await userStore.logout(); - location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; + userStore.logout().then(() => { + router.replace({ + path: '/login', + query: { + redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/') + } + }) + }); }; const emits = defineEmits(['setLayout']);