添加onPageLoadInitAuth函数判断登录

This commit is contained in:
zhengw
2026-03-10 11:33:42 +08:00
parent 511d29281e
commit 76c28f8d78
40 changed files with 816 additions and 526 deletions

View File

@@ -1,4 +1,4 @@
import { loginStatusPage, post } from '@/utils/https';
import { onPageLoadInitAuth, post } from '@/utils/https';
import { getAuthInfo, toArray } from '@/utils/util';
Page({
@@ -14,18 +14,24 @@ Page({
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
this.getList();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
post('CompanyProcessV2/getChildProcess', { process_id: this.data.process_id }).then(
(res: any) => {
this.setData({ list: toArray(res.data) });
},
);
return new Promise<void>((resolve, reject) => {
post('CompanyProcessV2/getChildProcess', { process_id: this.data.process_id })
.then((res: any) => {
this.setData({ list: toArray(res.data), isLogin: true });
resolve(res);
})
.catch((res) => {
this.setData({ isLogin: false });
reject(res);
});
});
},
/**
@@ -37,7 +43,7 @@ Page({
wx.setNavigationBarTitle({ title: decodeURIComponent(title) });
}
this.data.process_id = process_id;
loginStatusPage(this);
onPageLoadInitAuth(this, () => this.getList());
},
/**

View File

@@ -3,7 +3,7 @@
<t-cell-group custom-style="margin: 0">
<block wx:for="{{list}}" wx:key="index">
<t-cell title="{{item.process_name}}" note="{{item.process_code}}" data-index="{{index}}"
bind:tap="onChildProcess" description="提成值: {{item.bonus_value || '未配置'}}">
description="提成值: {{item.bonus_value || '未配置'}}">
<view slot="left-icon" style="color: #999;line-height: 1.5;">
{{index + 1}}
</view>