From eeaef4fa1a06616e41ae8013c95e99bb3895aac5 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期三, 17 四月 2024 18:10:10 +0800
Subject: [PATCH] 1

---
 pages/bookExhibitionList/index.js |  241 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 154 insertions(+), 87 deletions(-)

diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js
index a16ce9e..64570f8 100644
--- a/pages/bookExhibitionList/index.js
+++ b/pages/bookExhibitionList/index.js
@@ -8,6 +8,27 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    product: {
+      value: 'all',
+      options: [{
+          value: 'all',
+          label: '鍏ㄩ儴浜у搧',
+        },
+        {
+          value: 'new',
+          label: '鏈�鏂颁骇鍝�',
+        },
+        {
+          value: 'hot',
+          label: '鏈�鐏骇鍝�',
+        },
+      ],
+    },
+    loading: true,
+    hidden: true,
+    totalSize: '',
+    start: 0,
+    isMore: null,
     keynoteDisabled: true,
     value: '',
     keyword: '',
@@ -24,32 +45,32 @@
     sorter: {
       value: 'default',
     },
-    product: {
-      value: '*',
-      options: [{
-          value: '*',
-          label: '鎬诲垎绫�',
-        },
-        {
-          value: 'jsek_bFHigherEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_higherEducation',
-          label: '楂樼瓑鏁欒偛',
-        },
-        {
-          value: 'jsek_bFVocationalEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_vocationalEducation',
-          label: '鑱屼笟鏁欒偛',
-        },
-        {
-          value: 'jsek_bFTeacherEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_teacherEducation',
-          label: '鏁欏笀鏁欒偛',
-        },
-      ],
-    },
+    // product: {
+    //   value: '*',
+    //   options: [{
+    //       value: '*',
+    //       label: '鎬诲垎绫�',
+    //     },
+    //     {
+    //       value: 'jsek_bFHigherEducation',
+    //       //閲嶇偣椤圭洰
+    //       price: 'jsek_higherEducation',
+    //       label: '楂樼瓑鏁欒偛',
+    //     },
+    //     {
+    //       value: 'jsek_bFVocationalEducation',
+    //       //閲嶇偣椤圭洰
+    //       price: 'jsek_vocationalEducation',
+    //       label: '鑱屼笟鏁欒偛',
+    //     },
+    //     {
+    //       value: 'jsek_bFTeacherEducation',
+    //       //閲嶇偣椤圭洰
+    //       price: 'jsek_teacherEducation',
+    //       label: '鏁欏笀鏁欒偛',
+    //     },
+    //   ],
+    // },
     multipleSelect: {
       value: [],
       options: [],
@@ -61,19 +82,19 @@
       value: 'timeAsc',
       options: [{
           value: 'nameAsc',
-          label: '鍚嶇О浠庨珮鍒颁綆',
+          label: '鍚嶇О姝e簭',
         },
         {
           value: 'nameDesc',
-          label: '鍚嶇О浠庝綆鍒伴珮',
+          label: '鍚嶇О鍊掑簭',
         },
         {
           value: 'timeAsc',
-          label: '鍒涘缓鏃堕棿浠庨珮鍒颁綆',
+          label: '鍑虹増鏃堕棿姝e簭',
         },
         {
           value: 'timeDesc',
-          label: '鍒涘缓鏃堕棿浠庡簳鍒伴珮',
+          label: '鍑虹増鏃堕棿鍊掑簭',
         },
       ],
     },
@@ -164,9 +185,32 @@
   onPullDownRefresh() {
 
   },
-  onPullDownRefresh() {
-    this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
-    this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
+  // onPullDownRefresh() {
+  //   this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
+  //   this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
+  // },
+
+  onScrollToLower() {
+    console.log(789);
+    console.log(this.data.bookExhibitionList.length);
+    console.log(this.data.totalSize);
+    if (this.data.bookExhibitionList.length < this.data.totalSize) {
+      this.setData({
+        isMore: true,
+        start: this.data.start + 1
+      })
+      this.bookExhibitionGet()
+    } else {
+      this.setData({
+        isMore: true,
+      })
+      setTimeout(() => {
+        this.setData({
+          isMore: false
+        })
+        console.log('300');
+      }, 300)
+    }
   },
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
@@ -192,7 +236,7 @@
         // 'page.start': currentPage,
         'page.size': newSize
       });
-      this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
+      // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
 
 
 
@@ -251,7 +295,10 @@
         'bookClassification*': this.data.keynoteValue || [],
         ...searchObj
       },
