From f1e20feafa89c8d50af5e69c0333a9efc239ee49 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 01 四月 2024 14:09:11 +0800
Subject: [PATCH] 图书详情页bug修改,我的错题、收藏模式下答题卡添加题目类型,非单选题添加查看解析按钮

---
 packageBookService/pages/bookServices/list/index.js |  107 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 97 insertions(+), 10 deletions(-)

diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js
index 5cd1be5..9409fb6 100644
--- a/packageBookService/pages/bookServices/list/index.js
+++ b/packageBookService/pages/bookServices/list/index.js
@@ -34,10 +34,32 @@
       options: [],
       disabled: false,
     },
-    disabledSecondList: false,
     majorProjectList: {
       value: [],
       options: [],
+    },
+    sortList: {
+      value: '',
+      options: [{
+          value: '',
+          label: '缁煎悎鎺掑簭',
+        }, {
+          value: '1',
+          label: '鍚嶇О姝e簭'
+        },
+        {
+          value: '2',
+          label: '鍚嶇О鍊掑彊'
+        },
+        {
+          value: '3',
+          label: '鍑虹増鏃堕棿姝e簭'
+        },
+        {
+          value: '3',
+          label: '鍑虹増鏃堕棿鍊掑彊'
+        }
+      ],
     },
     newTextBook: {
       value: [],
@@ -53,6 +75,12 @@
     loading: false,
     noData: false,
     showDropdown: false,
+    isRequesting: false,
+    disabledStair: false,
+    disabledSecondList: false,
+    disabledProject: false,
+    disabledNewForms: false,
+    triggered: false,
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -134,7 +162,13 @@
    * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
    */
   onPullDownRefresh() {
-    console.log('涓嬫媺');
+    this.setData({
+      triggered: true
+    })
+    this.setData({
+      'pageCount.page': 1
+    })
+    this.getBookList(this.data.path);
   },
 
   /**
@@ -143,11 +177,13 @@
   onReachBottom(e) {
     const flag = this.data.bookList.length < this.data.pageCount.total
     if (flag) {
-      this.setData({
-        isMore: true,
-        "pageCount.page": this.data.pageCount.page + 1
-      })
-      this.getBookList(this.data.path)
+      if (!this.data.isRequesting) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.getBookList(this.data.path)
+      }
     } else {
       this.setData({
         isMore: true,
@@ -170,6 +206,9 @@
   },
   // 鑾峰彇涓�绾у垪琛�
   getStairList(path) {
+    this.setData({
+      disabledStair: false
+    })
     const query = {
       path,
       filterList: [],
@@ -199,6 +238,11 @@
         'stairList.options': options,
         'stairList.value': this.data.stairCode,
       });
+      if (!options.length) {
+        this.setData({
+          disabledStair: true
+        })
+      }
     });
   },
   // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被
@@ -236,6 +280,10 @@
   },
   // 鑾峰彇閲嶇偣椤圭洰
   getProjectList(type) {
+    this.setData({
+      disabledProject: false,
+      disabledNewForms: false
+    })
     const options = [];
     const arr = [];
     let array = [];
@@ -243,7 +291,7 @@
       refCodes: [type],
     };
     app.MG.store.getProductTypeField(query).then((res) => {
-      array = JSON.parse(res[0].config).option;
+      array = JSON.parse(res[0].config).option.filter(item => item.value == this.data.assortCheck.code);
       for (let index = 0; index < array.length; index++) {
         const element = array[index];
         if (element.child) {
@@ -261,6 +309,11 @@
             label: element.name,
           });
         }
+        if (!options.length) {
+          this.setData({
+            disabledProject: true
+          })
+        }
         this.setData({
           'majorProjectList.options': options,
         });
@@ -272,6 +325,11 @@
             label: element.name,
           });
         }
+        if (!options.length) {
+          this.setData({
+            disabledNewForms: true
+          })
+        }
         this.setData({
           'newTextBook.options': options,
         });
@@ -281,9 +339,13 @@
   },
   // 鑾峰彇鍥句功鍒楄〃
   getBookList(path) {
+    if (this.data.isRequesting) {
+      return false;
+    }
     this.setData({
       loading: true,
-      noData: false
+      noData: false,
+      isRequesting: true
     })
     let sort;
     let pathObj = {};
@@ -342,11 +404,30 @@
         bookList: res.datas,
         enable: false,
         "pageCount.total": res.total,
-        loading: false
+        loading: false,
+        isRequesting: false
       });
       if (!res.datas.length) {
         this.setData({
           noData: true,
+        })
+        if (!this.data.pathList.length) {
+          // 鏈�夋嫨浜岀骇鍒嗙被锛屼笖鏃犲浘涔�
+          this.setData({
+            disabledSecondList: true
+          })
+        } else {
+          this.setData({
+            disabledSecondList: false
+          })
+        }
+      }
+      if (this.data.triggered) {
+        this.setData({
+          triggered: false
+        })
+        wx.showToast({
+          title: '鍒锋柊鎴愬姛',
         })
       }
     });
@@ -411,6 +492,12 @@
     });
     this.getBookList(this.data.path);
   },
+  // 鎺掑簭鍒囨崲
+  onSortChange(e) {
+    this.setData({
+      'sortList.value': e.detail.value
+    })
+  },
   changeNewText(e) {
     this.setData({
       'newTextBook.value': e.detail.value,

--
Gitblit v1.9.1