任务列表广告加载优化

This commit is contained in:
GaoHao 2024-12-27 16:09:15 +08:00
parent 36d8f2fd39
commit da80801e8c
1 changed files with 15 additions and 9 deletions

View File

@ -118,6 +118,7 @@
isIos: false, isIos: false,
isAndroid: false, isAndroid: false,
adRewardedVideo: true, adRewardedVideo: true,
adRewardedVideoloadNum: 0,
urlCallback: null, urlCallback: null,
isTooltipVisible: false, isTooltipVisible: false,
tooltipTimeout: null, tooltipTimeout: null,
@ -139,6 +140,10 @@
} }
}); });
this.$nextTick(()=>{
this.adRewardedVideoloadNum = 0
this.$refs.adRewardedVideo.load();
})
}, },
@ -167,9 +172,15 @@
* 广告加载失败回调 * 广告加载失败回调
* @param {Object} e * @param {Object} e
*/ */
onaderror(e) { // 广 onaderror(e) {
this.$refs.adRewardedVideo.load(); if ( this.adRewardedVideoloadNum >=3 ) {
// this.adRewardedVideo = false; this.adRewardedVideo = false;
return
}
this.adRewardedVideoloadNum++
setTimeout(() => {
this.$refs.adRewardedVideo.load();
}, 1000); // 10
console.log("广告加载失败") console.log("广告加载失败")
}, },
@ -247,10 +258,6 @@
// jumpType (integer, optional): 1 2 , // jumpType (integer, optional): 1 2 ,
// type (integer, optional): 1 2 9 , // type (integer, optional): 1 2 9 ,
// buttonUrl // buttonUrl
uni.showToast({
title: this.adRewardedVideo,
icon: 'none'
})
if (item.jumpType == 0) { if (item.jumpType == 0) {
if (item.buttonTitle.indexOf("领取") != -1) { if (item.buttonTitle.indexOf("领取") != -1) {
this.taskReceive(item.id) this.taskReceive(item.id)
@ -333,7 +340,6 @@
this.list.map(item=>{ this.list.map(item=>{
item.show = true item.show = true
}) })
console.log(this.adRewardedVideo)
this.list.map(item=>{ this.list.map(item=>{
if(item.title.indexOf("观看视频") != -1&&!this.adRewardedVideo) { if(item.title.indexOf("观看视频") != -1&&!this.adRewardedVideo) {
item.show = false item.show = false