73 lines
2.2 KiB
JavaScript
73 lines
2.2 KiB
JavaScript
/**
|
|
* 纯打手端开关:点单端页面保留但不作为入口/回落目标。
|
|
* 回退:git checkout backup/before-fighter-only-20260727
|
|
* 或:git reset --hard backup-fighter-only-20260727
|
|
*/
|
|
export const FIGHTER_ONLY = true
|
|
|
|
/** 无邀请码搜索进入时,自动注册绑定的管事邀请码(前端硬编码,仍正常传给后端) */
|
|
export const FIGHTER_ONLY_DEFAULT_INVITE = '0000008VfJKPu4Spmcjt'
|
|
|
|
/** 已认证打手冷启动默认页 */
|
|
export const FIGHTER_HOME = '/pages/accept-order/accept-order'
|
|
|
|
/** 未登录 / 未认证 / 清缓存后的落地页(注册 + 我的) */
|
|
export const FIGHTER_MINE = '/pages/fighter/fighter'
|
|
|
|
/** 清除缓存后禁止自动登录/自动注册(用户手动点登录后再清) */
|
|
export const SKIP_AUTO_AUTH_KEY = 'fighter_skip_auto_auth'
|
|
|
|
export function isFighterOnly() {
|
|
return FIGHTER_ONLY === true
|
|
}
|
|
|
|
export function isDashouCertified() {
|
|
return Number(wx.getStorageSync('dashoustatus')) === 1
|
|
}
|
|
|
|
export function markSkipAutoAuth() {
|
|
try {
|
|
wx.setStorageSync(SKIP_AUTO_AUTH_KEY, '1')
|
|
} catch (e) {}
|
|
}
|
|
|
|
export function clearSkipAutoAuth() {
|
|
try {
|
|
wx.removeStorageSync(SKIP_AUTO_AUTH_KEY)
|
|
} catch (e) {}
|
|
}
|
|
|
|
export function shouldSkipAutoAuth() {
|
|
try {
|
|
return wx.getStorageSync(SKIP_AUTO_AUTH_KEY) === '1'
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|
|
|
|
/** 冷启动应去的页面:未登录 / 未认证 → 登录页;已认证 → 抢单池 */
|
|
export function resolveFighterOnlyLaunchUrl() {
|
|
const token = wx.getStorageSync('token')
|
|
if (!token) return FIGHTER_MINE
|
|
if (isDashouCertified()) return FIGHTER_HOME
|
|
return FIGHTER_MINE
|
|
}
|
|
|
|
/** 是否允许进入抢单池(必须已登录且已是接单员) */
|
|
export function canEnterAcceptOrder() {
|
|
return !!wx.getStorageSync('token') && isDashouCertified()
|
|
}
|
|
|
|
/** 未登录 / 登录失效时的落地页(绝不再回点单端我的) */
|
|
export function getLoginPageUrl() {
|
|
return isFighterOnly() ? FIGHTER_MINE : '/pages/mine/mine'
|
|
}
|
|
|
|
/** 严格判断是否已开通商家老板身份 */
|
|
export function isShangjiaCertified() {
|
|
// 只认数字 1;排除 true/"true"/脏数据
|
|
const raw = wx.getStorageSync('shangjiastatus')
|
|
if (raw === true || raw === 'true') return false
|
|
return Number(raw) === 1
|
|
}
|