新增注册来源功能

This commit is contained in:
wangxiaowei
2026-01-18 00:48:27 +08:00
parent b7e2d5d4c9
commit 1e09782256
9 changed files with 71 additions and 12 deletions

View File

@ -2,9 +2,10 @@
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
import { navigateToInterceptor } from '@/router/interceptor'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import { useUserStore } from '@/store'
import { strToParams } from '@/utils/tools'
onLaunch((options) => {
// console.log("🚀 ~ onLaunch options:", options)
// if (options?.path === 'bundle/order/tea-room/order-detail') {
// uni.setStorageSync('transferOrder', {
// orderId: options?.query?.orderId || '',
@ -33,6 +34,18 @@
shareSource: options?.query?.shareSource || ''
})
}
// 这里是设置用户场景类型的逻辑: 0 普通扫码进入 1 电梯扫码进入 2 充电宝扫码进入
if (options?.query?.scene) {
const scene = decodeURIComponent(options.query.scene)
const params = strToParams(scene)
if (params && params?.registerSource) {
const userStore = useUserStore()
userStore.setUserRegisterSource(Number(params.registerSource))
console.log("🚀 ~ onShow registerSource =", userStore.userRegisterSource)
}
}
console.log('App Show', options)
})
onHide(() => {