From 558845242a07b68f42fa1802c45ab2769395d8b8 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 29 四月 2024 14:31:30 +0800 Subject: [PATCH] 合并代码 --- pages/bookExhibitionList/index.js | 138 +++++++++++++++++++++++++--------------------- 1 files changed, 75 insertions(+), 63 deletions(-) diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js index 7064469..cdbed47 100644 --- a/pages/bookExhibitionList/index.js +++ b/pages/bookExhibitionList/index.js @@ -78,6 +78,7 @@ }, ], }, + newValue: '' }, @@ -99,12 +100,12 @@ }) - 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鍙樺寲浜�" + // }, 500) + // console.log(11111); }, watch: { name: function (newVal, oldVal) { @@ -126,12 +127,8 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - // debugger this.bookExhibitionGet() - - // this.keyProjectsGet(this.data.newPrice) - - + this.keyProjectsGet(this.data.newPrice) }, /** @@ -187,7 +184,6 @@ onReachBottom() { if (this.data.page.size >= this.data.total) { - Toast({ context: this, selector: '#t-toast', @@ -197,10 +193,6 @@ preventScrollThrough: true, icon: 'poweroff', }); - - - - } else { // const currentPage = this.data.page.start + 1; // 鑾峰彇褰撳墠椤垫暟骞跺姞1 const newSize = this.data.page.size + 10; // 鍘熸潵鐨勫熀纭�涓婂姞10 @@ -209,9 +201,6 @@ 'page.size': newSize }); // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 - - - } }, @@ -259,7 +248,7 @@ app.MG.store.getProductList({ storeInfo: 'jsek_bookFair', - path: newValue, + path: this.data.newValue, queryType: '*', fields: { jsek_link: [], @@ -318,48 +307,81 @@ //閲嶇偣椤圭洰鎺ュ彛 keyProjectsGet(newPrice) { this.setData({ + filteredItems: [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� + }); + + //楠ㄦ灦灞� + 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) { + + + this.setData({ filteredItems: item.child || [] // 濡傛灉瀛樺湪瀛愰」鍒欒祴鍊硷紝鍚﹀垯璧嬪�间负绌烘暟缁� }); } }) + + let 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 + // }) + // } }, @@ -371,50 +393,41 @@ - // this.data.page.size = 16 //鏇存敼鏄剧ず鐨勫�� const newValue = e.detail.value; this.setData({ 'product.value': newValue, - + newValue: newValue }); - - // debugger - // let newPrice = '' - - - - + let newPrice = '' if (newValue == 'jsek_bFHigherEducation') { - - this.setData({ - newPrice: 'jsek_higherEducation' - }) + newPrice = 'jsek_higherEducation' + // this.setData({ + // newPrice: 'jsek_higherEducation' + // }) } else if (newValue == 'jsek_bFVocationalEducation') { - this.setData({ - newPrice: 'jsek_vocationalEducation' - }) + // this.setData({ + // newPrice: 'jsek_vocationalEducation' + // }) + newPrice = 'jsek_vocationalEducation' } else if (newValue == 'jsek_bFTeacherEducation') { - this.setData({ - newPrice: 'jsek_teacherEducation' - }) + // this.setData({ + // newPrice: 'jsek_teacherEducation' + // }) + newPrice = 'jsek_teacherEducation' + } else { + newPrice = '' } + + this.keyProjectsGet(newPrice) this.bookExhibitionGet(newValue); - this.keyProjectsGet(this.data.newPrice) - - - - if (this.data.keynoteValue) { //濡傛灉鏈夋暟鎹氨娓呯┖骞跺埛鏂伴〉闈� this.data.keynoteValue = [] this.bookExhibitionGet(newValue) - } - - - + this.onLoad() }, @@ -437,7 +450,6 @@ handleReset(e) { - // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫 this.data.keynoteValue = [] this.bookExhibitionGet() -- Gitblit v1.9.1