| | |
| | | author: [], |
| | | isbn: [], |
| | | publicationDate: [], |
| | | pdf: [], |
| | | protectedEpub: [], |
| | | isApplyBook: [], |
| | | 'isApplyBook>': ['1'], |
| | | ...searchObj, |
| | |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | bookList: [], |
| | | pageTotalCount: 0, |
| | | bottomLoading: false, |
| | | skeletonLoding: false, |
| | | loading: false |
| | | }) |
| | |
| | | }, |
| | | |
| | | //选择电子样书 |
| | | onChangeElectron(e) { |
| | | async onChangeElectron(e) { |
| | | const item = e.currentTarget.dataset.book; |
| | | console.log(item) |
| | | const index = this.data.bookList.findIndex(citem => citem.id == item.id) |
| | | let role = this.data.userInfo != null ? this.data.userInfo.role : null |
| | | if (role && role == 'Teacher') { |
| | | // 是教师 |
| | | if (e.detail.checked) { |
| | | // 点击选中 |
| | | //商品有无电子书 |
| | | const obj = { |
| | | path: '*', |
| | | queryType: 'SubProduct', |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | }, |
| | | paging: { |
| | | start: 0, |
| | | size: 1 |
| | | }, |
| | | mainProductId: item.id, |
| | | fields: { |
| | | bookshelf_pdf: [], |
| | | bookshelf_protectedEpub: [], |
| | | } |
| | | } |
| | | const res = await app.MG.store.getProductList(obj) |
| | | if (res.datas.length > 0) { |
| | | if (!res.datas[0].bookshelf_pdf && !res.datas[0].bookshelf_protectedEpub) { |
| | | wx.showToast({ |
| | | title: "暂无电子书文件,请联系管理员!", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | } else { |
| | | if (!item.pdf && !item.protectedEpub) { |
| | | wx.showToast({ |
| | | title: "暂无电子书文件,请联系管理员!", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //申请次数 |
| | | if (this.data.ebookCount == 0) { |
| | | wx.showToast({ |
| | | title: "您的电子样书申请次数已用尽,若要继续,请联系管理员!", |