添加onPageLoadInitAuth函数判断登录
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { getAuthInfo, getDataSet, toArray } from '@/utils/util';
|
||||
|
||||
Page({
|
||||
@@ -13,15 +13,23 @@ Page({
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
post('CompanyProcessV2/getParentProcess').then((res: any) => {
|
||||
this.setData({ list: toArray(res.data) });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('CompanyProcessV2/getParentProcess')
|
||||
.then((res: any) => {
|
||||
this.setData({ list: toArray(res.data), isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
onChildProcess(e: any) {
|
||||
@@ -38,7 +46,7 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user