调整登录时清理上一次的使用数据

This commit is contained in:
ywyonui 2025-09-06 10:38:47 +08:00
parent 2b8ad5a5fe
commit c2396a8e71

View File

@ -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: {