fix: 打手端每次进入均向后端校验手机号认证
This commit is contained in:
25
app.js
25
app.js
@@ -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) {}
|
||||
},
|
||||
|
||||
// 连接管理方法
|
||||
|
||||
Reference in New Issue
Block a user