" 小程序广告组件驳回:广告组件样式被修改"
完全没有修改啊,代码以下:
//banner广告
showBannerAd() {
if (this.isWx) {
let { screenWidth, screenHeight } = wx.getSystemInfoSync()
let bannerAd = wx.createBannerAd({
adUnitId: 'adunit-40cec2032979949e',
style: {
left: 0,
top: screenHeight,
width: 350//350//
}
})
if (this.bannerAd) {
this.bannerAd.hide()
this.bannerAd.destroy()
}
bannerAd.onLoad(() => {
console.log('banner 广告加载成功')
})
bannerAd.onError(err => {
console.log(err)
})
bannerAd.show().then(() => console.log('banner 广告显示'))
bannerAd.onResize(function () {
bannerAd.style.left = (screenWidth - bannerAd.style.realWidth)/2;
bannerAd.style.top = screenHeight - bannerAd.style.realHeight;
console.log(bannerAd);
})
this.bannerAd = bannerAd
}
},
//video广告
showVideoAd() {
let that = this
console.log("start showVideoAd")
if (that.isWx) {
let rewardedVideoAd = wx.createRewardedVideoAd({
adUnitId: 'adunit-1a38305ad4c99044'
})
rewardedVideoAd.onError(err => {
console.log(err)
wx.showModal({ title: "提示", content: "视频加载失败>_<:" + err.errCode, showCancel: false, cancelText: "", confirmText: "ok" });
})
rewardedVideoAd.onClose(res => {
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if (res && res.isEnded || res === undefined) {
}
else {
//播放中途退出,不下发游戏奖励
}
})
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
.catch(err => console.log(err.errMsg))
} else {
}
},
前来围观