cczg-lottery-activity/pages/coupons/hinge/index.vue

89 lines
1.7 KiB
Vue
Raw Normal View History

2024-05-30 11:04:54 +08:00
<template>
<view class="content">
{{tips}}
</view>
</template>
<script>
import api from '@/api/api.js'
import {authState} from '@/util/auth.js'
import {acstore} from '@/store/activities.js'
export default {
data() {
return {
tips:"跳转活动中,请稍后...",
activityId:undefined
}
},
methods: {
routeguard(userinfo,navfunc){
if(userinfo.flag){
navfunc()
}else{
uni.navigateTo({
url:"/pages/simpleshop/notinwl/notinwl"
})
}
},
getAccountInfo(){
api.getAccountInfo().then((res)=>{
if(res.data.code == 200){
const userinfo = res.data.data
switch(this.activityId){
case 9:
this.routeguard(userinfo,()=>{
uni.switchTab({
url:'/pages/simpleshop/index/index'
})
})
this.tips = "活动入口配置有误"
break
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
uni.navigateTo({
url:'/pages/packet/index/index'
})
break
default:
this.tips = "活动维护中,请稍后再来"
}
}else{
uni.showToast({
title: res.data.message,
icon: "none"
})
}
})
},
},
onShow(){
acstore.dispatch('getactivitId').then((res)=>{
this.activityId = parseInt(res.activitId)
})
if(!authState.isLogin()){
this.tips = "尚未登陆"
uni.navigateBack()
}else{
this.getAccountInfo()
acstore.dispatch('getactivitId').then((res)=>{
this.activityId = parseInt(res.activitId)
})
}
}
}
</script>
<style>
.content{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
</style>