Selaa lähdekoodia

feat 广告解锁提示

erekook 1 vuosi sitten
vanhempi
commit
b686c22f8f
1 muutettua tiedostoa jossa 14 lisäystä ja 2 poistoa
  1. 14 2
      components/charge-dialog/charge-dialog.js

+ 14 - 2
components/charge-dialog/charge-dialog.js

@@ -70,7 +70,7 @@ Component({
         this.videoAd.onError((err) => {
           console.log('激励失败', err)
         })
-        
+
         this.videoAd.onClose((res) => {
           const novelManager = novelPlugin.getNovelManager(this.properties.novelManagerId)
           if (res && res.isEnded) {
@@ -85,12 +85,20 @@ Component({
             unlockChapter(params).then(res => {
               console.log(res)
               novelManager.paymentCompleted()
-              console.log('章节解锁成功',this.properties.chapterIndex)
+              console.log('章节解锁成功', this.properties.chapterIndex)
+              wx.showToast({
+                title: '解锁成功',
+                icon: 'none'
+              })
             })
             this.videoAd.offClose()
           } else {
             novelManager.closeChargeDialog()
             console.log('关闭解锁组件')
+            wx.showToast({
+              title: '解锁失败',
+              icon: 'none'
+            })
           }
         })
       }
@@ -105,6 +113,10 @@ Component({
         console.log('激励视频播放成功')
       }).catch((err) => {
         console.log('激励视频播放失败', err)
+        wx.showToast({
+          title: '广告拉起失败,请重试',
+          icon: 'none'
+        })
       }).then(() => {
         wx.hideLoading()
       })