front/src/composables/ediAdvisorAudience.ts
zzh 2ac6ec85cd
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m57s
feat: 优化客户中心与小迪沉浸壳,修复登录后无法进系统,并改版 SKU 弹窗
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 20:46:00 +08:00

25 lines
891 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** 小迪受众:客户侧(查价/轨迹)vs 运营排障(指引、不调客户工具) */
export type EdiAdvisorAudience = 'customer' | 'ops';
/**
* 解析是否运营排障受众。
* - 显式 audience 优先
* - H5:`/h5/admin/**` → ops;其余 `/h5/**` → customer(避免未登录默认 User 门户误判)
* - 其余:非客户/代理门户 → ops
*/
export function resolveIsOpsAudience(options: {
audience?: EdiAdvisorAudience | null;
path: string;
isCustomerPortal: boolean;
isAgentPortal: boolean;
}): boolean {
if (options.audience === 'ops') return true;
if (options.audience === 'customer') return false;
const path = options.path || '';
if (path === '/h5/admin' || path.startsWith('/h5/admin/')) return true;
if (path === '/h5' || path.startsWith('/h5/')) return false;
return !options.isCustomerPortal && !options.isAgentPortal;
}