From 103db27cd0ca6b3305e95170dc297380f97fcc70 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期四, 25 四月 2024 17:05:47 +0800
Subject: [PATCH] bug3

---
 pages/bookExhibitionDetails/index.js |   94 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/pages/bookExhibitionDetails/index.js b/pages/bookExhibitionDetails/index.js
index 27169f6..8a752fa 100644
--- a/pages/bookExhibitionDetails/index.js
+++ b/pages/bookExhibitionDetails/index.js
@@ -6,12 +6,21 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    start: 1,
+    loading: true,
+    hidden: true,
     bookName: '',
     bookBeginDate: '',
     bookCreator: '',
     bookContent: '',
     bookImage: '',
-    bookExhibitionList: []
+    bookExhibitionList: [],
+    navBarHeight: '',
+    barHeight: '',
+    subtitleName: '',
+    totalSize: '',
+    passId: '',
+    isMore: null,
   },
 
   /**
@@ -19,10 +28,31 @@
    */
   onLoad(options) {
 
+
+    const systInfo = wx.getSystemInfoSync();
+    const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
+    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
+    this.setData({
+      navBarHeight: navBarHeight,
+      barHeight: systInfo.statusBarHeight,
+    })
+    console.log();
+
+
+    this.setData({
+      bookName: options.bookName,
+      subtitleName: options.subtitleName,
+      passId: options.id
+    })
+
     const passId = options.id
 
     this.bookExhibitionGet(passId)
-    this.getBookExhibitionDetails(passId)
+    this.getBookExhibitionDetails()
+
+    wx.setNavigationBarTitle({
+      title: this.data.subtitleName
+    });
   },
 
   /**
@@ -75,6 +105,10 @@
   },
 
   bookExhibitionGet(passId) {
+    this.setData({
+      loading: true,
+      hidden: true,
+    })
     wx.showLoading({
       title: '鍔犺浇涓�...',
     })
@@ -101,15 +135,24 @@
         bookImage: res.datas.icon
       });
       wx.hideLoading()
+      this.setData({
+        loading: false,
+        hidden: false,
+      })
     })
   },
   //涔﹀睍璇︽儏鎺ュ彛
-  getBookExhibitionDetails(passId) {
+  getBookExhibitionDetails() {
+
     app.MG.store.getProductList({
       path: '*',
       storeInfo: 'jsek_bookFair',
-      mainProductId: passId,
+      mainProductId: this.data.passId,
       queryType: 'Related', // 鏌ヨ绫诲瀷锛� Related锛氭煡璇㈠叧鑱斿晢鍝侊紱SubProduct: 鏌ヨ瀛愬晢鍝侊紱
+      paging: {
+        start: 0,
+        size: this.data.start * 6
+      },
       fields: {
         author: [],
         publicationDate: [],
@@ -120,17 +163,48 @@
     }).then(res => {
 
       this.setData({
-        bookExhibitionList: res.datas
+        bookExhibitionList: res.datas,
+        totalSize: res.total
       })
-      console.log(this.data.bookExhibitionList, 88888);
+
+      this.setData({
+        loading: false,
+        hidden: false,
+      })
     })
   },
   onBookDetails(event) {
     const item = event.currentTarget.dataset.item;
     console.log(item, 'item');
-    // wx.navigateTo({
-    //   url: '/pages/bookExhibitionDetails/index?id?name=' + item.id + item.name // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟
-    // });
-  }
+    wx.navigateTo({
+      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name
+    });
+  },
+  goBack() {
+    wx.navigateBack();
+  },
+  // 瑙﹀簳鍑芥暟
+  onReachBottom() {
+    console.log(this.data.bookExhibitionList.length);
+    console.log(this.data.totalSize);
+    if (this.data.bookExhibitionList.length < this.data.totalSize) {
+      console.log(11111);
+      this.setData({
+        isMore: true,
+        start: this.data.start + 1
+      })
+      this.getBookExhibitionDetails()
+    } else {
+      this.setData({
+        isMore: true,
+      })
+      setTimeout(() => {
+        this.setData({
+          isMore: false
+        })
+        console.log('300');
+      }, 300)
+    }
+  },
 
 })
\ No newline at end of file

--
Gitblit v1.9.1