提交邀请码的时候,还要将微信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 {
getConfig
} from '@/api/app'
import {
sendMsg
} from '@/api/shop'
import {
strToParams
} from '@/utils/tools'
@ -14,6 +17,7 @@
} from '@/api/user'
import {INVITE_CODE} from '@/config/cachekey'
import Cache from '@/utils/cache'
import { getWxCode } from "@/utils/login";
export default {
onLaunch: function(options) {
//#ifdef MP-WEIXIN
@ -44,19 +48,21 @@
}
this.wxShare()
}
},
async bindCode(options) {
if(!options.query) return
let invite_code = options.query.invite_code || strToParams(decodeURIComponent(options.query.scene))
.invite_code
if (invite_code) {
const wxCode = await getWxCode();
const {
data,
code
} = await bindSuperior({
code: invite_code
code: wxCode,
invite_code
})
if (code == -1) {
Cache.set(INVITE_CODE, invite_code)
}