测试调整pre

This commit is contained in:
ywyonui 2025-10-22 12:20:00 +08:00
parent 7c7a34ad2a
commit 091411cda0
5 changed files with 21 additions and 4 deletions

View File

@ -30,6 +30,9 @@ const loadByDb = async (data: any) => {
console.log("用户未登录,跳过处理"); console.log("用户未登录,跳过处理");
return; return;
} }
// tick
await nextTick();
try { try {
// urlidXxts // urlidXxts
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);
} }

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();