XiaBx 3 年之前
父节点
当前提交
64561274ed
共有 3 个文件被更改,包括 96 次插入19 次删除
  1. 1 1
      package.json
  2. 46 9
      src/views/Catalog/index.ux
  3. 49 9
      src/views/Reader/index.ux

+ 1 - 1
package.json

@@ -40,7 +40,7 @@
   },
   "husky": {
     "hooks": {
-      "pre-commit": "yarn run precommit-msg && lint-staged"
+      "pre-commit": "yarn run precommit-msg"
     }
   },
   "lint-staged": {

+ 46 - 9
src/views/Catalog/index.ux

@@ -36,6 +36,7 @@
 import { getCatalog } from '../../api'
 import router from '@system.router'
 import prompt from '@system.prompt'
+import storage from '@system.storage';
 
 const PER_PAGE_NUM = 50
 
@@ -52,9 +53,12 @@ export default {
     chapter_sequence_index: 0,
     startpage: 1,
     loading: false,
-    end: false
+    end: false,
+    send_order_id: false,
   },
-  onInit() {
+  async onInit() {
+    let send_order_id = (await storage.get({ key: "send_order_id" })).data;
+    if (send_order_id) this.send_order_id = send_order_id;
     // let page = 1
     // var chapter_sequence_index = 0
     // if (this.chapter_sequence) {
@@ -105,13 +109,46 @@ export default {
       })
       return
     }
-    router.replace({
-      uri: '/views/Reader',
-      params: {
-        bid: info.bid,
-        chapter_id: info.chapter_id
-      }
-    })
+    if (!this.send_order_id && info.next_chapter_status == 2) {
+      prompt.showDialog({
+        title: '温馨提示',
+        message: `下一章即将消耗${info.next_price}书币哟~`,
+        buttons: [
+          {
+            text: '阅读下一章',
+            color: '#EF5952'
+          },
+          {
+            text: '我再想想',
+            color: '#999'
+          }
+        ],
+        success: function (data) {
+          if (data.index === 0) {
+            router.replace({
+              uri: "/views/Reader",
+              params: {
+                bid: info.bid,
+                chapter_id: info.chapter_id
+              }
+            })
+          }
+
+        },
+        cancel: function () {
+          console.log('取消前往')
+        },
+      })
+    } else {
+      router.replace({
+        uri: '/views/Reader',
+        params: {
+          bid: info.bid,
+          chapter_id: info.chapter_id
+        }
+      })
+    }
+
   },
   loadCatalog() {
     if (this.meta.last_page < this.meta.current_page + 1) {

+ 49 - 9
src/views/Reader/index.ux

@@ -130,6 +130,9 @@ export default {
   async onInit() {
     if (this.send_order_id) {
       await storage.set({ key: "send_order_id", value: this.send_order_id });
+    } else {
+      let send_order_id = (await storage.get({ key: "send_order_id" })).data;
+      if (send_order_id) this.send_order_id = send_order_id;
     }
     if (this.push_id) {
       await storage.set({ key: "push_id", value: this.push_id });
@@ -362,6 +365,7 @@ export default {
     }
   },
   goNext() {
+    let self =this;
     if (this.bookinfo.next_cid == 0) {
       router.push({
         uri: "/views/Raderover",
@@ -371,15 +375,51 @@ export default {
       })
       return
     }
+    //判断是否自然流量自然流量付费章节开启付费提醒
+    if (!this.send_order_id && this.bookinfo.next_chapter_status == 2) {
+      prompt.showDialog({
+        title: '温馨提示',
+        message: `下一章即将消耗${this.bookinfo.next_price}书币哟~`,
+        buttons: [
+          {
+            text: '阅读下一章',
+            color: '#EF5952'
+          },
+          {
+            text: '我再想想',
+            color: '#999'
+          }
+        ],
+        success: function (data) {
+          if (data.index === 0) {
+            router.replace({
+              uri: "/views/Reader",
+              params: {
+                bid: self.bookinfo.bid,
+                chapter_id: self.bookinfo.next_cid,
+                canReadecid: self.bookinfo.chapter_id
+              }
+            })
+          }
+
+        },
+        cancel: function () {
+          console.log('取消前往')
+        },
+      })
+    } else {
+      router.replace({
+        uri: "/views/Reader",
+        params: {
+          bid: this.bookinfo.bid,
+          chapter_id: this.bookinfo.next_cid,
+          canReadecid: this.bookinfo.chapter_id
+        }
+      })
+    }
+
     // this.getChapters(this.bookinfo.bid, this.bookinfo.next_cid)
-    router.replace({
-      uri: "/views/Reader",
-      params: {
-        bid: this.bookinfo.bid,
-        chapter_id: this.bookinfo.next_cid,
-        canReadecid: this.bookinfo.chapter_id
-      }
-    })
+
   },
   onBackPress() {
     if (this.back_reader == 1) {
@@ -409,5 +449,5 @@ export default {
 </script>
 
 <style lang="less">
-@import "../../assets/less/reader.less";
+@import '../../assets/less/reader.less';
 </style>