From ce3a08b28c16f5cce2185167f8a9030ee16898ed Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期六, 07 九月 2024 14:44:55 +0800 Subject: [PATCH] xiugai --- pages/digitalCourses/digitalCoursesDetails/index.js | 42 ++++++++++++++++++++++++++++++------------ 1 files changed, 30 insertions(+), 12 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index c41e720..b9528d1 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -94,6 +94,7 @@ fullName: '', //鍚嶇О userPicture: '' //鐢宠璇佷功鐢ㄦ埛鍥剧墖 }, + userName: '', pictureMd5: '', publishingUnit: '', pubCertificateHide: true, @@ -101,6 +102,7 @@ rzzsImg: '', //璁よ瘉璇佷功base64 imageWidth: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勫搴� imageHeight: '', //鐢诲湪鐢诲竷涓婄殑鍥剧墖鐨勯珮搴� + website: 'https://jsek.bnuic.com', }, formatDate(dateString) { if (!dateString) { @@ -153,12 +155,25 @@ */ onLoad(options) { this.setData({ - bookId: options.id + bookId: options.id, + userName: wx.getStorageSync(app.config.tokenKey) }) + 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() - + this.setData({ + userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name + }) }, /** @@ -311,7 +326,7 @@ } 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 + '/') this.setData({ lecturerList: lecturer, digitalsData: res.datas, @@ -506,6 +521,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 +635,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 + }) + } } }) }, -- Gitblit v1.9.1