lanan-repair/pages/index/index.vue
2024-10-15 18:47:56 +08:00

54 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>