|
|
@@ -67,6 +67,33 @@
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
import { useUserStore } from '@/common/stores/user';
|
|
|
const userStore = useUserStore();
|
|
|
+ import { onLoad } from '@dcloudio/uni-app'
|
|
|
+
|
|
|
+ const parseUrlParams = (url) => {
|
|
|
+ const result = {}
|
|
|
+ const queryStr = url.indexOf('?') !== -1 ? url.split('?')[1] : (url.indexOf('#') !== -1 ? url.split('#')[1] : '')
|
|
|
+ if (!queryStr) return result
|
|
|
+ queryStr.split('&').forEach(pair => {
|
|
|
+ const [key, val] = pair.split('=')
|
|
|
+ if (key) result[decodeURIComponent(key)] = decodeURIComponent(val || '')
|
|
|
+ })
|
|
|
+ return result
|
|
|
+ }
|
|
|
+
|
|
|
+ onLoad((options) => {
|
|
|
+ if (options && options.q) {
|
|
|
+ const url = decodeURIComponent(options.q)
|
|
|
+ const params = parseUrlParams(url)
|
|
|
+ const channelId = params.channel
|
|
|
+ if (!channelId) return
|
|
|
+ // 未登录不做任何操作
|
|
|
+ const token = uni.getStorageSync('token')
|
|
|
+ if (!token) return
|
|
|
+ proxy.$api.post(`/channel/bind?channelId=${channelId}`, {}).then(({ data: res }) => {
|
|
|
+ if (res.code !== 0) console.error('渠道绑定失败:', res.msg)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
const bannarList = ref([])
|
|
|
const bannarOrigin = ref([])
|