This commit is contained in:
GaoHao
2024-12-24 14:45:59 +08:00

View File

@@ -81,7 +81,7 @@
</view>
<!-- 激励视频广告 -->
<ad-rewarded-video ref="adRewardedVideo" adpid="1531580352" :preload="false" :loadnext="false"
:disabled="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose"
:disabled="true" v-slot:default="{loading, error}" :url-callback="urlCallback" @load="onadload" @close="onadclose"
@error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
@@ -129,6 +129,7 @@
isIos: false,
isLoading: false,
isAndroid: false,
urlCallback: null,
}
},
onShow() {
@@ -148,18 +149,23 @@
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
},
async onReady() {
this.urlCallback = {
userId: uni.getStorageSync('userId'),
extra: uni.getStorageSync('userId')+""+new Date().getTime(),
}
this.isLoading = true;
console.log(1)
// 首次加载广告
// 首次加载广告
setTimeout(() => {
this.$refs.adRewardedVideo.load();
}, 1000)
},
methods: {
showAd() {
console.log(this.isLoading)
if (this.isLoading) {
return
}
@@ -167,7 +173,6 @@
},
onadload(e) {
this.isLoading = false;
console.log(2)
console.log('广告数据加载成功');
},
async onadclose(e) {
@@ -175,15 +180,9 @@
if (detail && detail.isEnded) {
// 正常播放结束
// /sqx_fast/app/ad/state
console.log(this.urlCallback.extra)
let res = await this.$Request.getT('app/ad/state', {
extraKey: 1
})
this.$Request.get('/app/common/type/813').then(res => {
if (res.code == 0 && res.data.value) {
if (res.data.value == '是') {
this.getActivitys()
}
}
extraKey: this.urlCallback.extra
})
this.$Request.getT('/app/common/type/921').then(res => {
if (res.code == 0) {