feat: 双端小程序分享路径与测试入口上下文统一

1、修复了结果页、测试页与 test-select 的跳转上下文丢失问题。

2、调整 api/Test 与小程序 app/share 逻辑,补全第三方/企业场景参数透传。

3、优化 DISC/MBTI/PDP/SBTI 结果页样式与按钮交互,一致化微信与抖音端。

Made-with: Cursor
This commit is contained in:
Ghost
2026-04-14 16:40:20 +08:00
parent 5330014a07
commit c946584a7d
42 changed files with 942 additions and 254 deletions

View File

@@ -58,24 +58,23 @@ function getSharePathByScope(personalBasePath) {
}
/**
* 分享「测试结果页」:必须带 id、type、st后端下发的 shareToken否则好友无法打开详情
* 分享「测试结果页」:仅需 id + type好友免登录由 /api/test/share-detail 按 type 校验)
* @param {string} resultPagePath 如 /pages/result/mbti
* @param {{ id: string|number, type: string, shareToken: string }} opts
* @param {{ id: string|number, type: string }} opts
*/
function getResultSharePath(resultPagePath, opts) {
const id = opts && opts.id
const type = opts && opts.type
const shareToken = opts && opts.shareToken
if (!id || !type || !shareToken) {
if (!id || !type) {
return getSharePathByScope('/pages/index/index')
}
// fs=1分享落地结果页用于区分访客隐藏「去完善资料」、展示「我也要测试」
const q =
'id=' +
encodeURIComponent(String(id)) +
'&type=' +
encodeURIComponent(String(type)) +
'&st=' +
encodeURIComponent(String(shareToken))
'&fs=1'
const inv = buildShareQuery()
return inv ? resultPagePath + '?' + q + '&' + inv : resultPagePath + '?' + q
}
@@ -86,8 +85,7 @@ function getResultSharePath(resultPagePath, opts) {
function getResultShareTimelineQuery(opts) {
const id = opts && opts.id
const type = opts && opts.type
const shareToken = opts && opts.shareToken
if (!id || !type || !shareToken) {
if (!id || !type) {
return buildShareQuery()
}
const base =
@@ -95,8 +93,7 @@ function getResultShareTimelineQuery(opts) {
encodeURIComponent(String(id)) +
'&type=' +
encodeURIComponent(String(type)) +
'&st=' +
encodeURIComponent(String(shareToken))
'&fs=1'
const inv = buildShareQuery()
return inv ? base + '&' + inv : base
}