提交邀请码的时候,还要将微信code传上去

This commit is contained in:
wangxiaowei 2024-06-20 22:56:47 +08:00
parent 315bc313c2
commit a3939675b7

10
App.vue

@ -6,6 +6,9 @@
import { import {
getConfig getConfig
} from '@/api/app' } from '@/api/app'
import {
sendMsg
} from '@/api/shop'
import { import {
strToParams strToParams
} from '@/utils/tools' } from '@/utils/tools'
@ -14,6 +17,7 @@
} from '@/api/user' } from '@/api/user'
import {INVITE_CODE} from '@/config/cachekey' import {INVITE_CODE} from '@/config/cachekey'
import Cache from '@/utils/cache' import Cache from '@/utils/cache'
import { getWxCode } from "@/utils/login";
export default { export default {
onLaunch: function(options) { onLaunch: function(options) {
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
@ -44,19 +48,21 @@
} }
this.wxShare() this.wxShare()
} }
}, },
async bindCode(options) { async bindCode(options) {
if(!options.query) return if(!options.query) return
let invite_code = options.query.invite_code || strToParams(decodeURIComponent(options.query.scene)) let invite_code = options.query.invite_code || strToParams(decodeURIComponent(options.query.scene))
.invite_code .invite_code
if (invite_code) { if (invite_code) {
const wxCode = await getWxCode();
const { const {
data, data,
code code
} = await bindSuperior({ } = await bindSuperior({
code: invite_code code: wxCode,
invite_code
}) })
if (code == -1) { if (code == -1) {
Cache.set(INVITE_CODE, invite_code) Cache.set(INVITE_CODE, invite_code)
} }