添加onPageLoadInitAuth函数判断登录

This commit is contained in:
zhengw
2026-03-09 17:20:17 +08:00
parent 9033acc56d
commit 511d29281e
18 changed files with 368 additions and 209 deletions

View File

@@ -1,4 +1,4 @@
import { loginStatusPage, post } from '@/utils/https';
import { onPageLoadInitAuth, post } from '@/utils/https';
import { formatTime, getAuthInfo, getDataSet, isArray, toArray, toObject } from '@/utils/util';
import { voiceRequest } from '@/utils/voiceUtil';
@@ -67,6 +67,7 @@ Page({
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
this.getExecProcess();
}
},
backChange(e: any) {
@@ -110,17 +111,26 @@ Page({
this.getProcessName();
},
getExecProcess() {
post('CompanyProcessV2/getProcessByCode').then((res: any) => {
this.data.processItems = toArray(res.data);
if (this.data.processItems.length == 1) {
this.data.selectedProcessCode = this.data.processItems[0].process_code;
this.getProcessName();
} else {
this.getProcessName();
}
this.setData({
processItems: this.data.processItems,
});
return new Promise<void>((resolve, reject) => {
post('CompanyProcessV2/getProcessByCode')
.then((res: any) => {
this.data.processItems = toArray(res.data);
if (this.data.processItems.length == 1) {
this.data.selectedProcessCode = this.data.processItems[0].process_code;
this.getProcessName();
} else {
this.getProcessName();
}
this.setData({
processItems: this.data.processItems,
isLogin: true,
});
resolve(res);
})
.catch((res) => {
this.setData({ isLogin: false });
reject(res);
});
});
},
init() {
@@ -139,7 +149,6 @@ Page({
process_code: code,
logType: logType || 0,
});
this.getExecProcess();
},
voiceChange(event: any) {
this.setData({
@@ -340,7 +349,7 @@ Page({
loading: true,
voice: wx.getStorageSync('processEntryVoice') == 'false' ? false : true,
});
loginStatusPage(this);
onPageLoadInitAuth(this, () => this.getExecProcess());
},
/**