| | |
| | | userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) |
| | | }) |
| | | } |
| | | if (wx.getStorageSync("paperBookList")) { |
| | | this.setData({ |
| | | paperBookList: wx.getStorageSync("paperBookList"), |
| | | }) |
| | | } |
| | | if (wx.getStorageSync("electronicBookList")) { |
| | | this.setData({ |
| | | electronicBookList: wx.getStorageSync("electronicBookList"), |
| | | }) |
| | | } |
| | | this.setData({ |
| | | num: this.data.paperBookList.length + this.data.electronicBookList.length |
| | | }) |
| | | this.getBookList(false); |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | if (wx.getStorageSync("paperBookList")) { |
| | | this.setData({ |
| | | paperBookList: wx.getStorageSync("paperBookList"), |
| | | }) |
| | | } |
| | | if (wx.getStorageSync("electronicBookList")) { |
| | | this.setData({ |
| | | electronicBookList: wx.getStorageSync("electronicBookList"), |
| | | }) |
| | | } |
| | | this.setData({ |
| | | num: this.data.paperBookList.length + this.data.electronicBookList.length |
| | | }) |
| | | |
| | | }, |
| | | goBack() { |
| | |
| | | }, |
| | | ], |
| | | sort, |
| | | coverSize: { |
| | | height: 145, |
| | | }, |
| | | paging: { |
| | | start: that.data.page * that.data.limit - that.data.limit, |
| | | size: that.data.limit |
| | |
| | | this.setData({ |
| | | alreadyElectronicBookList: list, |
| | | }); |
| | | this.getBookList(false); |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | this.getBookList(false); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | if (this.data.ebookCount > 0) { |
| | | const eBookData = this.data.electronicBookList |
| | | if (eBookData.length == 2) { |
| | | item.electronChecked = false |
| | | item.electronChecked = false; |
| | | wx.showToast({ |
| | | title: "每次最多只可申请2本样书", |
| | | icon: 'none', |
| | |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: [...this.data.electronicBookList, ...[itemAttr]], |
| | | num: this.data.electronicBookList.length + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", this.data.electronicBookList); |
| | | this.setData({ |
| | | num: this.data.electronicBookList.length + this.data.paperBookList.length |
| | | }) |
| | | this.getBookList(false); |
| | | } else { |
| | | let list = this.data.electronicBookList; |
| | | list.forEach((obj, index) => { |
| | |
| | | num: list.length + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", list); |
| | | this.getBookList(false); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | |
| | | num: 1 + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", [itemAttr]); |
| | | |
| | | } |
| | | } else { |
| | | item.electronChecked = false |
| | |
| | | }) |
| | | this.setData({ |
| | | paperBookList: [...this.data.paperBookList, ...[itemAttr]], |
| | | num: this.data.paperBookList.lenght + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", this.data.paperBookList); |
| | | this.setData({ |
| | | num: this.data.paperBookList.length + this.data.electronicBookList.length |
| | | }) |
| | | |
| | | } else { |
| | | let list = this.data.paperBookList; |
| | | list.forEach((obj, index) => { |
| | |
| | | url: "/packageDomain/pages/sampleBookList/applicationForm/index", |
| | | }); |
| | | }, |
| | | |
| | | // 监听滚动距离 |
| | | onPageScroll(e) { |
| | | if (e && e.scrollTop >= 1000) { |
| | | this.setData({ |
| | | isBackTop: true |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | isBackTop: false |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |