首页分享提交code
This commit is contained in:
parent
90db7a6e21
commit
f765c1dbbd
6
App.vue
6
App.vue
@ -49,17 +49,17 @@
|
|||||||
this.wxShare()
|
this.wxShare()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async bindCode(options) {
|
async bindCode(options, code) {
|
||||||
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();
|
uni.setStorageSync('invite_code', invite_code)
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
code
|
code
|
||||||
} = await bindSuperior({
|
} = await bindSuperior({
|
||||||
code: wxCode,
|
code: code || await getWxCode(),
|
||||||
invite_code
|
invite_code
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@
|
|||||||
分类
|
分类
|
||||||
</view>
|
</view>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -67,6 +68,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<!-- <lyg-popup v-if="appConfig.app_agreement" title="服务协议和隐私政策"
|
<!-- <lyg-popup v-if="appConfig.app_agreement" title="服务协议和隐私政策"
|
||||||
@ -96,6 +98,12 @@
|
|||||||
import {
|
import {
|
||||||
getRect
|
getRect
|
||||||
} from '@/utils/tools'
|
} from '@/utils/tools'
|
||||||
|
import {
|
||||||
|
bindSuperior
|
||||||
|
} from '@/api/user'
|
||||||
|
import Cache from '@/utils/cache'
|
||||||
|
import { getWxCode } from "@/utils/login"
|
||||||
|
import {INVITE_CODE} from '@/config/cachekey'
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
const homeItem = {
|
const homeItem = {
|
||||||
name: '首页'
|
name: '首页'
|
||||||
@ -125,6 +133,8 @@
|
|||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
this.getLiveListsFun()
|
this.getLiveListsFun()
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
this.bindCode()
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
uni.$off('refreshhome')
|
uni.$off('refreshhome')
|
||||||
@ -146,6 +156,24 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getCartNum']),
|
...mapActions(['getCartNum']),
|
||||||
|
|
||||||
|
async bindCode() {
|
||||||
|
let _that = this;
|
||||||
|
uni.login({
|
||||||
|
success(res) {
|
||||||
|
if (res.code && uni.getStorageSync('invite_code')) {
|
||||||
|
getHome({
|
||||||
|
code: res.code,
|
||||||
|
invite_code: uni.getStorageSync('invite_code')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
offPromptFunc() {
|
offPromptFunc() {
|
||||||
let time = 8;
|
let time = 8;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user