From 4bc1c36faeec2f90e5acfa836732e49fe0b245e9 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期五, 12 四月 2024 20:47:03 +0800
Subject: [PATCH] 云学习11

---
 packageDomain/pages/sampleBookList/index.js |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/packageDomain/pages/sampleBookList/index.js b/packageDomain/pages/sampleBookList/index.js
index 8ee6d3b..73a2f74 100644
--- a/packageDomain/pages/sampleBookList/index.js
+++ b/packageDomain/pages/sampleBookList/index.js
@@ -348,6 +348,9 @@
   // 鑾峰彇鍥句功鍒楄〃
   getBookList(isReachBottom) {
     let that = this;
+    this.setData({
+      skeletonLoding: true
+    })
     let sort;
     let pathObj = {};
     if (that.data.pathList.length) {
@@ -422,6 +425,8 @@
         author: [],
         isbn: [],
         publicationDate: [],
+        pdf: [],
+        protectedEpub: [],
         isApplyBook: [],
         'isApplyBook>': ['1'],
         ...searchObj,
@@ -493,14 +498,10 @@
             bottomLoading: false,
             isMoreData: list.length > 0 ? false : true,
             skeletonLoding: false,
-            loading: false
           })
         } else {
           that.setData({
-            bookList: [],
-            pageTotalCount: 0,
             skeletonLoding: false,
-            loading: false
           })
         }
       } catch (error) {
@@ -532,6 +533,7 @@
       secondCode: '',
       path: path,
       'stairList.value': e.detail.value,
+      'secondList.value': ""
     });
     this.getBookList(false);
     this.getSecondList(path);
@@ -783,7 +785,7 @@
   },
 
   //閫夋嫨鐢靛瓙鏍蜂功
-  onChangeElectron(e) {
+  async onChangeElectron(e) {
     const item = e.currentTarget.dataset.book;
     const index = this.data.bookList.findIndex(citem => citem.id == item.id)
     let role = this.data.userInfo != null ? this.data.userInfo.role : null
@@ -791,6 +793,44 @@
       // 鏄暀甯�
       if (e.detail.checked) {
         // 鐐瑰嚮閫変腑
+        //鍟嗗搧鏈夋棤鐢靛瓙涔� 
+        const obj = {
+          path: '*',
+          queryType: 'SubProduct',
+          sort: {
+            type: 'Desc',
+            field: 'CreateDate'
+          },
+          paging: {
+            start: 0,
+            size: 1
+          },
+          mainProductId: item.id,
+          fields: {
+            bookshelf_pdf: [],
+            bookshelf_protectedEpub: [],
+          }
+        }
+        const res = await app.MG.store.getProductList(obj)
+        if (res.datas.length > 0) {
+          if (!res.datas[0].bookshelf_pdf && !res.datas[0].bookshelf_protectedEpub) {
+            wx.showToast({
+              title: "鏆傛棤鐢靛瓙涔︽枃浠�,璇疯仈绯荤鐞嗗憳!",
+              icon: 'none',
+              duration: 1000,
+            })
+            return false;
+          }
+        } else {
+          if (!item.pdf && !item.protectedEpub) {
+            wx.showToast({
+              title: "鏆傛棤鐢靛瓙涔︽枃浠�,璇疯仈绯荤鐞嗗憳!",
+              icon: 'none',
+              duration: 1000,
+            })
+            return false;
+          }
+        }
         if (this.data.ebookCount == 0) {
           wx.showToast({
             title: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒",

--
Gitblit v1.9.1