广告加载失败触发提醒

This commit is contained in:
GaoHao
2025-01-15 17:50:53 +08:00
parent d255512ade
commit a0f899c3cd
2 changed files with 19 additions and 8 deletions

View File

@@ -62,7 +62,7 @@
<!-- 激励视频广告 -->
<view style="width: 0;height: 0;overflow: hidden;">
<!-- 激励视频广告 -->
<ad-rewarded-video v-if="datas.adRewardedShow" ref="adRewarded" :adpid="datas.adpid" :loadnext="true"
<ad-rewarded-video ref="adRewarded" :adpid="datas.adpid" :loadnext="true"
:url-callback="datas.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
</ad-rewarded-video>
</view>
@@ -104,7 +104,7 @@
list: [],
urlCallback: {},
adpid: null,
adRewardedShow: true,
adRewardedShow: false,
adRewardedVideoloadNum: 0,
})
@@ -247,7 +247,6 @@
*/
function onaderror(e) {
if (datas.adRewardedVideoloadNum >= 3) {
datas.adRewardedShow = false;
return
}
datas.adRewardedVideoloadNum++
@@ -316,6 +315,13 @@
}
} else if (item.buttonTitle.indexOf("观看视频") != -1) {
// 首次加载广告
if(!datas.adRewardedShow){
uni.showToast({
icon: 'none',
title: '广告加载失败,请稍后重试'
});
return
}
datas.urlCallback = {
userId: uni.getStorageSync('userId'),
extra: uni.getStorageSync('userId') + "" + new Date().getTime(),