-      paging: this.data.page,
+      paging: {
+        start: '0',
+        size: this.data.start * 10
+      },
       sort: sort,
       // coverSize: {
       //   width: 100
@@ -277,9 +324,10 @@
       }
 
       const list = [...res.datas]
-
+      console.log(res);
       this.setData({
-        bookExhibitionList: list
+        bookExhibitionList: list,
+        totalSize: res.total
       })
       // 鍒ゆ柇鏁版嵁闀垮害
       console.log(list.length, 'list.length');
@@ -288,89 +336,102 @@
       //鍙栨秷
       wx.hideLoading()
       // console.log(this.data.bookExhibitionList, '鏁版嵁');
+
+      this.setData({
+        loading: false,
+        hidden: false,
+      })
     })
 
   },
   //閲嶇偣椤圭洰鎺ュ彛
   keyProjectsGet(newPrice) {
+
+    this.setData({
+      loading: true,
+      hidden: true,
+    })
     // console.log(newPrice, 'newPrice');
     let parms = {
       refCodes: ['bookClassification']
     }
     app.MG.store.getProductTypeField(parms).then(res => {
-
       const checkData = JSON.parse(res[0].config)
-
-
       checkData.option.forEach(item => {
         if (newPrice == item.value) {
-
           this.setData({
             filteredItems: item.child || [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁�
           });
-
           // console.log(this.data.filteredItems);
-
         }
       })
 
       this.onLoad();
+
+      this.setData({
+        loading: false,
+        hidden: false,
+      })
     })
   },
 
 
-
-
-  // 鎬诲垎绫�
-  // 鎬诲垎绫�
   onChange(e) {
-
-    this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
-    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 鍊间繚瀛樺湪鏁版嵁涓�
-    });
-    this.bookExhibitionGet(newValue);
-    this.keyProjectsGet(newPrice);
-    // 璋冪敤鏇存柊椤甸潰鏁版嵁鐨勫嚱鏁帮紝浼犲叆鏂扮殑 value 鍜� price 鍊�
-
-    if (this.data.keynoteValue) {
-      //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈�
-      this.data.keynoteValue = []
-      this.bookExhibitionGet(newValue)
-      this.onLoad()
-    }
+    console.log(e);
   },
+
+  // 鎬诲垎绫�
+  // 鎬诲垎绫�
+  // onChange(e) {
+
+  //   this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
+  //   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
+  //     })
+  //   }
+  //   console.log(newValue);
+  //   this.setData({
+  //     'product.value': newValue,
+  //     'product.price': newPrice, // 灏嗛�変腑鐨� price 鍊间繚瀛樺湪鏁版嵁涓�
+  //   });
+  //   this.bookExhibitionGet(newValue);
+  //   this.keyProjectsGet(newPrice);
+  //   // 璋冪敤鏇存柊椤甸潰鏁版嵁鐨勫嚱鏁帮紝浼犲叆鏂扮殑 value 鍜� price 鍊�
+
+  //   if (this.data.keynoteValue) {
+  //     //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈�
+  //     this.data.keynoteValue = []
+  //     this.bookExhibitionGet(newValue)
+  //     this.onLoad()
+  //   }
+  // },
 
   // 閲嶇偣椤圭洰
   handleMultipleSelect(e) {
     this.setData({
       'multipleSelect.value': e.detail.value,
     });
-
   },
   handleConfirm(event) {
+
+
 
     const {
       value
@@ -381,11 +442,12 @@
     this.data.keynoteValue = value
     this.bookExhibitionGet()
   },
-  handleReset() {
+
+
+  handleReset(e) {
 
     // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫
     this.data.keynoteValue = []
-    console.log('閲嶇疆鎿嶄綔');
     this.bookExhibitionGet()
   },
   onSwapRight() {
@@ -412,12 +474,14 @@
     this.bookExhibitionGet()
   },
   onBookExhibitionDetails: function (event) {
+    console.log(456);
     const item = event.currentTarget.dataset.item;
     console.log(item);
     wx.navigateTo({
       url: '/pages/bookExhibitionDetails/index?id=' + item.id + '&bookName=' + item.name + '&subtitleName=' + item.subtitleName // 鍋囪璺宠浆鍒拌鎯呴〉闈紝骞朵紶閫掍簡id鍙傛暟
     });
   },
+
   // 鎼滅储妗�
   onSearchSubmit(e) {
     this.setData({
@@ -435,5 +499,8 @@
     });
     console.log(e.detail.value, 'e.detail.value');
     this.bookExhibitionGet()
+  },
+  onTest() {
+    console.log(7555);
   }
 })
\ No newline at end of file

--
Gitblit v1.9.1