修复匹配详情中“用户自填未经核验”等来源说明,清理未参与项的橙色注意提示,修正贷款统计口径文案;补充公积金完整可选路径提取逻辑,确保明确无额外时长要求的公积金分支可正确识别并通过。
33 lines
2.3 KiB
Plaintext
33 lines
2.3 KiB
Plaintext
function validRecordId(value: string): boolean { return /^[1-9][0-9]{0,9}$/.test(value) }
|
|
|
|
export function parseCompareIds(raw: string): string[] {
|
|
if (raw.length == 0) return []
|
|
const ids = raw.split(',')
|
|
if (ids.length > 3) throw new Error('每次最多对比3个产品,请返回重新选择。')
|
|
const seen: string[] = []
|
|
ids.forEach((id: string) => {
|
|
if (!validRecordId(id) || seen.includes(id)) throw new Error('对比产品编号无效或重复,请返回重新选择。')
|
|
seen.push(id)
|
|
})
|
|
return ids
|
|
}
|
|
|
|
export function compareQuery(assessmentId: string, ids: string[], revisionId: string = ''): string {
|
|
return '?assessmentId=' + encodeURIComponent(assessmentId) + '&productIds=' + ids.join(',') + (revisionId.length > 0 ? '&revisionId=' + revisionId : '')
|
|
}
|
|
|
|
// 主包共享的纯路由逻辑,账号分包登录时无需加载融资分包;不接受任意URL。
|
|
export function matchReturnPath(page: string, assessmentId: string, rawIds: string, revisionId: string, productId: string = '', group: string = 'eligible', tab: string = 'explanation', from: string = ''): string {
|
|
if (!['matches','product','compare'].includes(page) || (revisionId.length > 0 && !validRecordId(revisionId))) return ''
|
|
if (assessmentId.length > 0 ? !validRecordId(assessmentId) : page != 'product') return ''
|
|
let ids: string[] = []
|
|
try { ids = parseCompareIds(rawIds) } catch (err) { return '' }
|
|
if (assessmentId.length == 0 && (revisionId.length > 0 || ids.length > 0)) return ''
|
|
if (page == 'matches' && !['all','eligible','ineligible','unknown'].includes(group)) return ''
|
|
if (page == 'product' && (!validRecordId(productId) || !['explanation','details','conditions'].includes(tab) || (assessmentId.length == 0 && tab == 'explanation') || !['','matches','product','compare','report','next-step','archive'].includes(from))) return ''
|
|
const query = assessmentId.length > 0 ? compareQuery(assessmentId, ids, revisionId) : '?'
|
|
if (page == 'matches') return '/packages/finance/matches/matches' + query + '&group=' + group
|
|
if (page == 'compare') return '/packages/finance/compare/compare' + query
|
|
return '/packages/finance/product/product' + query + (assessmentId.length > 0 ? '&' : '') + 'productId=' + productId + '&tab=' + tab + '&from=' + from
|
|
}
|