lanan-repair/pages/index/index.vue

54 lines
1.1 KiB
Vue
Raw Permalink Normal View History

2024-09-22 15:07:01 +08:00
<template>
<view class="content">
2024-09-23 09:48:02 +08:00
2024-09-22 15:07:01 +08:00
</view>
</template>
<script>
2024-10-15 18:47:56 +08:00
import { setInviteId ,removeInviteId} from "@/utils/auth";
2024-09-23 09:48:02 +08:00
2024-09-28 00:43:23 +08:00
export default {
2024-09-22 15:07:01 +08:00
data() {
return {
2024-09-23 09:48:02 +08:00
2024-09-22 15:07:01 +08:00
}
},
2024-10-15 18:47:56 +08:00
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'
})
}
2024-09-22 15:07:01 +08:00
},
methods: {
2024-10-15 18:47:56 +08:00
//解析参数
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
},
}
2024-09-22 15:07:01 +08:00
}
</script>
<style>
2024-10-15 18:47:56 +08:00
</style>