54 lines
1.1 KiB
Vue
54 lines
1.1 KiB
Vue
<template>
|
||
<view class="content">
|
||
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { setInviteId ,removeInviteId} from "@/utils/auth";
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
|
||
}
|
||
},
|
||
onLoad(query) {
|
||
const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
|
||
let theRequest = this.getUrlValue(q)
|
||
if(theRequest.hasOwnProperty("inviteId")){
|
||
//扫码邀请过来的,设置邀请者code
|
||
setInviteId(theRequest['inviteId'])
|
||
//先登录
|
||
uni.reLaunch({
|
||
url: '/pages/login/login'
|
||
})
|
||
}else{
|
||
removeInviteId()
|
||
uni.reLaunch({
|
||
url: '/pages-home/home/home'
|
||
})
|
||
}
|
||
},
|
||
methods: {
|
||
//解析参数
|
||
getUrlValue(url) {
|
||
var theRequest = new Object();
|
||
if (url.indexOf("?") != -1) {
|
||
//有参数
|
||
var str = url.split("?")[1];
|
||
var strs = str.split("&");
|
||
for (var i = 0; i < strs.length; i++) {
|
||
theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
|
||
}
|
||
}
|
||
return theRequest
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
|
||
</style>
|