feat: 做好了扫描兼容处理

This commit is contained in:
乘风
2026-02-12 15:17:39 +08:00
parent df359f0a35
commit 046e686cda
3 changed files with 34 additions and 5 deletions

View File

@@ -83,11 +83,14 @@ App({
},
// 处理推荐码绑定(支持 query.ref 与扫码 scenescene 可能为 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.sceneoptions.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) {