This commit is contained in:
2026-04-30 11:39:57 +08:00
parent 0d0bf8f81e
commit a4afe70d46
17 changed files with 363 additions and 201 deletions

View File

@@ -155,52 +155,67 @@ export function getLayoutPageTitle(): string {
}
/**
* 与 webview vue-router path 对齐,用于全局通知 notificationPage 匹配
* 与 webview vue-router path 对齐,用于全局通知 notificationPage 匹配
* 一个 uni 页面可对应多个 web 路径(如 webview 中 /withdraw 和 /agent/withdraw 是同一页面)。
*/
const UNI_TO_WEB_NOTIFY_PATH: Record<string, string> = {
'pages/index': '/',
'pages/agent': '/agent',
'pages/me': '/me',
'pages/promote': '/agent/promote',
'pages/history-query': '/historyQuery',
'pages/help': '/help',
'pages/help-detail': '/help/detail',
'pages/help-guide': '/help/guide',
'pages/withdraw': '/withdraw',
'pages/report-result-webview': '/app/report',
'pages/report-example-webview': '/app/example',
'pages/privacy-policy': '/privacyPolicy',
'pages/user-agreement': '/userAgreement',
'pages/agent-manage-agreement': '/agentManageAgreement',
'pages/agent-service-agreement': '/agentSerivceAgreement',
'pages/authorization': '/authorization',
'pages/payment-result': '/payment/result',
'pages/inquire': '/inquire',
'pages/login': '/login',
'pages/invitation': '/agent/invitation',
'pages/agent-promote-details': '/agent/promoteDetails',
'pages/agent-rewards-details': '/agent/rewardsDetails',
'pages/agent-vip': '/agent/agentVip',
'pages/agent-vip-apply': '/agent/vipApply',
'pages/agent-vip-config': '/agent/vipConfig',
'pages/withdraw-details': '/agent/withdrawDetails',
'pages/subordinate-list': '/agent/subordinateList',
const UNI_TO_WEB_NOTIFY_PATHS: Record<string, string[]> = {
'pages/index': ['/'],
'pages/agent': ['/agent'],
'pages/me': ['/me'],
'pages/promote': ['/agent/promote'],
'pages/history-query': ['/historyQuery'],
'pages/help': ['/help'],
'pages/help-detail': ['/help/detail'],
'pages/help-guide': ['/help/guide'],
'pages/withdraw': ['/withdraw', '/agent/withdraw'],
'pages/report-result-webview': ['/app/report', '/report'],
'pages/report-example-webview': ['/app/example', '/example'],
'pages/privacy-policy': ['/privacyPolicy'],
'pages/user-agreement': ['/userAgreement'],
'pages/agent-manage-agreement': ['/agentManageAgreement'],
'pages/agent-service-agreement': ['/agentSerivceAgreement'],
'pages/authorization': ['/authorization'],
'pages/payment-result': ['/payment/result'],
'pages/inquire': ['/inquire'],
'pages/login': ['/login'],
'pages/invitation': ['/agent/invitation'],
'pages/agent-promote-details': ['/agent/promoteDetails'],
'pages/agent-rewards-details': ['/agent/rewardsDetails'],
'pages/agent-vip': ['/agent/agentVip'],
'pages/agent-vip-apply': ['/agent/vipApply'],
'pages/agent-vip-config': ['/agent/vipConfig'],
'pages/withdraw-details': ['/agent/withdrawDetails'],
'pages/subordinate-list': ['/agent/subordinateList'],
'pages/cancel-account': ['/cancelAccount'],
'pages/subordinate-detail': ['/agent/subordinateDetail'],
'pages/invitation-agent-apply': ['/agent/invitationAgentApply'],
'pages/report-share': ['/report/share'],
}
export function getWebPathForNotification(): string {
/**
* 获取当前 uni 页面在 web 端可能的所有路径(用于通知匹配)
*/
export function getWebPathsForNotification(): string[] {
const r = getCurrentUniRoute()
const pages = getCurrentPages()
const page = pages[pages.length - 1] as any
const q: Record<string, string> = { ...(page?.options || {}) }
// 动态路由:带参数的路径
if (r === 'pages/inquire' && q.feature)
return `/inquire/${q.feature}`
return [`/inquire/${q.feature}`]
if (r === 'pages/subordinate-detail' && q.id)
return `/agent/subordinateDetail/${q.id}`
return [`/agent/subordinateDetail/${q.id}`]
if (r === 'pages/invitation-agent-apply' && q.linkIdentifier)
return `/agent/invitationAgentApply/${q.linkIdentifier}`
return [`/agent/invitationAgentApply/${q.linkIdentifier}`]
if (r === 'pages/report-share' && q.linkIdentifier)
return `/report/share/${q.linkIdentifier}`
return UNI_TO_WEB_NOTIFY_PATH[r] || '/'
return [`/report/share/${q.linkIdentifier}`]
return UNI_TO_WEB_NOTIFY_PATHS[r] || ['/']
}
export function getWebPathForNotification(): string {
return getWebPathsForNotification()[0] ?? '/'
}
const uniRouteToName: Record<string, string> = {