1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <view class="main">
- <guide v-if="guidePages" :advData="advData"></guide>
- <view class="" v-else></view>
- </view>
- </template>
- <script>
- import guide from '@/components/guide/index.vue'
- import Cache from '@/utils/cache';
- import {
- getOpenAdv
- } from '@/api/api.js'
- export default {
- components: {
- guide
- },
- data() {
- return {
- guidePages: false,
- advData: []
- }
- },
- onShow() {
- // #ifdef H5
- if(this.$wechat.isWeixin()){
- this.$wechat.wechat();
- }
- // #endif
- this.loadExecution()
- },
- methods: {
- loadExecution() {
- const tagDate = uni.getStorageSync('guideDate') || '',
- nowDate = new Date().toLocaleDateString();
- if (tagDate === nowDate) {
- uni.switchTab({
- url: '/pages/index/index'
- });
- return
- }
- console.log(new Date().getTime(),'start')
- getOpenAdv().then(res => {
- if (res.data.status == 0 || res.data.value.length == 0) {
- uni.switchTab({
- url: '/pages/index/index'
- });
- console.log(new Date().getTime(),'indexend')
- } 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
- console.log(new Date().getTime(),'end')
- }
- }).catch(err => {
- uni.switchTab({
- url: '/pages/index/index'
- });
- })
- }
- },
- onHide() {
- this.guidePages = false
- }
- }
- </script>
- <style>
- page,
- .main {
- width: 100%;
- height: 100%;
- }
- </style>
|