测试调整pre
This commit is contained in:
parent
7c7a34ad2a
commit
091411cda0
@ -30,6 +30,9 @@ const loadByDb = async (data: any) => {
|
|||||||
console.log("用户未登录,跳过处理");
|
console.log("用户未登录,跳过处理");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 等待下一个 tick 确保响应式更新完成
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 优先从后端根据url中的id去查询Xxts
|
// 优先从后端根据url中的id去查询Xxts
|
||||||
const xxtsRes = await xxtsFindByIdApi({ id: data.id });
|
const xxtsRes = await xxtsFindByIdApi({ id: data.id });
|
||||||
@ -37,12 +40,23 @@ const loadByDb = async (data: any) => {
|
|||||||
const xxts = xxtsRes.result;
|
const xxts = xxtsRes.result;
|
||||||
setXxts(xxts);
|
setXxts(xxts);
|
||||||
}
|
}
|
||||||
const xsList = getUser.xsList || [];
|
|
||||||
|
// 等待下一个 tick 确保响应式更新完成
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
// 或者直接从 store 实例获取最新数据
|
||||||
|
const currentUser = useUserStore().getUser;
|
||||||
|
|
||||||
|
const xsList = currentUser.xsList || [];
|
||||||
if (xsList && xsList.length > 0) {
|
if (xsList && xsList.length > 0) {
|
||||||
// 获取当前学生信息
|
// 获取当前学生信息
|
||||||
const curXs = xsList.find((xs: any) => xs.id == data.xsId);
|
const curXs = xsList.find((xs: any) => xs.id == data.xsId);
|
||||||
if (curXs) {
|
if (curXs) {
|
||||||
setCurXs(curXs);
|
setCurXs(curXs);
|
||||||
|
|
||||||
|
// 等待下一个 tick 确保响应式更新完成
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
// 检查抢课逻辑
|
// 检查抢课逻辑
|
||||||
PageUtils.checkQkLogic(data.xkLxId);
|
PageUtils.checkQkLogic(data.xkLxId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ export const useCommonStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
cleanData() {
|
cleanData() {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
this.$reset();
|
||||||
},
|
},
|
||||||
setData(key: string, data: any) {
|
setData(key: string, data: any) {
|
||||||
this.data[key] = data;
|
this.data[key] = data;
|
||||||
|
|||||||
@ -68,6 +68,7 @@ export const useDataStore = defineStore({
|
|||||||
this.jcBz = {};
|
this.jcBz = {};
|
||||||
this.lcgl = {};
|
this.lcgl = {};
|
||||||
this.xxts = {};
|
this.xxts = {};
|
||||||
|
this.$reset();
|
||||||
},
|
},
|
||||||
setData(data: any) {
|
setData(data: any) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ export const useDicStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
cleanData() {
|
cleanData() {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
this.$reset();
|
||||||
},
|
},
|
||||||
setData(data: any) {
|
setData(data: any) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|||||||
@ -163,6 +163,7 @@ export const useUserStore = defineStore({
|
|||||||
if (this.userdata && this.userdata.openId && this.userdata.userType === "JZ"
|
if (this.userdata && this.userdata.openId && this.userdata.userType === "JZ"
|
||||||
&& openId && this.userdata.openId === openId
|
&& openId && this.userdata.openId === openId
|
||||||
) {
|
) {
|
||||||
|
this.afterLoginAction(this.userdata);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 如果当前登录的用户的openid和传入的openid不匹配,则调用checkOpenId接口进行校验
|
// 如果当前登录的用户的openid和传入的openid不匹配,则调用checkOpenId接口进行校验
|
||||||
@ -192,9 +193,7 @@ export const useUserStore = defineStore({
|
|||||||
*/
|
*/
|
||||||
afterLoginAction(value: any) {
|
afterLoginAction(value: any) {
|
||||||
// 为了避免数据加载异常。这里清理一下缓存
|
// 为了避免数据加载异常。这里清理一下缓存
|
||||||
useDicStore().cleanData()
|
this.logout();
|
||||||
useCommonStore().cleanData();
|
|
||||||
useDataStore().cleanData();
|
|
||||||
// 设置用户数据
|
// 设置用户数据
|
||||||
this.setUser(value)
|
this.setUser(value)
|
||||||
if (value.xsList && value.xsList.length > 0) {
|
if (value.xsList && value.xsList.length > 0) {
|
||||||
@ -228,6 +227,7 @@ export const useUserStore = defineStore({
|
|||||||
this.setXsPickerInitialized(false); // 注销时重置学生选择器状态
|
this.setXsPickerInitialized(false); // 注销时重置学生选择器状态
|
||||||
this.exitWs();
|
this.exitWs();
|
||||||
this.wsCallback = defWsCallback;
|
this.wsCallback = defWsCallback;
|
||||||
|
this.$reset();
|
||||||
useDicStore().cleanData()
|
useDicStore().cleanData()
|
||||||
useCommonStore().cleanData();
|
useCommonStore().cleanData();
|
||||||
useDataStore().cleanData();
|
useDataStore().cleanData();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user