update 优化代码

This commit is contained in:
疯狂的狮子Li 2025-03-06 23:08:06 +08:00
parent b1b63ebf7f
commit abc6e4f454
2 changed files with 6 additions and 9 deletions

View File

@ -99,6 +99,7 @@ import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
import { TenantVO } from '@/api/types'; import { TenantVO } from '@/api/types';
import notice from './notice/index.vue'; import notice from './notice/index.vue';
import router from '@/router'; import router from '@/router';
import {ElMessageBoxOptions} from "element-plus/es/components/message-box/src/message-box.type";
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
@ -128,8 +129,8 @@ const dynamicTenantEvent = async (tenantId: string) => {
await dynamicTenant(tenantId); await dynamicTenant(tenantId);
dynamic.value = true; dynamic.value = true;
await proxy?.$router.push('/'); await proxy?.$router.push('/');
await proxy?.proxy.$tab.closeAllPage(); await proxy?.$tab.closeAllPage();
await proxy?.proxy.$tab.refreshPage(); await proxy?.$tab.refreshPage();
} }
}; };
@ -137,8 +138,8 @@ const dynamicClearEvent = async () => {
await dynamicClear(); await dynamicClear();
dynamic.value = false; dynamic.value = false;
await proxy?.$router.push('/'); await proxy?.$router.push('/');
await proxy?.proxy.$tab.closeAllPage(); await proxy?.$tab.closeAllPage();
await proxy?.proxy.$tab.refreshPage(); await proxy?.$tab.refreshPage();
}; };
/** 租户列表 */ /** 租户列表 */
@ -163,7 +164,7 @@ const logout = async () => {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}); } as ElMessageBoxOptions);
userStore.logout().then(() => { userStore.logout().then(() => {
router.replace({ router.replace({
path: '/login', path: '/login',

View File

@ -85,7 +85,3 @@ export const useUserStore = defineStore('user', () => {
}); });
export default useUserStore; export default useUserStore;
// 非setup
export function useUserStoreHook() {
return useUserStore(store);
}