| | |
| | | electronicBookList: [], //样书单电子书 |
| | | paperBookCount: 0, //纸质书剩余次数 |
| | | ebookCount: 0, //电子书剩余次数 |
| | | num: 0, |
| | | }, |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | this.getIconTypeList(); |
| | | this.getBookList(false); |
| | | |
| | | // 获取重点项目 |
| | | this.getProjectList('bookClassification'); |
| | | //新形态教材 |
| | |
| | | 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.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() { |
| | |
| | | this.setData({ |
| | | 'newTextBook.options': options, |
| | | }); |
| | | console.log('重点项目', this.data.newTextBook); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | ], |
| | | sort, |
| | | coverSize: { |
| | | height: 145, |
| | | }, |
| | | paging: { |
| | | start: that.data.page * that.data.limit - that.data.limit, |
| | | size: that.data.limit |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (that.data.alreadyElectronicBookList.length > 0) { |
| | | that.data.alreadyElectronicBookList.forEach((eBook) => { |
| | | eBook.content.forEach((eBookItem) => { |
| | |
| | | }, |
| | | // 搜索图书 |
| | | searchBook(e) { |
| | | console.log(e.detail.value); |
| | | this.setData({ |
| | | searchValue: e.detail.value, |
| | | }); |
| | |
| | | } |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | let list = []; |
| | | res.datas.map((item) => { |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | } |
| | | list.push(item) |
| | | }) |
| | | this.setData({ |
| | | alreadyPaperBookList: res.datas, |
| | | alreadyPaperBookList: list, |
| | | }); |
| | | }) |
| | | }, |
| | |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | let list = [] |
| | | res.datas.map((item) => { |
| | | if (item.feedBack) { |
| | | item.feedBack = JSON.parse(item.feedBack) |
| | | if (item.feedBack.endDate) { |
| | | let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime() |
| | | let currentDate = new Date().getTime() |
| | | if (times < currentDate) { |
| | | item.isExpiry = true |
| | | if (res.datas.length > 0) { |
| | | res.datas.map((item) => { |
| | | if (item.feedBack) { |
| | | item.feedBack = JSON.parse(item.feedBack) |
| | | if (item.feedBack.endDate) { |
| | | let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime() |
| | | let currentDate = new Date().getTime() |
| | | if (times < currentDate) { |
| | | item.isExpiry = true |
| | | } |
| | | } |
| | | } |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | } |
| | | if (item.state != 'Reject') { |
| | | list.push(item) |
| | | } |
| | | }) |
| | | this.setData({ |
| | | alreadyElectronicBookList: list, |
| | | }); |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | this.getBookList(false); |
| | | } |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | } |
| | | if (item.state != 'Reject') { |
| | | list.push(item) |
| | | } |
| | | }) |
| | | this.setData({ |
| | | alreadyElectronicBookList: list, |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | |
| | |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (item.paperChecked) { |
| | | if (this.data.paperBookList.length > 0) { |
| | | this.data.paperBookList.forEach((obj, index) => { |
| | | let pList = this.data.paperBookList; |
| | | if (pList.length > 0) { |
| | | pList.forEach((obj, index) => { |
| | | if (obj.id == item.id) { |
| | | this.data.paperBookList.splice(index, 1); |
| | | pList.splice(index, 1); |
| | | } |
| | | }) |
| | | } |
| | |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); |
| | | this.setData({ |
| | | paperBookList: pList, |
| | | num: pList.length + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", JSON.stringify(pList)); |
| | | return |
| | | } |
| | | if (role == 'Teacher') { |
| | |
| | | return |
| | | } |
| | | if (item.electronChecked) { |
| | | if (this.data.electronicBookList) { |
| | | this.data.electronicBookList.forEach((obj, index) => { |
| | | let eList = this.data.electronicBookList; |
| | | if (eList.length > 0) { |
| | | eList.forEach((obj, index) => { |
| | | if (obj.id == item.id) { |
| | | this.data.electronicBookList.splice(index, 1); |
| | | eList.splice(index, 1); |
| | | } |
| | | }) |
| | | } |
| | |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); |
| | | this.setData({ |
| | | electronicBookList: eList, |
| | | num: eList.length + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", eList); |
| | | return |
| | | } |
| | | if (role == 'Teacher') { |
| | |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.electronChecked = false |
| | | } |
| | | }, |
| | | getSelectBookCount(item) { |
| | |
| | | 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', |
| | |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: [...this.data.electronicBookList, ...[item]] |
| | | electronicBookList: [...this.data.electronicBookList, ...[itemAttr]], |
| | | }) |
| | | wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); |
| | | 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) => { |
| | | if (obj.id == item.id) { |
| | | list.splice(index, 1); |
| | | } |
| | | }) |
| | | item.electronChecked = false |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | title: "已从样书申请单移除", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: list, |
| | | num: list.length + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", list); |
| | | this.getBookList(false); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: [...this.data.electronicBookList, ...[item]] |
| | | electronicBookList: [itemAttr], |
| | | num: 1 + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList)); |
| | | wx.setStorageSync("electronicBookList", [itemAttr]); |
| | | |
| | | } |
| | | } else { |
| | | item.electronChecked = false |
| | |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | paperBookList: [...this.data.paperBookList, ...[item]] |
| | | paperBookList: [...this.data.paperBookList, ...[itemAttr]], |
| | | }) |
| | | wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); |
| | | console.log(this.data.paperBookList, "3") |
| | | 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) => { |
| | | if (obj.id == item.id) { |
| | | list.splice(index, 1); |
| | | } |
| | | }) |
| | | item.paperChecked = false |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | icon: 'none', |
| | | title: "已从样书申请单移除", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | paperChecked: list, |
| | | num: list.length + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", list); |
| | | } |
| | | } else { |
| | | item.paperChecked = true; |
| | |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | paperBookList: [item] |
| | | paperBookList: [itemAttr], |
| | | num: 1 + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList)); |
| | | console.log(this.data.paperBookList, "4") |
| | | wx.setStorageSync("paperBookList", [itemAttr]); |
| | | } |
| | | } else { |
| | | item.paperChecked = false |
| | |
| | | url: "/packageDomain/pages/sampleBookList/applicationForm/index", |
| | | }); |
| | | }, |
| | | |
| | | // 监听滚动距离 |
| | | onPageScroll(e) { |
| | | if (e && e.scrollTop >= 1000) { |
| | | this.setData({ |
| | | isBackTop: true |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | isBackTop: false |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |