From 960c49a8b3ac11dff27cad71137f986f90f00923 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 26 四月 2024 19:16:32 +0800 Subject: [PATCH] 样书申请、详情页资源显示bug修改 --- packageDomain/pages/sampleBookList/index.js | 64 +++++++++++++++++++++++++++---- 1 files changed, 55 insertions(+), 9 deletions(-) diff --git a/packageDomain/pages/sampleBookList/index.js b/packageDomain/pages/sampleBookList/index.js index 4264802..2eafd72 100644 --- a/packageDomain/pages/sampleBookList/index.js +++ b/packageDomain/pages/sampleBookList/index.js @@ -152,14 +152,17 @@ // 鑾峰彇鐢宠娆℃暟 that.getSelectPaperBookCount() that.getSelectBookCount() - } }) } else { that.setData({ userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) }) - + const paperBookList = wx.getStorageSync('paperBookList') ? JSON.parse(wx.getStorageSync('paperBookList')).length : 0 + const electronicBookList = wx.getStorageSync('electronicBookList') ? JSON.parse(wx.getStorageSync('electronicBookList')).length : 0 + this.setData({ + num: paperBookList + electronicBookList + }) } }, @@ -422,6 +425,8 @@ author: [], isbn: [], publicationDate: [], + pdf: [], + protectedEpub: [], isApplyBook: [], 'isApplyBook>': ['1'], ...searchObj, @@ -507,11 +512,14 @@ //楂樼骇鍒嗙被閫夋嫨 onChangeIcon(e) { this.setData({ + skeletonLoding: true, + bookList: [], 'assortCheck.code': e.detail.value, stairCode: '', secondCode: '', path: `${e.detail.value}`, 'iconList.value': e.detail.value, + }); this.getBookList(false); this.getStairList(this.data.assortCheck.code); @@ -523,17 +531,20 @@ `${this.data.assortCheck.code}\\${e.detail.value}` : this.data.assortCheck.code; this.setData({ + skeletonLoding: true, + bookList: [], pathList: [], stairCode: e.detail.value, secondCode: '', path: path, 'stairList.value': e.detail.value, + 'secondList.value': "" }); this.getBookList(false); this.getSecondList(path); }, - // 浜岀骇鍒嗙被鍒囨崲 - onChangeSecond(e) { + // 浜岀骇鍒嗙被鍒囨崲 + onConfirmSecond(e) { const pathList = []; for (let index = 0; index < e.detail.value.length; index++) { const element = e.detail.value[index]; @@ -544,13 +555,10 @@ }); } this.setData({ + skeletonLoding: true, pathList: pathList, 'secondList.value': e.detail.value, }); - - }, - // - onConfirmSecond() { this.getBookList(false); }, onResetSecond() { @@ -779,7 +787,7 @@ }, //閫夋嫨鐢靛瓙鏍蜂功 - onChangeElectron(e) { + async onChangeElectron(e) { const item = e.currentTarget.dataset.book; const index = this.data.bookList.findIndex(citem => citem.id == item.id) let role = this.data.userInfo != null ? this.data.userInfo.role : null @@ -787,6 +795,44 @@ // 鏄暀甯� 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: "鎮ㄧ殑鐢靛瓙鏍蜂功鐢宠娆℃暟宸茬敤灏斤紝鑻ヨ缁х画锛岃鑱旂郴绠$悊鍛橈紒", -- Gitblit v1.9.1