This commit is contained in:
xiaozhiyong
2024-04-22 13:17:30 +08:00
parent 7fae7312ea
commit abf4716820
4 changed files with 44 additions and 52 deletions

View File

@@ -61,12 +61,12 @@
}
// 在页面中定义插屏广告
let interstitialAd = null
// 在页面onLoad回调事件中创建插屏广告实例
if (wx.createInterstitialAd) {
interstitialAd = wx.createInterstitialAd({
adUnitId: 'adunit-a7faf57adeed211f'
})
interstitialAd = wx.createInterstitialAd({
adUnitId: 'adunit-a7faf57adeed211f'
})
}
interstitialAd.onLoad((err) => {
// console.log('onLoad event emit', err)
@@ -76,10 +76,6 @@
if (key == '在线') {
uni.switchTab({
url: '/pages/tabbar/home/home',
fail: (err) => {
// console.log(err)
}
// url:'/BagStation/orderDetail/orderDetail'
})
} else {
uni.redirectTo({
@@ -87,30 +83,25 @@
})
}
}, 2000)
// console.log('onError event emit', err)
})
// 在适合的场景显示插屏广告
if (interstitialAd) {
interstitialAd.show().catch((err) => {
// console.error(err)
})
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)
setTimeout(() => {
if (key == '在线') {
uni.switchTab({
url: '/pages/tabbar/home/home',
})
} else {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
}, 1000)
})
},
onReady(option) {
@@ -187,4 +178,4 @@
.page-content image {
width: 750upx;
}
</style>
</style>