| | |
| | | // 获取申请次数 |
| | | that.getSelectPaperBookCount() |
| | | that.getSelectBookCount() |
| | | |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | num: paperBookList + electronicBookList |
| | | }) |
| | | } |
| | | that.getBookList(false) |
| | | }, |
| | | |
| | | /** |
| | |
| | | */ |
| | | onShow() { |
| | | let that = this; |
| | | that.setData({ |
| | | page: 1, |
| | | paperBookList: [], |
| | | electronicBookList: [] |
| | | }) |
| | | // that.setData({ |
| | | // page: 1, |
| | | // paperBookList: [], |
| | | // electronicBookList: [] |
| | | // }) |
| | | that.getAlreadyPBookList() |
| | | that.getAlreadyEBookList() |
| | | // 获取申请次数 |
| | |
| | | num: Number(that.data.paperBookList.length) + Number(that.data.electronicBookList.length) |
| | | }) |
| | | } |
| | | that.getBookList(false); |
| | | // that.getBookList(false); |
| | | that.dataRebuild(that.data.bookList) |
| | | }, |
| | | onHide() { |
| | | const query = wx.createSelectorQuery() |
| | |
| | | app.MG.store.getProductList(query).then((res) => { |
| | | try { |
| | | if (res.datas.length > 0) { |
| | | res.datas.forEach((item) => { |
| | | let list = this.dataRebuild(res.datas); |
| | | //触底加载新数据并保留老数据 |
| | | if (isReachBottom) { |
| | | list = [...this.data.bookList, ...list] //将新数据加入老数据中 |
| | | } |
| | | that.setData({ |
| | | bookList: list, |
| | | pageTotalCount: res.total, |
| | | bottomLoading: false, |
| | | isMoreData: list.length > 0 ? false : true, |
| | | skeletonLoding: false, |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | skeletonLoding: false, |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | }); |
| | | }, |
| | | dataRebuild(list) { |
| | | let that = this; |
| | | console.log(list, 123) |
| | | list.forEach((item) => { |
| | | item.paperDisabled = false |
| | | item.paperChecked = false |
| | | item.electronDisabled = false |
| | |
| | | } |
| | | } |
| | | }); |
| | | let list = res.datas; |
| | | //触底加载新数据并保留老数据 |
| | | if (isReachBottom) { |
| | | list = [...this.data.bookList, ...list] //将新数据加入老数据中 |
| | | } |
| | | that.setData({ |
| | | bookList: list, |
| | | pageTotalCount: res.total, |
| | | bottomLoading: false, |
| | | isMoreData: list.length > 0 ? false : true, |
| | | skeletonLoding: false, |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | skeletonLoding: false, |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | }); |
| | | return list |
| | | }, |
| | | |
| | | |
| | | //高级分类选择 |
| | | onChangeIcon(e) { |
| | | this.setData({ |
| | |
| | | this.setData({ |
| | | alreadyElectronicBookList: list, |
| | | }); |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | this.getBookList(false); |
| | | } |
| | | } |
| | | }) |
| | | }, |