From 7231b5929a66bb1ec3b832be85f5e3f6ce40ad9f Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期五, 15 三月 2024 16:01:52 +0800 Subject: [PATCH] feat: 十大 --- pages/bookExhibitionList/index.js | 140 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 97 insertions(+), 43 deletions(-) diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js index c4d4a70..c1e3eaa 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', @@ -28,7 +29,6 @@ options: [ { value: '*', - label: '鎬诲垎绫�', }, { @@ -49,15 +49,63 @@ price: 'jsek_teacherEducation', label: '鏁欏笀鏁欒偛', }, + ], + }, multipleSelect: { 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, + }); + + }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 @@ -122,6 +170,8 @@ }); this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁 console.log(1111); + + } }, @@ -138,7 +188,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 +202,9 @@ queryType: '*', fields: { jsek_link: [], - 'bookClassification*': this.data.keynoteValue || [] + subtitle: [], + 'bookClassification*': this.data.keynoteValue || [], + ...searchObj }, paging: this.data.page, sort: sort, @@ -157,7 +212,10 @@ // width: 100 // }, }).then(res => { - + res.datas.forEach((item) => { + item.subtitleName = item.subtitle + item.name + }) + console.log(res, 'item'); this.data.total = res.total // list.push(res.datas) @@ -166,6 +224,7 @@ this.setData({ bookExhibitionList: list }) + //鍙栨秷 wx.hideLoading() // console.log(this.data.bookExhibitionList, '鏁版嵁'); @@ -200,41 +259,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 +314,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