123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <view class="main">
- <guide v-if="guidePages" :advData="advData"></guide>
- </view>
- </template>
- <script>
-
-
-
-
-
-
-
-
-
- import guide from '@/components/guide/index.vue'
- import Cache from '@/utils/cache';
- import { setStorage } from '@/libs/uniApi.js';
- import {
- getOpenAdv
- } from '@/api/api.js'
- export default {
- components: {
- guide
- },
- data() {
- return {
- guidePages: false,
- frequency: '',
- advData: []
- }
- },
- onLoad(options) {
- if(options.spid)setStorage('spid', options.spid);
- },
- onShow() {
-
- if(this.$wechat.isWeixin()){
- this.$wechat.wechat();
- }
-
- this.loadExecution()
- },
- methods: {
- loadExecution() {
- getOpenAdv().then(res => {
- this.frequency = res.data.config.open_screen_space
- const tagDate = uni.getStorageSync('guideDate') || '',
- nowDate = new Date();
- if(tagDate >= nowDate && res.data.config.open_screen_space!=0){
- uni.switchTab({
- url: '/pages/index/index'
- });
- return
- }else{
- if (res.data.config.open_screen_switch == "" || res.data.list.length == 0) {
- uni.switchTab({
- url: '/pages/index/index'
- });
- } else if (res.data.config.open_screen_switch && res.data.list.length) {
- this.advData = res.data
- let curTime = new Date(), addHour = curTime.setHours(curTime.getHours()+res.data.config.open_screen_space);
- uni.setStorageSync('guideDate', new Date(addHour))
- this.guidePages = true
- }
- }
- }).catch(err => {
- uni.switchTab({
- url: '/pages/index/index'
- });
- })
- }
- },
- onHide() {
- this.guidePages = false
- }
- }
- </script>
- <style>
- page,
- .main {
- width: 100%;
- height: 100%;
- }
- </style>
|