import { clearAuthSession, getAuthContext, startAuthSync, switchAccount, } from '/static/portal/common/auth.js?v=20260913'; import { escapeHtml } from '/static/portal/common/formatters.js'; import { mountCustomerServiceWidget } from '/static/portal/common/customer-service-widget/widget.js'; const PUBLIC_LINKS = [ ['home', '首页', '/portal/guest/home/'], ['products', '基金产品', '/portal/guest/products/'], ['ranking', '基金排行', '/portal/guest/products/?view=ranking'], ]; const CUSTOMER_LINKS = [ ['dashboard', '资产总览', '/portal/customer/dashboard/'], ['holdings', '我的持仓', '/portal/customer/holdings/'], ['profit-loss', '收益明细', '/portal/customer/profit-loss/'], ['orders', '交易记录', '/portal/customer/orders/'], ['transactions', '成交明细', '/portal/customer/transactions/'], ['risk-questionnaire', '风险测评', '/portal/customer/risk-questionnaire/'], ]; const RISK_LINKS = [ ['risk-dashboard', '风险工作台', '/portal/employee-risk/dashboard/'], ]; const ADVISOR_LINKS = [ ['advisor-dashboard', '投顾工作台', '/portal/employee-advisor/dashboard/'], ['public-products', '公开产品', '/portal/guest/products/'], ]; const OPERATOR_LINKS = [ ['operator-dashboard', '运营工作台', '/portal/employee-operations/dashboard/'], ['operator-offsite', '场外申赎', '/portal/employee-operations/offsite/'], ['operator-promotion', '推介材料', '/portal/employee-operations/promotion/'], ['operator-nl2sql', 'NL2SQL', '/portal/employee-operations/nl2sql/'], ['public-products', '公开产品', '/portal/guest/products/'], ]; const ADMIN_LINKS = [ ['admin-workspace', '平台治理', '/portal/employee-console/workspace/'], ['risk-dashboard', '风控中心', '/portal/employee-risk/dashboard/'], ]; const ROLE_LABELS = Object.freeze({ customer: '客户账户', risk_operator: '风控人员', operator: '运营人员', advisor: '投顾人员', admin: '管理员', super_admin: '超级管理员', }); function accountActions(context) { const username = escapeHtml(context.username || '已登录用户'); const role = context.roles.map((item) => ROLE_LABELS[item]).find(Boolean) || '已认证账户'; return `
`; } function headerMarkup(links, active, context, mode) { const nav = links.map(([key, label, href]) => `${label}`).join(''); const actions = context ? accountActions(context) : '员工入口登录'; const menuButton = mode === 'customer' ? '' : ''; return ``; } function footerMarkup() { return '
'; } export function mountShell({ active, mode = 'public' }) { // ⚠️ 幂等保护:同一个页面被挂两次 shell,就会看到**两份一模一样的顶部导航与页脚**。 // // 已知的触发方式只有一种:HTML 里引了两条入口