精简页面初始化代码
This commit is contained in:
@@ -172,6 +172,23 @@ export const loginStatus = () => {
|
||||
});
|
||||
};
|
||||
|
||||
export const loginStatusPage = (that: WechatMiniprogram.Page.Instance<any, any>) => {
|
||||
that.setData({ loading: true });
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
loginStatus()
|
||||
.then(() => {
|
||||
that.setData({ isLogin: true, loading: false });
|
||||
that?.init?.();
|
||||
resolve();
|
||||
})
|
||||
.catch((err) => {
|
||||
that.setData({ isLogin: false, loading: false });
|
||||
reject();
|
||||
console.log('调用登录状态请求失败', err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} config { showLoading: true, showError: true }
|
||||
|
||||
Reference in New Issue
Block a user