| | |
| | | options: [], |
| | | disabled: false, |
| | | }, |
| | | disabledSecondList: false, |
| | | majorProjectList: { |
| | | value: [], |
| | | options: [], |
| | | }, |
| | | sortList: { |
| | | value: 'default', |
| | | options: [{ |
| | | value: 'default', |
| | | label: '默认排序', |
| | | }, { |
| | | value: 'name-asc', |
| | | label: '名称正序' |
| | | }, |
| | | { |
| | | value: 'name-desc', |
| | | label: '名称倒叙' |
| | | }, |
| | | { |
| | | value: 'time-asc', |
| | | label: '出版时间正序' |
| | | }, |
| | | { |
| | | value: 'time-desc', |
| | | label: '出版时间倒叙' |
| | | } |
| | | ], |
| | | }, |
| | | newTextBook: { |
| | | value: [], |
| | |
| | | noData: false, |
| | | showDropdown: false, |
| | | isRequesting: false, |
| | | disabledStair: false, |
| | | disabledSecondList: false, |
| | | disabledProject: false, |
| | | disabledNewForms: false, |
| | | triggered: false, |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | console.log('下拉'); |
| | | this.setData({ |
| | | triggered: true |
| | | }) |
| | | this.setData({ |
| | | 'pageCount.page': 1 |
| | | }) |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | |
| | | /** |
| | |
| | | }, |
| | | // 获取一级列表 |
| | | getStairList(path) { |
| | | this.setData({ |
| | | disabledStair: false |
| | | }) |
| | | const query = { |
| | | path, |
| | | filterList: [], |
| | |
| | | 'stairList.options': options, |
| | | 'stairList.value': this.data.stairCode, |
| | | }); |
| | | if (!options.length) { |
| | | this.setData({ |
| | | disabledStair: true |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | // 获取一级分类下二级分类 |
| | |
| | | }, |
| | | // 获取重点项目 |
| | | getProjectList(type) { |
| | | this.setData({ |
| | | disabledProject: false, |
| | | disabledNewForms: false |
| | | }) |
| | | const options = []; |
| | | const arr = []; |
| | | let array = []; |
| | |
| | | label: element.name, |
| | | }); |
| | | } |
| | | if (!options.length) { |
| | | this.setData({ |
| | | disabledProject: true |
| | | }) |
| | | } |
| | | this.setData({ |
| | | 'majorProjectList.options': options, |
| | | }); |
| | |
| | | value: element.value, |
| | | label: element.name, |
| | | }); |
| | | } |
| | | if (!options.length) { |
| | | this.setData({ |
| | | disabledNewForms: true |
| | | }) |
| | | } |
| | | this.setData({ |
| | | 'newTextBook.options': options, |
| | |
| | | queryType: '*', |
| | | }; |
| | | } |
| | | if (this.data.sort) { |
| | | if (this.data.sortList.value == 'name-asc') { |
| | | sort = { |
| | | Name: this.data.sort, |
| | | BaseType: '', |
| | | }; |
| | | } else { |
| | | Name: 'Asc', |
| | | BaseType: '' |
| | | } |
| | | } else if (this.data.sortList.value == 'name-desc') { |
| | | sort = { |
| | | type: 'Desc', |
| | | field: 'ViewCount', |
| | | }; |
| | | Name: 'Desc', |
| | | BaseType: '' |
| | | } |
| | | } else if (this.data.sortList.value == 'time-asc') { |
| | | sort = { |
| | | PublicationDate: 'Asc', |
| | | BaseType: 'DateTime' |
| | | } |
| | | } else if (this.data.sortList.value == 'time-desc') { |
| | | debugger |
| | | sort = { |
| | | PublicationDate: 'Desc', |
| | | BaseType: 'DateTime' |
| | | } |
| | | } else if (this.data.sortList.value == 'default') { |
| | | sort = { |
| | | field: 'order', |
| | | type: 'Desc' |
| | | } |
| | | } |
| | | // if (this.data.sort) { |
| | | // sort = { |
| | | // Name: this.data.sort, |
| | | // BaseType: '', |
| | | // }; |
| | | // } else { |
| | | // sort = { |
| | | // type: 'Desc', |
| | | // field: 'ViewCount', |
| | | // }; |
| | | // } |
| | | // 搜索 |
| | | let searchObj = {}; |
| | | if (this.data.searchValue) { |
| | |
| | | disabledSecondList: false |
| | | }) |
| | | } |
| | | } |
| | | if (this.data.triggered) { |
| | | this.setData({ |
| | | triggered: false |
| | | }) |
| | | wx.showToast({ |
| | | title: '刷新成功', |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }); |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | changeNewText(e) { |
| | | // 排序切换 |
| | | onSortChange(e) { |
| | | this.setData({ |
| | | 'newTextBook.value': e.detail.value, |
| | | }); |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | resetNewText() { |
| | | this.setData({ |
| | | 'newTextBook.value': [], |
| | | }); |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | // 排序按钮 |
| | | sortClick() { |
| | | if (!this.data.sort.length) { |
| | | this.setData({ |
| | | sort: 'Desc', |
| | | }); |
| | | } else if (this.data.sort == 'Desc') { |
| | | this.setData({ |
| | | sort: 'Asc', |
| | | }); |
| | | } else if (this.data.sort == 'Asc') { |
| | | this.setData({ |
| | | sort: '', |
| | | }); |
| | | } |
| | | 'sortList.value': e.detail.value |
| | | }) |
| | | |
| | | let path; |
| | | if (this.data.secondCode) { |
| | | path = this.data.secondCode; |
| | |
| | | }); |
| | | this.getBookList(path); |
| | | }, |
| | | changeNewText(e) { |
| | | this.setData({ |
| | | 'newTextBook.value': e.detail.value, |
| | | }); |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | resetNewText() { |
| | | this.setData({ |
| | | 'newTextBook.value': [], |
| | | }); |
| | | this.getBookList(this.data.path); |
| | | }, |
| | | // 排序按钮 |
| | | // sortClick() { |
| | | // if (!this.data.sort.length) { |
| | | // this.setData({ |
| | | // sort: 'Desc', |
| | | // }); |
| | | // } else if (this.data.sort == 'Desc') { |
| | | // this.setData({ |
| | | // sort: 'Asc', |
| | | // }); |
| | | // } else if (this.data.sort == 'Asc') { |
| | | // this.setData({ |
| | | // sort: '', |
| | | // }); |
| | | // } |
| | | // let path; |
| | | // if (this.data.secondCode) { |
| | | // path = this.data.secondCode; |
| | | // } else if (this.data.stairCode) { |
| | | // path = `${this.data.assortCheck.code}\\${this.data.stairCode}`; |
| | | // } else { |
| | | // path = this.data.assortCheck.code; |
| | | // } |
| | | // this.setData({ |
| | | // path: path, |
| | | // }); |
| | | // this.getBookList(path); |
| | | // }, |
| | | // 搜索图书 |
| | | searchBook(e) { |
| | | console.log(e.detail.value); |