From aa2c08b3be23a01d44205b2c19d21a2bf53f944f Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 01 四月 2024 16:15:38 +0800
Subject: [PATCH] 图书服务列表、详情页bug修改

---
 pages/bookExhibitionList/index.js |  199 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 140 insertions(+), 59 deletions(-)

diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js
index c4d4a70..bd39345 100644
--- a/pages/bookExhibitionList/index.js
+++ b/pages/bookExhibitionList/index.js
@@ -8,6 +8,9 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    keynoteDisabled: true,
+    value: '',
+    keyword: '',
     nameSort: null,
     total: null,
     page: {
@@ -17,18 +20,14 @@
     keynoteValue: null,
     filteredItems: [],
     newValue: null,
-    value: '',
     bookExhibitionList: [],
     sorter: {
       value: 'default',
     },
     product: {
       value: '*',
-
-      options: [
-        {
+      options: [{
           value: '*',
-
           label: '鎬诲垎绫�',
         },
         {
@@ -55,9 +54,60 @@
       value: [],
       options: [],
     },
+    navBarHeight: '',
+    barHeight: '',
+    windowHeight: '',
+
   },
 
 
+
+  /**
+   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+   */
+  onLoad(options) {
+
+    console.log(this.data.keynoteDisabled, 'keynoteDisabled');
+    // console.log(this.data.filteredItems, 88888);
+    const systInfo = wx.getSystemInfoSync();
+    const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
+    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
+    this.setData({
+      navBarHeight: navBarHeight,
+      barHeight: systInfo.statusBarHeight,
+    })
+
+    // 鍗曞垪閫夋嫨鍣ㄩ�夐」
+    const singleSelectOptions = this.data.filteredItems.map(item => ({
+      label: item.name,
+      value: item.value,
+      disabled: false,
+    }))
+
+    if (this.data.filteredItems = []) {
+      console.log(11111);
+      // singleSelectOptions.push({
+      //   label: '鏆傛棤鏁版嵁',
+      //   value: 'disabled',
+      //   disabled: true,
+      // });
+    } else {
+      console.log(7889);
+    }
+
+
+
+
+
+    console.log(this.data.bookExhibitionList.length, 'this.data.bookExhibitionList.length');
+    // 鏇存柊鏁版嵁
+    this.setData({
+      'multipleSelect.options': singleSelectOptions,
+    });
+
+
+    // 
+  },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
@@ -71,8 +121,8 @@
    */
   onShow() {
     this.bookExhibitionGet()
-
     this.keyProjectsGet()
+
   },
 
   /**
@@ -95,7 +145,10 @@
   onPullDownRefresh() {
 
   },
-
+  onPullDownRefresh() {
+    this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
+    this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
+  },
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
@@ -121,7 +174,9 @@
         'page.size': newSize
       });
       this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
-      console.log(1111);
+
+
+
     }
   },
 
@@ -138,7 +193,10 @@
     wx.showLoading({
       title: '鍔犺浇涓�...',
     })
-
+    let searchObj = {
+      'Name*': this.data.keyword,
+      '||subtitle*': this.data.keyword
+    }
     // console.log(this.data.keynoteValue);
     let sort = {
       Name: this.data.nameSort || 'Desc'
@@ -149,7 +207,9 @@
       queryType: '*',
       fields: {
         jsek_link: [],
-        'bookClassification*': this.data.keynoteValue || []
+        subtitle: [],
+        'bookClassification*': this.data.keynoteValue || [],
+        ...searchObj
       },
       paging: this.data.page,
       sort: sort,
@@ -157,15 +217,31 @@
       //   width: 100
       // },
     }).then(res => {
-
+      res.datas.forEach((item) => {
+        item.subtitleName = item.subtitle + item.name
+      })
+      console.log(res, 'item');
       this.data.total = res.total
 
-      //  list.push(res.datas)
+      // list.push(res.datas)
+      console.log(res.datas.length);
+
+
+      if (res.datas.length == 0) {
+        this.setData({
+          keynoteDisabled: true
+        })
+      }
+
       const list = [...res.datas]
 
       this.setData({
         bookExhibitionList: list
       })
+      // 鍒ゆ柇鏁版嵁闀垮害
+      console.log(list.length, 'list.length');
+
+
       //鍙栨秷
       wx.hideLoading()
       // console.log(this.data.bookExhibitionList, '鏁版嵁');
@@ -200,41 +276,6 @@
   },
 
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
-   */
-  onLoad(options) {
-    // console.log(this.data.filteredItems, 88888);
-
-    // 鍗曞垪閫夋嫨鍣ㄩ�夐」
-    const singleSelectOptions = this.data.filteredItems.map(item => ({
-      label: item.name,
-      value: item.value,
-      disabled: false,
-    }))
-
-    if (this.data.filteredItems = []) {
-      console.log(11111);
-      singleSelectOptions.push({
-        label: '绂佺敤閫夐」',
-        value: 'disabled',
-        disabled: true,
-      });
-    }
-
-    // singleSelectOptions.push({
-    //   label: '绂佺敤閫夐」',
-    //   value: 'disabled',
-    //   disabled: true,
-    // });
-
-
-    // 鏇存柊鏁版嵁
-    this.setData({
-      'multipleSelect.options': singleSelectOptions,
-    });
-
-  },
 
 
   // 鎬诲垎绫�
@@ -245,6 +286,24 @@
     const newValue = e.detail.value;
     const selectedOption = this.data.product.options.find(option => option.value === newValue);
     const newPrice = selectedOption ? selectedOption.price : null;
+    const bookExhibitionListsubsidiary = []
+    this.setData({
+      bookExhibitionListsubsidiary: this.data.bookExhibitionList
+    })
+    console.log(bookExhibitionListsubsidiary, 'bookExhibitionListsubsidiary');
+    console.log(newValue, 'newValue');
+    console.log(newPrice, 'newPrice');
+
+    if (newPrice) {
+      this.setData({
+        keynoteDisabled: false
+      })
+    }
+    if (!newPrice) {
+      this.setData({
+        keynoteDisabled: true
+      })
+    }
     this.setData({
       'product.value': newValue,
       'product.price': newPrice, // 灏嗛�変腑鐨� price 鍊间繚瀛樺湪鏁版嵁涓�
@@ -256,16 +315,9 @@
     if (this.data.keynoteValue) {
       //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈�
       this.data.keynoteValue = []
-
       this.bookExhibitionGet(newValue)
       this.onLoad()
-      console.log('true');
-    } else {
-      // this.bookExhibitionGet(newValue);
-      // this.keyProjectsGet(newPrice);
-      console.log('fals');
     }
-
   },
 
   // 閲嶇偣椤圭洰
@@ -273,9 +325,13 @@
     this.setData({
       'multipleSelect.value': e.detail.value,
     });
+
   },
   handleConfirm(event) {
-    const { value } = event.detail;
+
+    const {
+      value
+    } = event.detail;
     // 纭鎿嶄綔鐨勫鐞嗛�昏緫
 
     console.log('纭鎿嶄綔锛岄�変腑鐨勫�间负锛�', value);
@@ -283,15 +339,29 @@
     this.bookExhibitionGet()
   },
   handleReset() {
+
     // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫
     this.data.keynoteValue = []
     console.log('閲嶇疆鎿嶄綔');
     this.bookExhibitionGet()
   },
   onSwapRight() {
-    // console.log('xxxxxx');
-    this.data.nameSort = 'Asc'
+    if (!this.data.nameSort) {
+      this.setData({
+        nameSort: 'Desc',
+      });
+    } else if (this.data.nameSort == 'Desc') {
+      this.setData({
+        nameSort: 'Asc',
+      });
+    } else if (this.data.nameSort == 'Asc') {
+      this.setData({
+        nameSort: '',
+      });
+    }
+
     this.bookExhibitionGet()
+
   },
   onSwapLeft() {
     this.data.nameSort = 'Desc'
@@ -302,7 +372,18 @@
     const item = event.currentTarget.dataset.item;
     console.log(item);
     wx.navigateTo({
-      url: '/pages/bookExhibitionDetails/index?id=' + item.id // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟
+      url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name + '&subtitleName=' + item.subtitleName // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟
     });
-  }
+  },
+  // 鎼滅储妗�
+  onSearchSubmit(e) {
+    this.setData({
+      keyword: e.detail.value
+    })
+    console.log(this.data.keyword, 'keyword');
+    this.bookExhibitionGet()
+  },
+  goBack() {
+    wx.navigateBack();
+  },
 })
\ No newline at end of file

--
Gitblit v1.9.1