From 9ba507bed7688a1a9eee31255e40add8bf1a8689 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期日, 28 四月 2024 18:54:33 +0800 Subject: [PATCH] 书展bug --- pages/bookExhibitionList/index.js | 134 ++++++++++++++++++++++++++------------------ 1 files changed, 79 insertions(+), 55 deletions(-) diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js index 7064469..2731d08 100644 --- a/pages/bookExhibitionList/index.js +++ b/pages/bookExhibitionList/index.js @@ -78,6 +78,7 @@ }, ], }, + newValue: '' }, @@ -86,7 +87,7 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - + console.log(this.data.multipleSelect.options.length, '44444'); // this.setData({ // 'product.value': '*', // }); @@ -99,11 +100,11 @@ }) - watch.setWatcher(this); - let that = this; - setTimeout(function () { - that.data.name = "娴嬭瘯watch鍙樺寲浜�" - }, 5000) + // watch.setWatcher(this); + // let that = this; + // setTimeout(function () { + // that.data.name = "娴嬭瘯watch鍙樺寲浜�" + // }, 5000) // }, watch: { @@ -129,7 +130,7 @@ // debugger this.bookExhibitionGet() - // this.keyProjectsGet(this.data.newPrice) + this.keyProjectsGet(this.data.newPrice) }, @@ -187,7 +188,6 @@ onReachBottom() { if (this.data.page.size >= this.data.total) { - Toast({ context: this, selector: '#t-toast', @@ -197,10 +197,6 @@ preventScrollThrough: true, icon: 'poweroff', }); - - - - } else { // const currentPage = this.data.page.start + 1; // 鑾峰彇褰撳墠椤垫暟骞跺姞1 const newSize = this.data.page.size + 10; // 鍘熸潵鐨勫熀纭�涓婂姞10 @@ -209,9 +205,6 @@ 'page.size': newSize }); // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 - - - } }, @@ -259,7 +252,7 @@ app.MG.store.getProductList({ storeInfo: 'jsek_bookFair', - path: newValue, + path: this.data.newValue, queryType: '*', fields: { jsek_link: [], @@ -316,50 +309,95 @@ }, //閲嶇偣椤圭洰鎺ュ彛 - keyProjectsGet(newPrice) { + keyProjectsGet() { + // debugger + if (this.data.multipleSelect.options.length !== 0) { + console.log('寮犱竴楦�'); + this.setData({ + 'multipleSelect.options': [], + }); + } + //楠ㄦ灦灞� this.setData({ loading: true, hidden: true, }) + + // 鍙傛暟 let parms = { refCodes: ['bookClassification'] } + //璇锋眰鏁版嵁 app.MG.store.getProductTypeField(parms).then(res => { + // 鏍煎紡鍖栨暟鎹� const checkData = JSON.parse(res[0].config) console.log(checkData); + + // 寰幆鐒跺悗鍒ゆ柇鐩稿尮閰嶇殑鏁版嵁璧嬪�肩粰filteredItems checkData.option.forEach(item => { - if (newPrice == item.value) { + if (this.data.newPrice == item.value) { + + if (this.data.filteredItems.length !== 0) { + this.setData({ + filteredItems: [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� + }); + } + + this.setData({ filteredItems: item.child || [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� }); } }) + + this.setData({ + 'multipleSelect.options': [], + }); + + const singleSelectOptions = [] + console.log(this.data.multipleSelect.options, 'multipleSelect.options'); + console.log(singleSelectOptions, 'singleSelectOptions'); // 鍗曞垪閫夋嫨鍣ㄩ�夐」 - const singleSelectOptions = this.data.filteredItems.map(item => ({ - label: item.name, - value: item.value, - })) + // 鍗曞垪閫夋嫨鍣ㄩ�夐」 + this.data.filteredItems.forEach(item => { + singleSelectOptions.push({ + label: item.name, + value: item.value, + }); + }); + + + + if (singleSelectOptions.length === 0) { + singleSelectOptions.push({ + label: '鏆傛棤鏁版嵁', + + }); + + } + // 鏇存柊鏁版嵁 this.setData({ 'multipleSelect.options': singleSelectOptions, }); + // 鍙栨秷楠ㄦ灦灞� this.setData({ loading: false, hidden: false, }) }) - if (newPrice) { - this.setData({ - keynoteDisabled: false - }) - } - if (!newPrice) { - this.setData({ - keynoteDisabled: true - }) - } + // if (newPrice) { + // this.setData({ + // keynoteDisabled: false + // }) + // } + // if (!newPrice) { + // this.setData({ + // keynoteDisabled: true + // }) + // } }, @@ -369,25 +407,19 @@ // 鎬诲垎绫� onChange(e) { - - - // this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫�� + this.setData({ + 'multipleSelect.options': [], + }); + console.log(this.data.multipleSelect.options); const newValue = e.detail.value; - + console.log(newValue); this.setData({ 'product.value': newValue, - + newValue: newValue }); - - // debugger // let newPrice = '' - - - - if (newValue == 'jsek_bFHigherEducation') { - this.setData({ newPrice: 'jsek_higherEducation' }) @@ -400,22 +432,15 @@ newPrice: 'jsek_teacherEducation' }) } - this.bookExhibitionGet(newValue); + this.keyProjectsGet(this.data.newPrice) - - - - + this.bookExhibitionGet(newValue); if (this.data.keynoteValue) { //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈� this.data.keynoteValue = [] this.bookExhibitionGet(newValue) - } - - - - + this.onLoad() }, // 閲嶇偣椤圭洰 @@ -437,7 +462,6 @@ handleReset(e) { - // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫 this.data.keynoteValue = [] this.bookExhibitionGet() -- Gitblit v1.9.1