From 100f44e197dd99ff63220e2fa05d5c564f278aa6 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期日, 12 一月 2025 20:54:58 +0800 Subject: [PATCH] fix 修复 切换租户 tabs过多导致卡住问题 --- src/layout/components/Navbar.vue | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 617c5da..f821448 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -98,6 +98,7 @@ 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(); @@ -126,18 +127,18 @@ if (companyName.value != null && companyName.value !== '') { await dynamicTenant(tenantId); dynamic.value = true; - proxy?.$tab.closeAllPage(); - proxy?.$router.push('/'); - proxy?.$tab.refreshPage(); + await proxy?.$router.push('/'); + await proxy?.$tab.closeAllPage(); + await proxy?.$tab.refreshPage(); } }; const dynamicClearEvent = async () => { await dynamicClear(); dynamic.value = false; - proxy?.$tab.closeAllPage(); - proxy?.$router.push('/'); - proxy?.$tab.refreshPage(); + await proxy?.$router.push('/'); + await proxy?.$tab.closeAllPage(); + await proxy?.$tab.refreshPage(); }; /** 绉熸埛鍒楄〃 */ @@ -163,8 +164,14 @@ 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']); -- Gitblit v1.9.3