From 04acf6421dded7b6f6eef9d2cf41d0b4a0e8dd0d Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期日, 28 四月 2024 09:23:10 +0800
Subject: [PATCH] 设置表单的bug

---
 pages/bookExhibitionList/index.js |  212 ++++++++++++++++++++++++++--------------------------
 1 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js
index e3b7d50..7064469 100644
--- a/pages/bookExhibitionList/index.js
+++ b/pages/bookExhibitionList/index.js
@@ -1,6 +1,6 @@
 // pages/bookExhibitionList/index.js
 import Toast from 'tdesign-miniprogram/toast/index';
-
+import watch from './watch/watch'
 const app = getApp()
 Page({
 
@@ -8,6 +8,8 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    name: "娴嬭瘯watch",
+    newPrice: '',
     loading: true,
     hidden: true,
     totalSize: '',
@@ -37,26 +39,20 @@
         },
         {
           value: 'jsek_bFHigherEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_higherEducation',
           label: '楂樼瓑鏁欒偛',
         },
         {
           value: 'jsek_bFVocationalEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_vocationalEducation',
           label: '鑱屼笟鏁欒偛',
         },
         {
           value: 'jsek_bFTeacherEducation',
-          //閲嶇偣椤圭洰
-          price: 'jsek_teacherEducation',
           label: '鏁欏笀鏁欒偛',
         },
       ],
     },
     multipleSelect: {
-      value: [],
+      // value: [],
       options: [],
     },
     navBarHeight: '',
@@ -91,8 +87,9 @@
    */
   onLoad(options) {
 
-    console.log(this.data.keynoteDisabled, 'keynoteDisabled');
-    // console.log(this.data.filteredItems, 88888);
+    // this.setData({
+    //   'product.value': '*',
+    // });
     const systInfo = wx.getSystemInfoSync();
     const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
     const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
@@ -101,38 +98,23 @@
       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,
-    });
-
-
+    watch.setWatcher(this);
+    let that = this;
+    setTimeout(function () {
+      that.data.name = "娴嬭瘯watch鍙樺寲浜�"
+    }, 5000)
     // 
   },
-
+  watch: {
+    name: function (newVal, oldVal) {
+      //杩欓噷鐨則his鍜宱nLoad閲岀殑this鎸囧悜涓�鏍� 
+      console.log(newVal, oldVal);
+    },
+    newPrice: function (newVal, oldVal) {
+      console.log(newVal, oldVal);
+    }
+  },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    */
@@ -144,8 +126,11 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow() {
+    // debugger
     this.bookExhibitionGet()
-    this.keyProjectsGet()
+
+    // this.keyProjectsGet(this.data.newPrice)
+
 
   },
 
