feat: 双端小程序分享路径与测试入口上下文统一
1、修复了结果页、测试页与 test-select 的跳转上下文丢失问题。 2、调整 api/Test 与小程序 app/share 逻辑,补全第三方/企业场景参数透传。 3、优化 DISC/MBTI/PDP/SBTI 结果页样式与按钮交互,一致化微信与抖音端。 Made-with: Cursor
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user