diff --git a/pages/index/startPage/startPage.vue b/pages/index/startPage/startPage.vue index 6a7540f..492726e 100644 --- a/pages/index/startPage/startPage.vue +++ b/pages/index/startPage/startPage.vue @@ -59,21 +59,41 @@ this.getFilterData() } } - setTimeout(() => { - if (key == '在线') { - uni.switchTab({ - url: '/pages/tabbar/home/home', - fail: (err) => { - console.log(err) - } - // url:'/BagStation/orderDetail/orderDetail' - }) - } else { - uni.redirectTo({ - url: '/BagAuth/pages/login/login' - }) - } - }, 2000) + // 在页面中定义插屏广告 + let interstitialAd = null + + // 在页面onLoad回调事件中创建插屏广告实例 + if (wx.createInterstitialAd) { + interstitialAd = wx.createInterstitialAd({ + adUnitId: 'adunit-a7faf57adeed211f' + }) + } + interstitialAd.onError((err) => { + console.log('onError event emit', err) + }) + // 在适合的场景显示插屏广告 + if (interstitialAd) { + interstitialAd.show().catch((err) => { + console.error(err) + }) + } + interstitialAd.onClose(res => { + setTimeout(() => { + if (key == '在线') { + uni.switchTab({ + url: '/pages/tabbar/home/home', + fail: (err) => { + console.log(err) + } + // url:'/BagStation/orderDetail/orderDetail' + }) + } else { + uni.redirectTo({ + url: '/BagAuth/pages/login/login' + }) + } + }, 2000) + }) }, onReady(option) { const updateManager = uni.getUpdateManager(); diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index 6bc660c..8fa1dd6 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -137,6 +137,9 @@ + + + @@ -310,6 +313,7 @@ onLoad() { this.reverseGeocoder(this.location) this.refreshLocation() + // if (!uni.getStorageSync('filterData')) { // this.getFilterData() // }