@@ -161,6 +146,8 @@
    */
   onUnload() {
 
+
+
   },
 
   /**
@@ -175,9 +162,7 @@
   // },
 
   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,
@@ -192,7 +177,7 @@
         this.setData({
           isMore: false
         })
-        console.log('300');
+
       }, 300)
     }
   },
@@ -200,10 +185,9 @@
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
   onReachBottom() {
-    // console.log(this.data.page.size);
-    // console.log(this.data.total);
+
     if (this.data.page.size >= this.data.total) {
-      console.log('宸插姞杞藉畬鎵�鏈夋暟鎹�');
+
       Toast({
         context: this,
         selector: '#t-toast',
@@ -213,6 +197,10 @@
         preventScrollThrough: true,
         icon: 'poweroff',
       });
+
+
+
+
     } else {
       // const currentPage = this.data.page.start + 1; // 鑾峰彇褰撳墠椤垫暟骞跺姞1
       const newSize = this.data.page.size + 10; // 鍘熸潵鐨勫熀纭�涓婂姞10
@@ -244,7 +232,7 @@
       'Name*': this.data.keyword,
       '||subtitle*': this.data.keyword
     }
-    // console.log(this.data.keynoteValue);
+
     let sort = {};
 
     const sortOptions = {
@@ -267,7 +255,7 @@
 
     sort = sortOptions[this.data.product.value] || {};
 
-    console.log(sort);
+
 
     app.MG.store.getProductList({
       storeInfo: 'jsek_bookFair',
@@ -294,32 +282,31 @@
         }
         item.subtitleName = item.subtitle + item.name
       })
-      console.log(res, 'item');
+
       this.data.total = res.total
 
       // list.push(res.datas)
-      console.log(res.datas.length);
+
 
 
       if (res.datas.length == 0) {
         this.setData({
-          keynoteDisabled: true
+          // keynoteDisabled: true
         })
       }
 
       const list = [...res.datas]
-      console.log(res);
+
       this.setData({
         bookExhibitionList: list,
         totalSize: res.total
       })
-      // 鍒ゆ柇鏁版嵁闀垮害
-      console.log(list.length, 'list.length');
+
 
 
       //鍙栨秷
       wx.hideLoading()
-      // console.log(this.data.bookExhibitionList, '鏁版嵁');
+
 
       this.setData({
         loading: false,
@@ -330,64 +317,39 @@
   },
   //閲嶇偣椤圭洰鎺ュ彛
   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)
+      console.log(checkData);
       checkData.option.forEach(item => {
         if (newPrice == item.value) {
           this.setData({
             filteredItems: item.child || [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁�
           });
-          // console.log(this.data.filteredItems);
         }
       })
-
-      this.onLoad();
+      // 鍗曞垪閫夋嫨鍣ㄩ�夐」
+      const singleSelectOptions = this.data.filteredItems.map(item => ({
+        label: item.name,
+        value: item.value,
+      }))
+      // 鏇存柊鏁版嵁
+      this.setData({
+        'multipleSelect.options': singleSelectOptions,
+      });
 
       this.setData({
         loading: false,
         hidden: false,
       })
     })
-  },
-
-
-
-
-  // 鎬诲垎绫�
-  // 鎬诲垎绫�
-  onChange(e) {
-    // e.stopImmediatePropagation();
-
-
-
-
-
-
-
-
-
-
-    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
@@ -398,38 +360,77 @@
         keynoteDisabled: true
       })
     }
-    console.log(newValue);
+  },
+
+
+
+
+  // 鎬诲垎绫�
+  // 鎬诲垎绫�
+  onChange(e) {
+
+
+
+    // this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫��
+    const newValue = e.detail.value;
+
     this.setData({
       'product.value': newValue,
-      'product.price': newPrice, // 灏嗛�変腑鐨� price 鍊间繚瀛樺湪鏁版嵁涓�
+
     });
+
+
+    // debugger
+    // let newPrice = ''
+
+
+
+
+    if (newValue == 'jsek_bFHigherEducation') {
+
+      this.setData({
+        newPrice: 'jsek_higherEducation'
+      })
+    } else if (newValue == 'jsek_bFVocationalEducation') {
+      this.setData({
+        newPrice: 'jsek_vocationalEducation'
+      })
+    } else if (newValue == 'jsek_bFTeacherEducation') {
+      this.setData({
+        newPrice: 'jsek_teacherEducation'
+      })
+    }
     this.bookExhibitionGet(newValue);
-    this.keyProjectsGet(newPrice);
-    // 璋冪敤鏇存柊椤甸潰鏁版嵁鐨勫嚱鏁帮紝浼犲叆鏂扮殑 value 鍜� price 鍊�
+    this.keyProjectsGet(this.data.newPrice)
+
+
+
 
     if (this.data.keynoteValue) {
       //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈�
       this.data.keynoteValue = []
       this.bookExhibitionGet(newValue)
-      this.onLoad()
+
     }
-    // e.stopImmediatePropagation()
+
+
+
 
   },
 
   // 閲嶇偣椤圭洰
   handleMultipleSelect(e) {
+    console.log(e);
     this.setData({
       'multipleSelect.value': e.detail.value,
     });
   },
   handleConfirm(event) {
+    console.log(event);
     const {
       value
     } = event.detail;
     // 纭鎿嶄綔鐨勫鐞嗛�昏緫
-
-    console.log('纭鎿嶄綔锛岄�変腑鐨勫�间负锛�', value);
     this.data.keynoteValue = value
     this.bookExhibitionGet()
   },
@@ -461,13 +462,12 @@
   },
   onSwapLeft() {
     this.data.nameSort = 'Desc'
-    // console.log('sssssss');
     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鍙傛暟
     });
@@ -478,7 +478,7 @@
     this.setData({
       keyword: e.detail.value
     })
-    console.log(this.data.keyword, 'keyword');
+
     this.bookExhibitionGet()
   },
   goBack() {
@@ -488,10 +488,10 @@
     this.setData({
       'product.value': e.detail.value,
     });
-    console.log(e.detail.value, 'e.detail.value');
+
     this.bookExhibitionGet()
   },
   onOpend() {
-    console.log(7555);
+
   }
 })
\ No newline at end of file

--
Gitblit v1.9.1