g***@163.com
g***@163.com
  • 发布:2024-08-27 01:14
  • 更新:2024-08-27 21:13
  • 阅读:153

【已解决】微信小程序激励广告加载广告位失败

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win7

HBuilderX类型: 正式

HBuilderX版本号: 4.24

第三方开发者工具版本号: 1.05

基础库版本号: 3.4.10

项目创建方式: HBuilderX

示例代码:

<template>
<view>
<ad-rewarded-video ref="adRewardedVideo" adpid="1796261502" :preload="true" :loadnext="false" :disabled="true"
v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
<button type="primary" :disabled="isLoading" :loading="isLoading" @click="showAd">显示广告</button>
</view>
</template>

<script>
export default {
data() {
return {
isLoading: false
}
},
onReady() {
this.isLoading = true;
this.$refs.adRewardedVideo.load();
},
methods: {
showAd() {
if (this.isLoading) {
return
}
this.$refs.adRewardedVideo.show();
},
onadload(e) {
this.isLoading = false;
console.log('广告数据加载成功');
},
onadclose(e) {
const detail = e.detail
// 用户点击了【关闭广告】按钮
if (detail && detail.isEnded) {
// 正常播放结束
console.log("onClose " + detail.isEnded);
} else {
// 播放中途退出
console.log("onClose " + detail.isEnded);
}
//this.isLoading = true;
//this.$refs.adRewardedVideo.load();
},
onaderror(e) {
// 广告加载失败
console.log(e.detail);
this.isLoading = false;
}
}
}
</script>

<style>
.ad-error {
color: orangered;
margin-top: 5px;
}
</style>

操作步骤:

预期结果:

激励广告播放

实际结果:

加载广告位失败

bug描述:

加载广告位失败 插屏广告也有这个问题

2024-08-27 01:14 负责人:无 分享
已邀请:
g***@163.com

g***@163.com (作者)

<template>
<view>
<ad-rewarded-video ref="adRewardedVideo" adpid="1355691347" :preload="true" :loadnext="false" :disabled="true"
v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
<button type="primary" :disabled="isLoading" :loading="isLoading" @click="showAd">显示广告</button>
</view>
</template>

<script>
export default {
data() {
return {
isLoading: false
}
},
onReady() {
this.isLoading = true;
this.$refs.adRewardedVideo.load();
},
methods: {
showAd() {
if (this.isLoading) {
return
}
this.$refs.adRewardedVideo.show();
},
onadload(e) {
this.isLoading = false;
console.log('广告数据加载成功');
},
onadclose(e) {
const detail = e.detail
// 用户点击了【关闭广告】按钮
if (detail && detail.isEnded) {
// 正常播放结束
console.log("onClose " + detail.isEnded);
} else {
// 播放中途退出
console.log("onClose " + detail.isEnded);
}
//this.isLoading = true;
//this.$refs.adRewardedVideo.load();
},
onaderror(e) {
// 广告加载失败
console.log(e.detail);
this.isLoading = false;
}
}
}
</script>

<style>
.ad-error {
color: orangered;
margin-top: 5px;
}
</style>

上面的广告位截图复制错了

DCloud_uni-ad_HDX

DCloud_uni-ad_HDX

提供下详细错误信息

  • g***@163.com (作者)

    没有任何的console打印 就直接弹出的这

    2024-08-27 14:12

g***@163.com

g***@163.com (作者)

已解决 换了微信开发者基础库

要回复问题请先登录注册