Procházet zdrojové kódy

阅读器bug修复,添加加载,章节列表需要充值直接跳充值页面

gdy96 před 5 roky
rodič
revize
af5e17d1d8
3 změnil soubory, kde provedl 64 přidání a 31 odebrání
  1. 17 3
      src/assets/less/reader.less
  2. 17 12
      src/views/Catalog/index.ux
  3. 30 16
      src/views/Reader/index.ux

+ 17 - 3
src/assets/less/reader.less

@@ -2,14 +2,14 @@
   flex-direction: column;
   background-color: #e6e6e6;
   width: 100%;
-  
+
   .reader-title {
     margin: 0 24px;
     padding: 40px 0;
     // border-bottom: 2px solid #ccc;
     justify-content: space-between;
     align-items: center;
-    
+
     .title {
       font-weight: bolder;
       color: #1a1a1a;
@@ -57,4 +57,18 @@
       text-align: center;
     }
   }
-}
+}
+.toast {
+  position: fixed;
+  top: 180px;
+  width: 100%;
+  justify-content: center;
+  text {
+    background-color: rgba(#1a1a1a, 0.15);
+    padding: 60px 30px;
+    color: #e6e6e6;
+    font-size: 40px;
+    justify-content: center;
+    border-radius: 5px;
+  }
+}

+ 17 - 12
src/views/Catalog/index.ux

@@ -47,19 +47,24 @@ export default {
     }
     this.startpage = page;
     getCatalog({ bid: this.bid, page: page, page_size: PER_PAGE_NUM }).then(r => {
-       this.list = r.list
-      this.meta = r.meta 
-      setTimeout(()=>{
+      this.list = r.list
+      this.meta = r.meta
+      setTimeout(() => {
         this.$element('catalog').scrollTo({ index: chapter_sequence_index })
-      },500)
-      
+      }, 500)
+
     })
-    // this.list = Array(100).fill(null).map((_, k) => k);
-    // setTimeout(() => {
-    //   this.$element('catalog').scrollTo({ index: 20 });
-    // }, 1000);
   },
   jumpReader(info) {
+    if (info.is_need_charge == 1) {
+      router.push({
+        uri: "/views/Pay",
+        params: {
+          bid: info.bid,
+        }
+      })
+      return
+    }
     router.push({
       uri: "/views/Reader",
       params: {
@@ -73,7 +78,7 @@ export default {
       prompt.showToast({ message: '已经到底啦' });
       this.end = true;
       return;
-    };
+    }
     let params = {
       bid: '5pNo6A7wqQmB1WgQygDjkOM9VZn2vXeY',
       page: this.meta.current_page + 1,
@@ -106,11 +111,11 @@ export default {
     getCatalog(params).then(r => {
       if (isLoadPrev) {
         this.list.unshift(...r.list)
-         console.log(this.list)
+        console.log(this.list)
         this.startpage = r.meta.current_page
       } else {
         this.list.push(...r.list)
-         console.log(this.list)
+        console.log(this.list)
         this.meta = r.meta;
       }
     })

+ 30 - 16
src/views/Reader/index.ux

@@ -2,27 +2,33 @@
  <import name="wechat-page" src="../../components/wechat/index.ux"></import> 
 <template>
   <div id="reader-content">
-    <div class="reader-wrap" id='list'>
-      <div class="reader-title">
-        <text class="title">{{bookinfo.chapter_name}}</text>
-        <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
+    <stack>
+      <div class="reader-wrap" id='list'>
+        <div class="reader-title">
+          <text class="title">{{bookinfo.chapter_name}}</text>
+          <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
+        </div>
+        <div class="reader-content">
+          <text class="chapter-text" for='content'>{{$item}}</text>
+        </div>
+        <div class="reader-operator">
+          <text class="operator prev" @click="getPrevChapter">上一章</text>
+          <text class="operator catalog" @click="toCatalog">目录</text>
+          <text class="operator next" @click="getNextChapter">下一章</text>
+        </div>
       </div>
-      <div class="reader-content">
-        <text class="chapter-text" for='content'>{{$item}}</text>
+      <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
+      <!-- <wechat-page></wechat-page> -->
+      <div class='toast' if="{{showtoast}}">
+        <text>正在加载中...</text>
       </div>
-      <div class="reader-operator">
-        <text class="operator prev" @click="getPrevChapter">上一章</text>
-        <text class="operator catalog" @click="toCatalog">目录</text>
-        <text class="operator next" @click="getNextChapter">下一章</text>
-      </div>
-    </div>
-    <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
-    <!-- <wechat-page></wechat-page> -->
+    </stack>
   </div>
 
 </template>
 
 <script>
+import prompt from '@system.prompt';
 import router from "@system.router";
 import storage from '@system.storage';
 import it from "../../helper/interface.js";
@@ -37,7 +43,8 @@ export default {
     bid: '',
     chapter_id: '',
     send_order_id: "",
-    canReadecid: ""
+    canReadecid: "",
+    showtoast: false
   },
   private: {
     bookinfo: {},
@@ -68,12 +75,14 @@ export default {
     this.showShortPop = !value.detail.installed;
   },
   getChapters(bid, chapter_id) {
+    this.showtoast = true
     console.log("router length:", router.getLength());
     getChapters({ bid: bid, chapter_id: chapter_id }).then(r => {
       this.content = r.chapter_content.trim().split(/\n/)
       this.bookinfo = r
       // this.$element('list').scrollTo({ index: 0 })
       this.addShelf();
+      this.showtoast = false
     }).catch(e => {
       console.log('e code')
       console.log(e.data)
@@ -82,10 +91,12 @@ export default {
         chapterOrders({ bid: bid, chapter_id: chapter_id }).then(r => {
           this.content = r.chapter_content.trim().split(/\n/)
           this.bookinfo = r
+          this.showtoast = false
           // this.$element('list').scrollTo({ index: 0 })
         }).catch(f => {
           console.log('f code')
           console.log(f.data)
+          this.showtoast = false
           if (f.data.code == '10014' || f.data.code == '10015') {
             this.getChapters(bid, this.canReadecid)
             router.push({
@@ -99,6 +110,7 @@ export default {
           }
         })
       } else if (e.data.code == '10014' || e.data.code == '10015') {
+        this.showtoast = false
         this.getChapters(bid, this.canReadecid)
         router.push({
           uri: "/views/Pay",
@@ -122,7 +134,9 @@ export default {
   },
   getPrevChapter() {
     console.log("get prev chapter");
-    // this.getChapters(this.bookinfo.bid, this.bookinfo.prev_cid)
+    if (this.bookinfo.prev_cid == 0) {
+      return prompt.showToast({ message: '已经是第一章啦' });
+    }
     router.replace({
       uri: "/views/Reader",
       params: {