添加onPageLoadInitAuth函数判断登录
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { loginStatusPage, post } from '@/utils/https';
|
||||
import { onPageLoadInitAuth, post } from '@/utils/https';
|
||||
import { SaleOrderProcessStateOption } from '@/utils/config';
|
||||
import {
|
||||
cloneLite,
|
||||
@@ -22,16 +22,17 @@ Page({
|
||||
saleOrderProcessStateOption: SaleOrderProcessStateOption,
|
||||
sort: [{ label: '创建日期', value: 'create_date' }],
|
||||
detail: { show: false, title: '', data: [] as any[] },
|
||||
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;
|
||||
@@ -67,13 +68,20 @@ Page({
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('ProduceOrder/getListV2', 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 });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
post('ProduceOrder/getListV2', 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, isLogin: true });
|
||||
resolve(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.setData({ isLogin: false });
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -115,7 +123,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
loginStatusPage(this);
|
||||
onPageLoadInitAuth(this, () => this.getList());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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());
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user