|
|
@@ -81,15 +81,26 @@
|
|
|
}
|
|
|
|
|
|
onLoad((options) => {
|
|
|
+ console.log('[onLoad] options:', JSON.stringify(options))
|
|
|
+ console.log('[onLoad] options.q:', options.q, '| typeof:', typeof options.q)
|
|
|
+ console.log('[onLoad] 条件判断 options && options.q:', !!(options && options.q))
|
|
|
if (options && options.q) {
|
|
|
+ console.log('[onLoad] 进入 if 分支')
|
|
|
const url = decodeURIComponent(options.q)
|
|
|
+ console.log('[onLoad] 解码后 url:', url)
|
|
|
const params = parseUrlParams(url)
|
|
|
+ console.log('[onLoad] 解析参数:', JSON.stringify(params))
|
|
|
const channelId = params.channel
|
|
|
- if (!channelId) return
|
|
|
- // 未登录不做任何操作
|
|
|
+ console.log('[onLoad] channelId:', channelId)
|
|
|
+ if (!channelId) {
|
|
|
+ console.log('[onLoad] channelId 为空,退出')
|
|
|
+ return
|
|
|
+ }
|
|
|
const token = uni.getStorageSync('token')
|
|
|
+ console.log('[onLoad] token:', token ? '有值' : '无值(未登录)')
|
|
|
if (!token) return
|
|
|
proxy.$api.post(`/channel/bind?channelId=${channelId}`, {}).then(({ data: res }) => {
|
|
|
+ console.log('[onLoad] bind 结果:', JSON.stringify(res))
|
|
|
if (res.code !== 0) console.error('渠道绑定失败:', res.msg)
|
|
|
})
|
|
|
}
|