| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | loading: true, |
| | | hidden: true, |
| | | totalSize: '', |
| | | start: 0, |
| | | isMore: null, |
| | | keynoteDisabled: true, |
| | | value: '', |
| | | keyword: '', |
| | | nameSort: null, |
| | |
| | | }, |
| | | product: { |
| | | value: '*', |
| | | |
| | | options: [ |
| | | { |
| | | options: [{ |
| | | value: '*', |
| | | label: '总分类', |
| | | }, |
| | |
| | | price: 'jsek_teacherEducation', |
| | | label: '教师教育', |
| | | }, |
| | | |
| | | ], |
| | | |
| | | }, |
| | | multipleSelect: { |
| | | value: [], |
| | |
| | | navBarHeight: '', |
| | | barHeight: '', |
| | | windowHeight: '', |
| | | sorter: { |
| | | value: 'timeAsc', |
| | | options: [{ |
| | | value: 'nameAsc', |
| | | label: '名称正序', |
| | | }, |
| | | { |
| | | value: 'nameDesc', |
| | | label: '名称倒序', |
| | | }, |
| | | { |
| | | value: 'timeAsc', |
| | | label: '出版时间正序', |
| | | }, |
| | | { |
| | | value: 'timeDesc', |
| | | label: '出版时间倒序', |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | // 获取屏幕高度 |
| | | wx.getSystemInfo({ |
| | | success: function (res) { |
| | | // this.setData({ |
| | | // windowHeight: res.windowHeight |
| | | // }) |
| | | |
| | | // 获取节点的类名 |
| | | var query = wx.createSelectorQuery(); |
| | | query.select('.assembleContent').boundingClientRect(); |
| | | query.exec(function (res) { |
| | | |
| | | console.log(res, 'res'); |
| | | let node = res[0]; |
| | | node.setStyle({ |
| | | backgroundColor: '#0256b9', |
| | | }) |
| | | // // 修改节点样式 |
| | | // if (node) { |
| | | // node.setStyle({ |
| | | // backgroundColor: 'red', |
| | | // color: 'white' |
| | | // }); |
| | | // } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | console.log(this.data.keynoteDisabled, 'keynoteDisabled'); |
| | | // console.log(this.data.filteredItems, 88888); |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | |
| | | |
| | | if (this.data.filteredItems = []) { |
| | | console.log(11111); |
| | | singleSelectOptions.push({ |
| | | label: '禁用选项', |
| | | value: 'disabled', |
| | | disabled: true, |
| | | }); |
| | | // singleSelectOptions.push({ |
| | | // label: '暂无数据', |
| | | // value: 'disabled', |
| | | // disabled: true, |
| | | // }); |
| | | } else { |
| | | console.log(7889); |
| | | } |
| | | |
| | | // singleSelectOptions.push({ |
| | | // label: '禁用选项', |
| | | // value: 'disabled', |
| | | // disabled: true, |
| | | // }); |
| | | |
| | | |
| | | |
| | | |
| | | console.log(this.data.bookExhibitionList.length, 'this.data.bookExhibitionList.length'); |
| | | // 更新数据 |
| | | this.setData({ |
| | | 'multipleSelect.options': singleSelectOptions, |
| | | }); |
| | | |
| | | |
| | | // |
| | | }, |
| | | |
| | | /** |
| | |
| | | */ |
| | | onShow() { |
| | | this.bookExhibitionGet() |
| | | |
| | | this.keyProjectsGet() |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.data.page.size = 16 //更改显示的值 |
| | | this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | // onPullDownRefresh() { |
| | | // this.data.page.size = 16 //更改显示的值 |
| | | // this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | // }, |
| | | |
| | | 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, |
| | | start: this.data.start + 1 |
| | | }) |
| | | this.bookExhibitionGet() |
| | | } else { |
| | | this.setData({ |
| | | isMore: true, |
| | | }) |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | isMore: false |
| | | }) |
| | | console.log('300'); |
| | | }, 300) |
| | | } |
| | | }, |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | |
| | | // 'page.start': currentPage, |
| | | 'page.size': newSize |
| | | }); |
| | | this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | // this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | |
| | | |
| | | |
| | |
| | | '||subtitle*': this.data.keyword |
| | | } |
| | | // console.log(this.data.keynoteValue); |
| | | let sort = { |
| | | Name: this.data.nameSort || 'Desc' |
| | | } |
| | | let sort = {}; |
| | | |
| | | const sortOptions = { |
| | | '*': { |
| | | CreateDate: 'Asc' |
| | | }, |
| | | 'nameAsc': { |
| | | Name: 'Asc' |
| | | }, |
| | | 'nameDesc': { |
| | | Name: 'Desc' |
| | | }, |
| | | 'timeAsc': { |
| | | CreateDate: 'Asc' |
| | | }, |
| | | 'timeDesc': { |
| | | CreateDate: 'Desc' |
| | | } |
| | | }; |
| | | |
| | | sort = sortOptions[this.data.product.value] || {}; |
| | | |
| | | console.log(sort); |
| | | |
| | | app.MG.store.getProductList({ |
| | | storeInfo: 'jsek_bookFair', |
| | | path: newValue, |
| | |
| | | 'bookClassification*': this.data.keynoteValue || [], |
| | | ...searchObj |
| | | }, |
| | | paging: this.data.page, |
| | | paging: { |
| | | start: '0', |
| | | size: this.data.start * 10 |
| | | }, |
| | | sort: sort, |
| | | // coverSize: { |
| | | // width: 100 |
| | | // }, |
| | | }).then(res => { |
| | | res.datas.forEach((item) => { |
| | | if (item.subtitle == undefined) { |
| | | item.subtitle = '' |
| | | } |
| | | item.subtitleName = item.subtitle + item.name |
| | | }) |
| | | console.log(res, 'item'); |
| | | this.data.total = res.total |
| | | |
| | | // list.push(res.datas) |
| | | const list = [...res.datas] |
| | | // list.push(res.datas) |
| | | console.log(res.datas.length); |
| | | |
| | | |
| | | if (res.datas.length == 0) { |
| | | this.setData({ |
| | | keynoteDisabled: true |
| | | }) |
| | | } |
| | | |
| | | const list = [...res.datas] |
| | | console.log(res); |
| | | this.setData({ |
| | | bookExhibitionList: list |
| | | bookExhibitionList: list, |
| | | totalSize: res.total |
| | | }) |
| | | // 判断数据长度 |
| | | console.log(list.length, 'list.length'); |
| | | |
| | | |
| | | //取消 |
| | | wx.hideLoading() |
| | | // console.log(this.data.bookExhibitionList, '数据'); |
| | | |
| | | this.setData({ |
| | | loading: false, |
| | | hidden: false, |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | //重点项目接口 |
| | | 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) |
| | | |
| | | |
| | | checkData.option.forEach(item => { |
| | | if (newPrice == item.value) { |
| | | |
| | | this.setData({ |
| | | filteredItems: item.child || [] // 如果存在子项则赋值,否则赋值为空数组 |
| | | }); |
| | | |
| | | // console.log(this.data.filteredItems); |
| | | |
| | | } |
| | | }) |
| | | |
| | | this.onLoad(); |
| | | |
| | | 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 |
| | | }) |
| | | } |
| | | if (!newPrice) { |
| | | this.setData({ |
| | | keynoteDisabled: true |
| | | }) |
| | | } |
| | | console.log(newValue); |
| | | this.setData({ |
| | | 'product.value': newValue, |
| | | 'product.price': newPrice, // 将选中的 price 值保存在数据中 |
| | |
| | | if (this.data.keynoteValue) { |
| | | //如果有数据就清空并刷新页面 |
| | | this.data.keynoteValue = [] |
| | | |
| | | this.bookExhibitionGet(newValue) |
| | | this.onLoad() |
| | | console.log('true'); |
| | | } else { |
| | | // this.bookExhibitionGet(newValue); |
| | | // this.keyProjectsGet(newPrice); |
| | | console.log('fals'); |
| | | } |
| | | // e.stopImmediatePropagation() |
| | | |
| | | }, |
| | | |
| | |
| | | }); |
| | | }, |
| | | handleConfirm(event) { |
| | | const { value } = event.detail; |
| | | const { |
| | | value |
| | | } = event.detail; |
| | | // 确认操作的处理逻辑 |
| | | |
| | | console.log('确认操作,选中的值为:', value); |
| | | this.data.keynoteValue = value |
| | | this.bookExhibitionGet() |
| | | }, |
| | | handleReset() { |
| | | |
| | | |
| | | handleReset(e) { |
| | | |
| | | // 重置操作的处理逻辑 |
| | | this.data.keynoteValue = [] |
| | | console.log('重置操作'); |
| | | this.bookExhibitionGet() |
| | | }, |
| | | onSwapRight() { |
| | | // console.log('xxxxxx'); |
| | | // this.data.nameSort = 'Asc' |
| | | |
| | | |
| | | if (!this.data.nameSort) { |
| | | this.setData({ |
| | | nameSort: 'Desc', |
| | |
| | | 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参数 |
| | | }); |
| | | }, |
| | | |
| | | // 搜索框 |
| | | onSearchSubmit(e) { |
| | | this.setData({ |
| | |
| | | goBack() { |
| | | wx.navigateBack(); |
| | | }, |
| | | onSort(e) { |
| | | this.setData({ |
| | | 'product.value': e.detail.value, |
| | | }); |
| | | console.log(e.detail.value, 'e.detail.value'); |
| | | this.bookExhibitionGet() |
| | | }, |
| | | onOpend() { |
| | | console.log(7555); |
| | | } |
| | | }) |