feat: 做好了扫描兼容处理
This commit is contained in:
@@ -83,11 +83,14 @@ App({
|
||||
},
|
||||
|
||||
// 处理推荐码绑定(支持 query.ref 与扫码 scene;scene 可能为 ref=SOULXXX 或 id=1.1_ref=xxx,后端会把 & 转成 _)
|
||||
// 扫码进入时:options.scene 为场景值(1047),自定义 scene 在 options.query.scene
|
||||
handleReferralCode(options) {
|
||||
const query = options?.query || {}
|
||||
let refCode = query.ref || query.referralCode
|
||||
if (options?.scene) {
|
||||
const scene = (typeof options.scene === 'string' ? decodeURIComponent(options.scene) : '').trim()
|
||||
// 扫码进入时自定义 scene 在 query.scene;options.scene 为场景值(1047)
|
||||
const sceneStr = query?.scene || (typeof options?.scene === 'string' ? options.scene : null)
|
||||
if (sceneStr) {
|
||||
const scene = (typeof sceneStr === 'string' ? decodeURIComponent(sceneStr) : '').trim()
|
||||
// 支持 _ 或 & 作为参数分隔符(后端生成小程序码时会把 & 转为 _)
|
||||
const parts = scene.split(/[&_]/)
|
||||
for (const part of parts) {
|
||||
|
||||
Reference in New Issue
Block a user