You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
manghe/pages/guide/index.vue

124 lines
2.4 KiB

<template>
<view class="main">
<guide v-if="guidePages" :advData="advData" :time="advData.time"></guide>
</view>
</template>
<script>
4 months ago
import {
mapGetters
} from "vuex";
import guide from '@/components/guide/index.vue'
import Cache from '@/utils/cache';
4 months ago
import {
getUserInfo
} from '@/api/user.js';
import {
getOpenAdv
} from '@/api/api.js'
export default {
components: {
guide
},
4 months ago
computed: {
...mapGetters({
isLogin: 'isLogin'
})
},
data() {
return {
guidePages: false,
advData: []
}
},
onShow() {
this.loadExecution()
},
methods: {
loadExecution() {
const tagDate = uni.getStorageSync('guideDate') || '',
nowDate = new Date().toLocaleDateString();
if (tagDate === nowDate) {
4 months ago
if(this.isLogin){
getUserInfo().then(res => {
if(res.data.renzheng&&res.data.renzheng.status==1){
uni.switchTab({
url: '/pages/index/index'
});
}else{
uni.navigateTo({
url:"/pages/users/shiming/index"
})
}
});
}else{
uni.redirectTo({
url:'/pages/users/wechat_login/index'
})
}
return
}
getOpenAdv().then(res => {
if (res.data.status == 0 || res.data.value.length == 0) {
4 months ago
if(this.isLogin){
getUserInfo().then(res1 => {
if(res1.data.renzheng&&res1.data.renzheng.status==1){
uni.switchTab({
url: '/pages/index/index'
});
}else{
uni.navigateTo({
url:"/pages/users/shiming/index"
})
}
});
}else{
uni.redirectTo({
url:'/pages/users/wechat_login/index'
})
}
} else if (res.data.status && (res.data.value.length || res.data.video_link)) {
this.advData = res.data
uni.setStorageSync('guideDate', new Date().toLocaleDateString());
this.guidePages = true
}
}).catch(err => {
4 months ago
if(this.isLogin){
getUserInfo().then(res1 => {
if(res1.data.renzheng&&res1.data.renzheng.status==1){
uni.switchTab({
url: '/pages/index/index'
});
}else{
uni.navigateTo({
url:"/pages/users/shiming/index"
})
}
});
}else{
uni.redirectTo({
url:'/pages/users/wechat_login/index'
})
}
})
4 months ago
},
},
onHide() {
this.guidePages = false
}
}
</script>
<style>
page,
.main {
width: 100%;
height: 100%;
}
</style>