From c5864be56488bee0c767d4b1cf157db4a0ec33c3 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期二, 26 三月 2024 10:47:38 +0800
Subject: [PATCH] 关于我们bug

---
 pages/retrievalPage/index.js |  257 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 235 insertions(+), 22 deletions(-)

diff --git a/pages/retrievalPage/index.js b/pages/retrievalPage/index.js
index 72634ee..663142c 100644
--- a/pages/retrievalPage/index.js
+++ b/pages/retrievalPage/index.js
@@ -9,6 +9,7 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    isMore: null,
     tabPanelstyle: 'display:flex;justify-content:center;align-items:center;',
     navBarHeight: '',
     barHeight: '',
@@ -24,7 +25,12 @@
     biblioClassificationData: [],//涔﹀睍
     biblioClassificationTotal: 0,
     bookFairData: [],//涔︾洰
-    bookFairTotal: 0
+    bookFairTotal: 0,
+    pageCount: {
+      page: 1,
+      total: 0,
+    },
+    tabValue: ''
   },
 
   /**
@@ -35,7 +41,6 @@
     const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
     const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
     this.setData({
-
       navBarHeight: navBarHeight,
       barHeight: systInfo.statusBarHeight,
       searchVal: options.searchVal
@@ -44,6 +49,13 @@
 
     this.retrievalPageGet()
     this.bibliographyGet()
+    let event = {
+      detail: {
+
+        value: "0"
+      }
+    }
+    this.onTabsChange(event)
   },
 
   /**
@@ -105,13 +117,53 @@
     this.retrievalPageGet()
     this.bibliographyGet()
   },
+
+
+  //鏍囩鐨勫垏鎹�
   onTabsChange(event) {
-    console.log(`Change tab, tab-panel searchVal is ${event.detail.searchVal}.`);
+    const value = event.detail.value
+    // if (this.data.bookData <= 0 || this.data.courseData <= 0 || this.data.digitalTextbooksData <= 0 || this.data.seminarData <= 0 || this.data.biblioClassificationData <= 0 || this.data.bookFairData <= 0) {
+    //   this.setData({
+    //     isMore: true
+    //   })
+    // }
+    if (value === '0') {
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+
+    } else if (value === '1') {
+      console.log(value, 'tab');
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+    } else if (value === '2') {
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+    } else if (value === '3') {
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+    } else if (value === '4') {
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+    } else if (value === '5') {
+      this.setData({
+        tabValue: value,
+        isMore: false
+      })
+    }
+
   },
 
-  onTabsClick(event) {
-    console.log(`Click tab, tab-panel searchVal is ${event.detail.searchVal}.`);
-  },
+
 
 
   retrievalPageGet() {
@@ -149,7 +201,7 @@
       },
       PageQuery: {
         Start: 0,
-        Size: 999
+        Size: this.data.pageCount.page * 9,
       },
       SortQuery: [
         {
@@ -194,7 +246,7 @@
       },
       PageQuery: {
         Start: 0,
-        Size: 999
+        Size: this.data.pageCount.page * 4
       },
       SortQuery: [
         {
@@ -238,7 +290,7 @@
       },
       PageQuery: {
         Start: 0,
-        Size: 999
+        Size: this.data.pageCount.page * 9,
       },
       SortQuery: [
         {
@@ -283,7 +335,7 @@
       },
       PageQuery: {
         Start: 0,
-        Size: 999
+        Size: this.data.pageCount.page * 6,
       },
       SortQuery: [
         {
@@ -327,7 +379,7 @@
 
       PageQuery: {
         Start: 0,
-        Size: 999
+        Size: this.data.pageCount.page * 10
       },
       SortQuery: [
         {
@@ -372,7 +424,7 @@
       method: 'post',
       data: body
     }).then((resp) => {
-      // console.log(resp);
+      console.log(resp, 'resp');
 
       //鍥句功       0
       const data1 = resp[0]
@@ -382,7 +434,8 @@
       })
       this.setData({
         bookData: datas1,
-        bookTotal: data1.totalCount
+        bookTotal: data1.totalCount,
+
       })
 
 
@@ -431,6 +484,10 @@
         fields
       })
 
+      datas5.forEach((items) => {
+        items.subtitleName = items.subtitle + items.name
+      })
+      // console.log(datas5, 'sadasd');
       this.setData({
         biblioClassificationData: datas5,
         biblioClassificationTotal: data5.totalCount
@@ -440,6 +497,9 @@
 
 
     })
+    wx.stopPullDownRefresh()
+
+
 
   },
   bibliographyGet() {
@@ -458,7 +518,7 @@
       queryType: '*',
       paging: {
         start: 0,
-        size: 999
+        size: this.data.pageCount.page * 9,
       },
       coverSize: {
         width: 260
@@ -474,21 +534,22 @@
       },
       SysType: "CmsItem"
     }).then(res => {
-      // console.log(res);
+
       this.setData({
         bookFairData: res.datas,
         bookFairTotal: res.total
       })
 
     })
+    wx.stopPullDownRefresh()
   },
   downloadData(event) {
     console.log(111);
     const item = event.currentTarget.dataset.item;
-    // console.log(item.datas.freeFile.searchVal);
-    const URL = 'http://182.92.203.7:3001/file/api/ApiDownload?md5=' + item.datas.freeFile.searchVal
+    // console.log(item.datas.freeFile.Value);
+    const URL = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.datas.freeFile.Value
     item.determine = false
-
+    console.log(URL, 'URL');
     setTimeout(() => {
       if (URL) {
         item.determine = true
@@ -522,10 +583,162 @@
     console.log(e.currentTarget.dataset.item);
     const item = e.currentTarget.dataset.item
     wx.navigateTo({
-      url: '/pages/bookServices/detail/index?id=' + item.id + '&name' + item.name
-
-
+      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name
     })
-  }
+  },
+  onBookExhibitionDetails(e) {
+    console.log(e.currentTarget.dataset.item);
+    const item = e.currentTarget.dataset.item
 
+    wx.navigateTo({
+      url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟
+    });
+  },
+
+  //涓婃媺鍑芥暟
+  onPullDownRefresh() {
+    console.log("涓嬫媺鍒锋柊...");
+  },
+  /**
+     * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
+     */
+  onReachBottom(e) {
+    if (this.data.tabValue == 0) {
+      console.log(0);
+      if (this.data.bookData.length < this.data.bookTotal) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.retrievalPageGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+
+      }
+
+    } else if (this.data.tabValue == 1) {
+
+      if (this.data.courseData.length < this.data.courseTotal) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.retrievalPageGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+
+      }
+      console.log(2);
+    } else if (this.data.tabValue == 2) {
+
+      if (this.data.digitalTextbooksData.length < this.data.digitalTextbooksTotal && this.data.digitalTextbooksData.length > 9) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.retrievalPageGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+
+      }
+      console.log(2);
+    } else if (this.data.tabValue == 3) {
+      if (this.data.seminarData.length < this.data.seminarTotal) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.retrievalPageGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+      }
+      console.log(3);
+    } else if (this.data.tabValue == 4) {
+      if (this.data.bookFairData.length < this.data.bookFairTotal) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.bibliographyGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+      }
+      console.log(4);
+    } else if (this.data.tabValue == 5) {
+      if (this.data.biblioClassificationData.length < this.data.biblioClassificationTotal) {
+        this.setData({
+          isMore: true,
+          "pageCount.page": this.data.pageCount.page + 1
+        })
+        this.retrievalPageGet()
+      } else {
+        this.setData({
+          isMore: true,
+        })
+        setTimeout(() => {
+          this.setData({
+            isMore: false
+          })
+        }, 100)
+
+      }
+    }
+
+
+
+  },
+
+  // 涓嬫媺鍑芥暟
+  onPullDownRefresh() {
+
+    if (this.data.tabValue == 4) {
+      this.setData({
+        "pageCount.page": 1
+      })
+      this.bibliographyGet()
+    } else {
+      this.setData({
+        "pageCount.page": 1
+      })
+      this.retrievalPageGet()
+    }
+
+
+
+  },
 })
\ No newline at end of file

--
Gitblit v1.9.1