| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | value: '', |
| | | keyword: '', |
| | | nameSort: null, |
| | | total: null, |
| | | page: { |
| | |
| | | keynoteValue: null, |
| | | filteredItems: [], |
| | | newValue: null, |
| | | value: '', |
| | | bookExhibitionList: [], |
| | | sorter: { |
| | | value: 'default', |
| | |
| | | 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, |
| | | }); |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | |
| | | 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' |
| | |
| | | queryType: '*', |
| | | fields: { |
| | | jsek_link: [], |
| | | 'bookClassification*': this.data.keynoteValue || [] |
| | | 'bookClassification*': this.data.keynoteValue || [], |
| | | ...searchObj |
| | | }, |
| | | paging: this.data.page, |
| | | sort: sort, |
| | |
| | | this.setData({ |
| | | bookExhibitionList: list |
| | | }) |
| | | |
| | | //取消 |
| | | wx.hideLoading() |
| | | // console.log(this.data.bookExhibitionList, '数据'); |
| | |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | 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, |
| | | }); |
| | | |
| | | }, |
| | | |
| | | |
| | | // 总分类 |
| | |
| | | }, |
| | | 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(); |
| | | }, |
| | | }) |