任务列表广告加载优化

This commit is contained in:
GaoHao
2024-12-27 16:09:15 +08:00
parent 36d8f2fd39
commit da80801e8c

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,
@@ -138,7 +139,11 @@
this.isShowMoneyPay = !(res.data.value == '1' && isIos) this.isShowMoneyPay = !(res.data.value == '1' && isIos)
} }
}); });
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