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

View File

@@ -1,5 +1,7 @@
/** 三端固定normal | dashou | shangjia认证后不可回退 */
import { ensurePhoneAuth } from './phone-auth.js';
const VALID = ['normal', 'dashou', 'shangjia'];
const LEGACY_CENTER_ROLES = ['guanshi', 'zuzhang', 'kaoheguan'];
@@ -87,8 +89,7 @@ export const PRIMARY_DEFAULT_PAGES = {
};
/** 锁定主端并跳转到该端默认首页,同时建立 IM 长连接 */
export function enterLockedRole(role, app) {
if (!VALID.includes(role) || role === 'normal') return false;
function finishEnterLockedRole(role, app) {
app = app || getApp();
lockPrimaryRole(role, app);
wx.reLaunch({ url: PRIMARY_DEFAULT_PAGES[role] });
@@ -103,3 +104,14 @@ export function enterLockedRole(role, app) {
}, 600);
return true;
}
export function enterLockedRole(role, app) {
if (!VALID.includes(role) || role === 'normal') return false;
if (role === 'dashou') {
ensurePhoneAuth({ redirect: true, role: 'dashou' }).then((ok) => {
if (ok) finishEnterLockedRole(role, app);
});
return true;
}
return finishEnterLockedRole(role, app);
}