diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 9a61cfe..2354531 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -5,7 +5,7 @@ import { imagUrl } from "@/utils"; import { useWebSocket } from '@/utils/webSocket/webSocket' import { useDicStore } from "@/store/modules/dic"; import { useCommonStore } from "@/store/modules/common"; -// import { useDataStore } from "@/store/modules/data"; +import { useDataStore } from "@/store/modules/data"; const defWsCallback = (type: string, data: any) => { console.log('接收到 WebSocket 消息, 默认处理函数:', type, data); @@ -189,10 +189,12 @@ export const useUserStore = defineStore({ * @description: 登录成功后的操作 */ afterLoginAction(value: any) { - this.setUser(value) // 为了避免数据加载异常。这里清理一下缓存 useDicStore().setData({}); useCommonStore().setData({}); + useDataStore().cleanData(); + // 设置用户数据 + this.setUser(value) if (value.xsList && value.xsList.length > 0) { for (let i = 0; i < value.xsList.length; i++) { const xs = value.xsList[i]; @@ -226,7 +228,7 @@ export const useUserStore = defineStore({ this.wsCallback = defWsCallback; useDicStore().setData({}); useCommonStore().setData({}); - // useDataStore().cleanData(); + useDataStore().cleanData(); }, }, persist: {