fix: 打手端每次进入均向后端校验手机号认证

This commit is contained in:
XingQue
2026-06-22 16:42:36 +08:00
parent 0767e23f11
commit e54846df02
7 changed files with 137 additions and 104 deletions

25
app.js
View File

@@ -180,6 +180,22 @@ App({
const savedRole = getPrimaryRole(this);
lockPrimaryRole(savedRole, this);
// ②b 进入各端前先问后端是否需要手机号认证
if (wx.getStorageSync('token')) {
try {
const needAuth = await check();
if (needAuth) {
if (savedRole === 'dashou') {
wx.setStorageSync('phone_auth_return_role', 'dashou');
} else if (savedRole === 'shangjia') {
wx.setStorageSync('phone_auth_return_role', 'shangjia');
}
wx.reLaunch({ url: '/pages/phone-auth/phone-auth' });
return;
}
} catch (e) {}
}
const targetPage = roleDefaultPage[savedRole] || '/pages/index/index';
if (savedRole !== 'normal') {
setTimeout(() => {
@@ -221,15 +237,6 @@ App({
.catch(err => {
console.warn('远程配置获取失败,继续使用本地缓存', err);
});
// ⑦ 手机号认证检查
try {
const needAuth = await check();
if (needAuth) {
wx.reLaunch({ url: '/pages/phone-auth/phone-auth' });
return;
}
} catch (e) {}
},
// 连接管理方法