| | |
| | | const app = getApp(); |
| | | import { |
| | | loginInfo |
| | | } from '../../../../assets/js/login'; |
| | | Page({ |
| | | /** |
| | | * 页面的初始数据 |
| | |
| | | bookList: [], |
| | | stairList: { |
| | | value: '', |
| | | options: [ |
| | | { |
| | | value: '', |
| | | label: '一级', |
| | | }, |
| | | ], |
| | | options: [{ |
| | | value: '', |
| | | label: '一级', |
| | | }, ], |
| | | }, |
| | | secondList: { |
| | | value: [], |
| | | options: [], |
| | | disabled: false, |
| | | }, |
| | | disabledSecondList: false, |
| | | majorProjectList: { |
| | | value: [], |
| | | options: [], |
| | |
| | | size: '50rpx' |
| | | }, |
| | | loading: false, |
| | | noData: false |
| | | noData: false, |
| | | showDropdown: false, |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | |
| | | Path: options.secondCode, |
| | | Type: '*', |
| | | StoreRefCode: app.config.goodsStore, |
| | | } |
| | | ], |
| | | }], |
| | | }) |
| | | } |
| | | // 获取二级分类 |
| | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | }, |
| | | onReady() {}, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | }, |
| | | onShow() {}, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { }, |
| | | onHide() {}, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { }, |
| | | onUnload() {}, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { }, |
| | | onShareAppMessage() {}, |
| | | goBack() { |
| | | wx.navigateBack(); |
| | | }, |
| | |
| | | size: '30', |
| | | start: '0', |
| | | storeRefCode: app.config.goodsStore, |
| | | sort: { type: 'Asc', field: 'LinkOrder' }, |
| | | sort: { |
| | | type: 'Asc', |
| | | field: 'LinkOrder' |
| | | }, |
| | | }; |
| | | app.MG.store.getStoreChannelList(query).then(async (res) => { |
| | | const options = [ |
| | | { |
| | | value: '', |
| | | label: '一级', |
| | | }, |
| | | ]; |
| | | const options = [{ |
| | | value: '', |
| | | label: '一级', |
| | | }, ]; |
| | | for (let index = 0; index < res.datas.length; index++) { |
| | | const item = res.datas[index]; |
| | | options.push({ |
| | |
| | | size: '30', |
| | | start: '0', |
| | | storeRefCode: app.config.goodsStore, |
| | | sort: { type: 'Asc', field: 'LinkOrder' }, |
| | | sort: { |
| | | type: 'Asc', |
| | | field: 'LinkOrder' |
| | | }, |
| | | }; |
| | | app.MG.store.getStoreChannelList(query).then((res) => { |
| | | for (let index = 0; index < res.datas.length; index++) { |
| | |
| | | subAccess: this.data.pathList, |
| | | }; |
| | | } else { |
| | | pathObj = { |
| | | pathObj = { |
| | | path, |
| | | queryType: '*', |
| | | }; |
| | |
| | | } |
| | | const query = { |
| | | ...pathObj, |
| | | filterList: [ |
| | | { |
| | | value: 'Normal', |
| | | field: 'state', |
| | | }, |
| | | ], |
| | | filterList: [{ |
| | | value: 'Normal', |
| | | field: 'state', |
| | | }, ], |
| | | sort, |
| | | coverSize: { |
| | | height: 145, |
| | | }, |
| | | paging: { |
| | | start: 0, |
| | | size: this.data.pageCount.page * 8, |
| | |
| | | "pageCount.total": res.total, |
| | | loading: false |
| | | }); |
| | | console.log('图书列表', res.datas); |
| | | if (!res.datas.length) { |
| | | this.setData({ |
| | | noData: true |
| | | noData: true, |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | // 一级分类切换 |
| | | onChangeStair(e) { |
| | | const path = e.detail.value.length |
| | | ? `${this.data.assortCheck.code}\\${e.detail.value}` |
| | | : this.data.assortCheck.code; |
| | | const path = e.detail.value.length ? |
| | | `${this.data.assortCheck.code}\\${e.detail.value}` : |
| | | this.data.assortCheck.code; |
| | | console.log(this.data.path); |
| | | this.setData({ |
| | | pathList: [], |
| | | stairCode: e.detail.value, |
| | |
| | | }); |
| | | this.getBookList(path); |
| | | this.getSecondList(path); |
| | | if (e.detail.value == '') { |
| | | this.setData({ |
| | | disabledSecondList: true |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | disabledSecondList: false |
| | | }) |
| | | } |
| | | console.log(this.data.disabledSecondList); |
| | | }, |
| | | // 二级分类切换 |
| | | onChangeSecond(e) { |
| | |
| | | }, |
| | | // 跳转图书详情 |
| | | goDetail(e) { |
| | | const { book } = e.currentTarget.dataset; |
| | | const { |
| | | book |
| | | } = e.currentTarget.dataset; |
| | | wx.navigateTo({ |
| | | url: `/packageBookService/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`, |
| | | }); |
| | | }, |
| | | onRefresh() { |
| | | this.setData({ enable: true }); |
| | | this.setData({ |
| | | enable: true |
| | | }); |
| | | this.getBookList(this.data.path) |
| | | }, |
| | | }); |
| | | openDropdown() { |
| | | console.log('展开哦', ); |
| | | this.setData({ |
| | | showDropdown: true |
| | | }) |
| | | }, |
| | | closeDropdown() { |
| | | console.log('关闭'); |
| | | this.setData({ |
| | | showDropdown: false |
| | | }) |
| | | } |
| | | }); |