feat: enhance link tag functionality with phone parameter support
- Updated link tag structure to include `passPhone` and `phoneParamName` attributes for better integration with user phone data. - Adjusted related components and database schema to accommodate new attributes. - Improved documentation and user interface to reflect changes in phone parameter handling during mini program navigation.
This commit is contained in:
@@ -11,8 +11,8 @@ const DEFAULT_APP_ID = 'wxb8bbb2b10dec74aa'
|
||||
const DEFAULT_MCH_ID = '1318592501'
|
||||
const DEFAULT_WITHDRAW_TMPL_ID = 'u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE'
|
||||
// 线上正式域名(真机/体验版/正式版强制使用此地址)
|
||||
// const API_BASE_URL_PROD = 'https://soulapi.quwanzhi.com'
|
||||
const API_BASE_URL_PROD = 'https://souldev.quwanzhi.com'
|
||||
const API_BASE_URL_PROD = 'https://soulapi.quwanzhi.com'
|
||||
// const API_BASE_URL_PROD = 'https://souldev.quwanzhi.com'
|
||||
|
||||
// 本地开发地址(仅开发者工具模拟器生效;真机自动回退 PROD)
|
||||
// const API_BASE_URL_DEV = 'http://127.0.0.1:9090'
|
||||
|
||||
@@ -928,6 +928,8 @@ Page({
|
||||
let tagType = (e.currentTarget.dataset.tagType || '').trim().toLowerCase()
|
||||
let pagePath = (e.currentTarget.dataset.pagePath || '').trim()
|
||||
let mpKey = (e.currentTarget.dataset.mpKey || '').trim()
|
||||
const hasDatasetPassPhone = !(e.currentTarget.dataset.passPhone == null || e.currentTarget.dataset.passPhone === '')
|
||||
let explicitPassPhoneConfigured = hasDatasetPassPhone
|
||||
let passPhone = parseDatasetBool(e.currentTarget.dataset.passPhone)
|
||||
let phoneParamName = normalizeQueryKey(e.currentTarget.dataset.phoneParamName, 'phone')
|
||||
|
||||
@@ -940,11 +942,19 @@ Page({
|
||||
if (!url) url = pickLinkTagField(cached, ['url', 'linkUrl', 'link_url'], '')
|
||||
if (!mpKey) mpKey = pickLinkTagField(cached, ['mpKey', 'mp_key', 'appId', 'app_id'], '')
|
||||
// 透传配置优先取点击节点;节点缺失时回落后台配置
|
||||
const cachedPassPhone = parseDatasetBool(cached.passPhone)
|
||||
if (!passPhone) passPhone = cachedPassPhone
|
||||
const hasCachedPassPhone = !(cached.passPhone == null || cached.passPhone === '')
|
||||
if (hasCachedPassPhone) {
|
||||
explicitPassPhoneConfigured = true
|
||||
const cachedPassPhone = parseDatasetBool(cached.passPhone)
|
||||
if (!hasDatasetPassPhone) passPhone = cachedPassPhone
|
||||
}
|
||||
phoneParamName = normalizeQueryKey(cached.phoneParamName, phoneParamName)
|
||||
}
|
||||
}
|
||||
// 兼容旧配置:历史 miniprogram 标签未配置透传字段时,默认开启手机号透传
|
||||
if (tagType === 'miniprogram' && !explicitPassPhoneConfigured) {
|
||||
passPhone = true
|
||||
}
|
||||
|
||||
// CKB 类型:复用 @mention 加好友流程,弹出留资表单
|
||||
if (tagType === 'ckb') {
|
||||
@@ -987,24 +997,13 @@ Page({
|
||||
if (passPhone && phone) {
|
||||
targetPath = appendQueryToPath(targetPath, phoneParamName, phone)
|
||||
}
|
||||
const finalPath = targetPath || ''
|
||||
const fullTarget = `appId=${linked.appId}${finalPath ? `\npath=${finalPath}` : '\npath=(空)'}`
|
||||
wx.showModal({
|
||||
title: '即将跳转小程序',
|
||||
content: fullTarget,
|
||||
confirmText: '继续跳转',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return
|
||||
wx.navigateToMiniProgram({
|
||||
appId: linked.appId,
|
||||
path: finalPath,
|
||||
envVersion: 'release',
|
||||
success: () => {},
|
||||
fail: (err) => {
|
||||
wx.showToast({ title: err.errMsg || '跳转失败', icon: 'none' })
|
||||
},
|
||||
})
|
||||
wx.navigateToMiniProgram({
|
||||
appId: linked.appId,
|
||||
path: targetPath || '',
|
||||
envVersion: 'release',
|
||||
success: () => {},
|
||||
fail: (err) => {
|
||||
wx.showToast({ title: err.errMsg || '跳转失败', icon: 'none' })
|
||||
},
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user