From cdfdcec9cc8a7644e70fb28d39a01d438cc74496 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期一, 25 三月 2024 09:26:30 +0800
Subject: [PATCH] 详情,阅读器

---
 packageBookService/pages/bookServices/detail/index.js |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 500be20..09c6555 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -67,6 +67,12 @@
     paperBookCount: 0, //绾歌川涔﹀墿浣欐鏁�
     ebookCount: 0, //鐢靛瓙涔﹀墿浣欐鏁�
     userInfo: {},
+    fileInfo: {
+      bookName: "",
+      fileType: "",
+      md5: "",
+      freePage: ""
+    }//闃呰鍣ㄦ暟鎹�
   },
 
 
@@ -157,7 +163,7 @@
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
   onReachBottom() {
-    if (this.data.tabValue == 'jesk_note') {
+    if (this.data.tabValue == 'jsek_note') {
       const child = this.selectComponent('#note')
       child.onReachBottom()
     }
@@ -352,13 +358,44 @@
           this.setData({
             noFile: true
           });
+          if (res.datas[0].bookshelf_pdf) {
+            this.setData({
+              "fileInfo.bookName": this.data.bookDetail.name,
+              "fileInfo.fileType": 'pdf',
+              "fileInfo.md5": res.datas[0].bookshelf_pdf,
+              "fileInfo.freePage": res.datas[0].bookshelf_probationPage,
+            });
+          } else if (res.datas[0].bookshelf_protectedEpub) {
+            this.setData({
+              "fileInfo.bookName": this.data.bookDetail.name,
+              "fileInfo.fileType": 'epub',
+              "fileInfo.md5": res.datas[0].bookshelf_protectedEpub,
+              "fileInfo.freePage": res.datas[0].bookshelf_freeEpub,
+            });
+          }
         }
       } else {
         if (this.data.bookDetail.pdf || this.data.bookDetail.protectedEpub) {
           this.setData({
             noFile: true
           });
+          if (this.data.bookDetail.pdf) {
+            this.setData({
+              "fileInfo.bookName": this.data.bookDetail.name,
+              "fileInfo.fileType": 'pdf',
+              "fileInfo.md5": this.data.bookDetail.pdf,
+              "fileInfo.freePage": this.data.bookDetail.probationPage,
+            });
+          } else if (this.data.bookDetail.protectedEpub) {
+            this.setData({
+              "fileInfo.bookName": this.data.bookDetail.name,
+              "fileInfo.fileType": 'epub',
+              "fileInfo.md5": this.data.bookDetail.protectedEpub,
+              "fileInfo.freePage": this.data.bookDetail.freeEpubPage,
+            });
+          }
         }
+        console.log(this.data.fileInfo, 456)
         this.setData({
           selectedIds: this.data.bookDetail.defaultSaleMethodId,
           bookBuy: this.data.bookDetail.purchasedSaleMethodIdList.indexOf(this.data.bookDetail.defaultSaleMethodId) > -1
@@ -470,6 +507,12 @@
       if (token) {
         child.changeLoading()
         child.getNoteList()
+      }
+
+    } else if (e.detail.label == '鐢靛瓙涔�') {
+      const child = this.selectComponent('#eBook')
+      if (child) {
+        child.getProgress()
       }
 
     }
@@ -1342,6 +1385,21 @@
     }
   },
 
+  goRead() {
+    if (!this.data.noFile) {
+      wx.showToast({
+        title: '鏆傛棤闃呰鏂囦欢',
+        icon: 'none',
+        duration: 2000
+      })
+      return false;
+    }
+    wx.navigateTo({
+      url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage
+    })
+
+  },
+
   //鏍蜂功鐢宠
   //鐢宠鐢靛瓙鏍蜂功
   appplyElectronicBook() {

--
Gitblit v1.9.1