From a9c680d3fcde05afbbca0bb03f95e75027608b22 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期六, 07 九月 2024 15:47:59 +0800 Subject: [PATCH] btn --- pages/digitalCourses/digitalCoursesDetails/index.js | 58 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 44 insertions(+), 14 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index c41e720..3101af1 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -85,6 +85,7 @@ closeBtn: false, deleteBtn: false, bookId: '', + bookPath: '', playerList: [], worksInfo: [], isCertificate: {}, @@ -94,6 +95,7 @@ fullName: '', //鍚嶇О userPicture: '' //鐢宠璇佷功鐢ㄦ埛鍥剧墖 }, + userName: '', pictureMd5: '', publishingUnit: '', pubCertificateHide: true, @@ -101,6 +103,7 @@ rzzsImg: '', //璁よ瘉璇佷功base64 imageWidth: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勫搴� imageHeight: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勯珮搴� + website: 'https://jsek.bnuic.com', }, formatDate(dateString) { if (!dateString) { @@ -152,13 +155,25 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { + let parentPath = options.path.split('\\'); + parentPath.pop(); this.setData({ - bookId: options.id + bookId: options.id, + bookPath: parentPath.join('\\') }) + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.digitalCoursesDetailsGet(options.id) + this.getPlayerList() + this.getType() + } else {} + }) + } this.digitalCoursesDetailsGet(options.id) this.getPlayerList() this.getType() - }, /** @@ -309,9 +324,16 @@ } }) } - this.getAboutBook(res.datas.productLinkInfo[res.datas.productLinkInfo.length - 1].LinkPath) + if (this.data.bookPath) { + this.getAboutBook(this.data.bookPath) + } else { + this.getAboutBook(res.datas.productLinkInfo[res.datas.productLinkInfo.length - 1].LinkPath) + } this.getCertificateList() - res.datas.content = res.datas.content.replace('../', app.config.requestCtx + '/') + res.datas.content = res.datas.content && res.datas.content.replace('../', app.config.requestCtx + '/').replace( + /\<img/gi, + '<img style="max-width:100%;height:auto;display:block;margin-top:0;margin-bottom:0;"' + ) this.setData({ lecturerList: lecturer, digitalsData: res.datas, @@ -506,6 +528,7 @@ i.children = [] this.getTreeList(rootList, pathLength + addNum, i.children, i.productLinkPath, addNum) if (i.children.length == 0) { + newArr[0].istry = true delete i.children } } @@ -619,17 +642,19 @@ } }) .then((res) => { - this.setData({ - relationTextBook: res.datas[0] - }) - if (this.data.relationTextBook.purchasedSaleMethodIdList.includes(this.data.relationTextBook.defaultSaleMethodId)) { + if (res.datas.length > 0) { this.setData({ - isTextBookBuy: true + relationTextBook: res.datas[0] }) - } else { - this.setData({ - isTextBookBuy: false - }) + if (this.data.relationTextBook.purchasedSaleMethodIdList.includes(this.data.relationTextBook.defaultSaleMethodId)) { + this.setData({ + isTextBookBuy: true + }) + } else { + this.setData({ + isTextBookBuy: false + }) + } } }) }, @@ -659,6 +684,12 @@ answertype == "collectQuestion" ? "鎴戠殑鏀惰棌" : "鎴戠殑閿欓" }&answerType=${answertype}&storeInfo=${app.config.digitalCourses}`, }); + }, + + onCorrelationBook(e) { + const item = e.currentTarget.dataset.item; + this.digitalCoursesDetailsGet(item.id) + this.getPlayerList() }, // 鑾峰彇鐩稿叧璇剧▼ @@ -857,7 +888,6 @@ width: that.data.imageWidth, height: that.data.imageHeight, element: 'myCanvas', - background: '#f0f0f0', progress(percent) {}, finish(url) { console.log("鐢熸垚鐨勫浘鐗囧湴鍧�", url) -- Gitblit v1.9.1