From b125d3ea74d61fb8e4d7238c83906aeea52c6b4c Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 12 三月 2024 14:39:55 +0800
Subject: [PATCH] 更新代码

---
 pages/bookExhibitionList/index.js |  129 +++++++++++++++++++++++++++++-------------
 1 files changed, 88 insertions(+), 41 deletions(-)

diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js
index c4d4a70..067ceae 100644
--- a/pages/bookExhibitionList/index.js
+++ b/pages/bookExhibitionList/index.js
@@ -8,6 +8,8 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    value: '',
+    keyword: '',
     nameSort: null,
     total: null,
     page: {
@@ -17,7 +19,6 @@
     keynoteValue: null,
     filteredItems: [],
     newValue: null,
-    value: '',
     bookExhibitionList: [],
     sorter: {
       value: 'default',
@@ -55,9 +56,55 @@
       value: [],
       options: [],
     },
+    navBarHeight: '',
+    barHeight: ''
+
   },
 
 
+
+  /**
+    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+    */
+  onLoad(options) {
+    // 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,
+      });
+    }
+
+    // singleSelectOptions.push({
+    //   label: '绂佺敤閫夐」',
+    //   value: 'disabled',
+    //   disabled: true,
+    // });
+
+
+    // 鏇存柊鏁版嵁
+    this.setData({
+      'multipleSelect.options': singleSelectOptions,
+    });
+
+  },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
@@ -138,7 +185,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 +199,8 @@
       queryType: '*',
       fields: {
         jsek_link: [],
-        'bookClassification*': this.data.keynoteValue || []
+        'bookClassification*': this.data.keynoteValue || [],
+        ...searchObj
       },
       paging: this.data.page,
       sort: sort,
@@ -166,6 +217,7 @@
       this.setData({
         bookExhibitionList: list
       })
+        
       //鍙栨秷
       wx.hideLoading()
       // console.log(this.data.bookExhibitionList, '鏁版嵁');
@@ -200,41 +252,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,
-    });
-
-  },
 
 
   // 鎬诲垎绫�
@@ -290,19 +307,49 @@
   },
   onSwapRight() {
     // console.log('xxxxxx');
-    this.data.nameSort = 'Asc'
+    // 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'
     // console.log('sssssss');
     this.bookExhibitionGet()
+
+
   },
   onBookExhibitionDetails: function (event) {
     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 // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡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