切换学生清理缓存数据

This commit is contained in:
ywyonui 2025-09-06 10:12:02 +08:00
parent 9ca499e2e7
commit 7b2ac02adb
3 changed files with 15 additions and 0 deletions

View File

@ -60,7 +60,9 @@
<script setup lang="ts">
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getUser, setCurXs, getCurXs, getXsPickerInitialized, setXsPickerInitialized } = useUserStore();
const { setQk } = useDataStore();
//
const props = defineProps<{
@ -84,6 +86,8 @@ const showPicker = () => {
//
const switchXs = (xs: any) => {
setCurXs(xs);
//
setQk({});
showFlag.value = false;
emit('change', xs);
}

View File

@ -39,6 +39,15 @@ export const useDataStore = defineStore({
}
},
actions: {
cleanData() {
this.data = {};
this.kcData = {};
this.jcBzData = {};
this.global = {};
this.file = {};
this.params = {};
this.qk = {};
},
setData(data: any) {
this.data = data;
},

View File

@ -5,6 +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";
const defWsCallback = (type: string, data: any) => {
console.log('接收到 WebSocket 消息, 默认处理函数:', type, data);
@ -225,6 +226,7 @@ export const useUserStore = defineStore({
this.wsCallback = defWsCallback;
useDicStore().setData({});
useCommonStore().setData({});
// useDataStore().cleanData();
},
},
persist: {