添加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 {
cloneLite,
getAuthInfo,
@@ -29,16 +29,17 @@ Page({
{ value: 4, label: '无需结算' },
],
sort: [{ label: '创建日期', value: 'create_date' }],
isLogin: false,
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
this.getList();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
searchChange(e: any) {
const key = getDataSet(e).key;
@@ -74,16 +75,24 @@ Page({
} else {
delete temp.pay_state;
}
post('ErpDepot/depotHeadList', temp).then((res: any) => {
const list = toArray(res.data);
if (list.length == 0 && this.data.params.curr_page > 1) {
this.getList(this.data.params.curr_page - 1);
}
this.setData({
count: toNumber(res.count),
list: list,
});
return new Promise<void>((resolve, reject) => {
post('ErpDepot/depotHeadList', temp)
.then((res: any) => {
const list = toArray(res.data);
if (list.length == 0 && this.data.params.curr_page > 1) {
this.getList(this.data.params.curr_page - 1);
}
this.setData({
count: toNumber(res.count),
list: list,
isLogin: true,
});
resolve(res);
})
.catch((res) => {
this.setData({ isLogin: false });
reject(res);
});
});
},
onOrderDel(e: any) {
@@ -131,7 +140,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
loginStatusPage(this);
onPageLoadInitAuth(this, () => this.getList());
},
/**