| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import {
- apple
- } from '../../config/config'
- const novelPlugin = requirePlugin('novel-plugin')
- let interstitialAd = null
- Component({
- properties: {
- novelManagerId: {
- type: Number,
- value: -1,
- },
- chapterId: {
- type: String,
- value: '',
- }
- },
- data: {
- posterUrl: {
- type: String,
- value: ''
- }
- },
- ready() {
- const novelManager = novelPlugin.getNovelManager(this.properties.novelManagerId)
- this.interstitalLoad()
- setTimeout(() => {
- this.interstitalPlayFn()
- }, 500)
- if (getApp().globalData.isShowDialog) {
- setTimeout(() => {
- getApp().globalData.isShowDialog = false
- novelManager.navigateBack()
- }, 4000)
- }
- },
- methods: {
- // 插屏广告加载
- interstitalLoad() {
- let adId = apple.ads.insertAdId
- interstitialAd = wx.createInterstitialAd({
- adUnitId: adId
- })
- interstitialAd.onLoad(() => {
- console.log('视频页插屏广告onLoad')
- })
- interstitialAd.onError((err) => {
- console.log('视频页插屏广告onError', err)
- })
- interstitialAd.onClose(() => {
- console.log('视频页插屏广告onClose')
- })
- },
- // 插屏广告展示
- interstitalPlayFn() {
- if (interstitialAd) {
- interstitialAd.show().catch((err) => {
- console.error(err)
- })
- }
- },
- },
- })
|