精简页面初始化代码

This commit is contained in:
zhengw
2026-02-06 15:30:07 +08:00
parent 9ce21008a3
commit f11f4c8000
35 changed files with 85 additions and 376 deletions

View File

@@ -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 }