From 368e727cc9f3297302251a12317eddb2b4c1fd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=9F=91=E8=9E=82?= Date: Wed, 22 Apr 2026 15:40:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=97=B6=E5=85=B3=E9=97=AD=E6=89=80=E6=9C=89=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E9=A1=B5=E9=81=BF=E5=85=8D=E6=97=A7=E6=95=B0=E6=8D=AE=E6=AE=8B?= =?UTF-8?q?=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 切换账户后清空标签页并跳转首页,防止不同公司下携带旧参数的页面残留 --- .../apps/web-antd/src/components/SwitchAccountModal.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ecom-dmb-frontend/apps/web-antd/src/components/SwitchAccountModal.vue b/ecom-dmb-frontend/apps/web-antd/src/components/SwitchAccountModal.vue index 32333a1b..47fd4b38 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/components/SwitchAccountModal.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/components/SwitchAccountModal.vue @@ -4,8 +4,11 @@ import type { UserVO } from '#/api/system/user/types'; import type { PageQueryDTO } from '#/types/common'; import { computed, ref, watch } from 'vue'; +import { useRouter } from 'vue-router'; import { useVbenModal } from '@vben/common-ui'; +import { useTabs } from '@vben/hooks'; +import { preferences } from '@vben/preferences'; import { useAccessStore } from '@vben/stores'; import { Avatar, Card, Form, message, Select, Spin } from 'ant-design-vue'; @@ -39,6 +42,8 @@ const userHasMore = ref(true); // 选中的用户信息 const selectedUser = ref(null); +const { closeAllTabs } = useTabs(); +const router = useRouter(); // 公司选项 const companyOptions = computed(() => @@ -230,6 +235,10 @@ const handleSwitchAccount = async () => { // 重置权限检查状态,让路由守卫重新生成菜单和路由 accessStore.setIsAccessChecked(false); + // 清空当前标签页,避免不同公司下携带旧参数(如店铺ID)的页面残留 + await closeAllTabs(); + await router.replace(preferences.app.defaultHomePath); + message.success('切换账户成功'); modalApi.close();