Commit 03df497e authored by mengcuiguang's avatar mengcuiguang

广告弹窗添加开关

parent b86bf4b5
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<view class="content"> <view class="content">
<text class="title">恭喜你,获得免费看剧名额</text> <text class="title">恭喜你,获得免费看剧名额</text>
<text class="button" @click="handleClose">看视频免费解锁1集</text> <text class="button" @click="handleClose">看视频免费解锁1集</text>
<text class="downtext">{{countDown+'s后自动进入广告页面解锁后续'}}</text> <text class="downtext">{{countDown}}s后自动进入广告,观看完成解锁第{{vedioIndex+1}}集剧情</text>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
...@@ -28,7 +28,11 @@ ...@@ -28,7 +28,11 @@
show: { show: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
vedioIndex: {
type: [Number, String],
default: 0
}
}, },
data() { data() {
return { return {
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
:originIndex="originIndex" /> :originIndex="originIndex" />
<coin-popup :show="showCoinPop" :point="data.point" :vedioId="data.vedioId" @close="showCoinPop = false" <coin-popup :show="showCoinPop" :point="data.point" :vedioId="data.vedioId" @close="showCoinPop = false"
@clickClose="coinPopupClose" @paySuccess="paySuccess" /> @clickClose="coinPopupClose" @paySuccess="paySuccess" />
<ad-popup :show="showAdPop" @close="adPopupClose" /> <ad-popup :show="showAdPop" @close="adPopupClose" :vedioIndex="originIndex" />
</view> </view>
</template> </template>
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
showTap: false, showTap: false,
showCoinPop: false, showCoinPop: false,
showAdPop: false, showAdPop: false,
showAdForServer: false,
vipBackPage: '', vipBackPage: '',
canUseTTPlayer: true, canUseTTPlayer: true,
}; };
...@@ -168,6 +169,16 @@ ...@@ -168,6 +169,16 @@
}); });
} }
this.post({
url: '/vedio/confs',
showLoading: false,
success: ({
data
}) => {
this.showAdForServer = data.douyinAdTipOpen;
}
});
}, },
// 分享 // 分享
// onShareAppMessage() { // onShareAppMessage() {
...@@ -444,9 +455,6 @@ ...@@ -444,9 +455,6 @@
this.isqp = e.detail.show this.isqp = e.detail.show
}, },
collect(vedioId, index) { collect(vedioId, index) {
this.showAdPop = true
return
this.data.collect = 1 this.data.collect = 1
// 收藏 // 收藏
this.post({ this.post({
...@@ -489,7 +497,7 @@ ...@@ -489,7 +497,7 @@
}) => {} }) => {}
}); });
}, },
preloadAd() { preloadAd() {
let that = this let that = this
// 创建实例 // 创建实例
this.ad = tt.createRewardedVideoAd({ this.ad = tt.createRewardedVideoAd({
...@@ -509,15 +517,15 @@ ...@@ -509,15 +517,15 @@
break; break;
default: default:
// 更多请参考错误码文档 // 更多请参考错误码文档
} }
that.$nextTick(() => { that.$nextTick(() => {
// 延迟渲染,否则位置错乱 // 延迟渲染,否则位置错乱
that.showCoinPop = true that.showCoinPop = true
}) })
}); });
// 监听视频播放完成 // 监听视频播放完成
this.ad.onClose((data) => { this.ad.onClose((data) => {
uni.hideLoading(); uni.hideLoading();
...@@ -529,11 +537,11 @@ ...@@ -529,11 +537,11 @@
} else { } else {
uni.showToast({ uni.showToast({
title: "未观看完整视频" title: "未观看完整视频"
}) })
that.$nextTick(() => { that.$nextTick(() => {
// 延迟渲染,否则位置错乱 // 延迟渲染,否则位置错乱
that.showCoinPop = true that.showCoinPop = true
}) })
} }
}); });
...@@ -546,16 +554,20 @@ ...@@ -546,16 +554,20 @@
this.ad.load(); this.ad.load();
}, },
coinPopupClose() { coinPopupClose() {
this.showAdPop = true if (this.showAdForServer) {
this.showAdPop = true
} else {
this.showCoinPop = false
}
}, },
adPopupClose() { adPopupClose() {
this.showAdPop = false this.showAdPop = false
this.playRewardVideo() this.playRewardVideo()
}, },
playRewardVideo() { playRewardVideo() {
// 播放激励视频 // 播放激励视频
uni.showLoading({ uni.showLoading({
title: '广告加载中' title: '广告加载中'
}); });
this.ad.show(); this.ad.show();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment