切换学生清理缓存数据
This commit is contained in:
parent
9ca499e2e7
commit
7b2ac02adb
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
},
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user