添加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 { getAuthInfo, getDataSet, toArray } from '@/utils/util';
Page({
@@ -25,26 +25,33 @@ Page({
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
this.getList();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
post('CompanyProcessV2/getAllProcessNum')
.then((res: any) => {
this.setData({ process: toArray(res.data) });
})
.finally(() => {
wx.stopPullDownRefresh();
});
return new Promise<void>((resolve, reject) => {
post('CompanyProcessV2/getAllProcessNum')
.then((res: any) => {
this.setData({ process: toArray(res.data), isLogin: true });
resolve(res);
})
.catch((res) => {
this.setData({ isLogin: false });
reject(res);
})
.finally(() => {
wx.stopPullDownRefresh();
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
loginStatusPage(this);
onPageLoadInitAuth(this, () => this.getList());
},
/**