From c3086cda662e2b908cf96b6b3ff599713eb924d6 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期一, 02 九月 2024 16:59:16 +0800 Subject: [PATCH] gongneng --- pages/digitalCourses/digitalCoursesDetails/index.js | 81 +++++++++++++++++++++++++++++++--------- 1 files changed, 63 insertions(+), 18 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index 5f2bd6e..766d579 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -60,7 +60,8 @@ testResourceIocn: { name: "/static/images/digitalTextbooks/link-t@3x.png", }, - + relationTextBook: null, + isTextBookBuy: false, dialogBox: false, lecturerList: [], selectActive: 'learn', @@ -349,6 +350,7 @@ console.log(this.data.tabValue); if (this.data.tabValue == 2) { this.getResource() + this.getRelationBook() } if (this.data.tabValue == 3) { this.selectComponent("#note").getNoteList(); @@ -579,7 +581,50 @@ } }, - // 鑾峰彇鐩稿叧鏁欐潗 + //鑾峰彇鍏宠仈瀛愬晢鍝�/鏁板瓧鏁欐潗 + getRelationBook() { + app.MG.store.getProductList({ + path: '*', + storeInfo: app.config.digitalCourses, + mainProductId: this.data.digitalsData.id, + queryType: 'Related', // 鏌ヨ绫诲瀷锛� Related锛氭煡璇㈠叧鑱斿晢鍝侊紱SubProduct: 鏌ヨ瀛愬晢鍝侊紱 + paging: { + start: 0, + size: 1 + }, + fields: { + author: [], + publicationDate: [], + isbn: [], + content: [], + Creator: [], + probationPage: [] + } + }) + .then((res) => { + this.setData({ + relationTextBook: res.datas[0] + }) + if (this.data.relationTextBook.purchasedSaleMethodIdList.includes(this.data.relationTextBook.defaultSaleMethodId)) { + this.setData({ + isTextBookBuy: true + }) + } else { + this.setData({ + isTextBookBuy: false + }) + } + console.log(this.data.relationTextBook, "jc") + }) + }, + + readTextBook() { + wx.navigateTo({ + url: '/pages/digitalCourses/digitalCoursesDetails/components/digitalRead/index?refCode=' + this.data.relationTextBook.refCode + '&tryPageCount=' + this.data.relationTextBook.probationPage + '&isTextBookBuy=' + this.data.isTextBookBuy + }) + }, + + // 鑾峰彇鐩稿叧璇剧▼ getAboutBook(path) { let query = { path, @@ -800,14 +845,14 @@ onCertificate() { - // if (!this.data.isBuy) { - // wx.showToast({ - // title: "璇峰厛璐拱锛屼綋楠屽畬鏁存湇鍔�", - // icon: "none", - // duration: 1000, - // }); - // return false - // } + if (!this.data.isBuy) { + wx.showToast({ + title: "璇峰厛璐拱锛屼綋楠屽畬鏁存湇鍔�", + icon: "none", + duration: 1000, + }); + return false + } // if (!this.data.isLearn) { // wx.showToast({ // title: "鎮ㄧ殑瀛︿範浠诲姟杩樻湭瀹屾垚锛屾殏涓嶈兘鐢宠璇佷功锛屽姞娌瑰摝锛�", @@ -816,14 +861,14 @@ // }); // return false // } - // if (this.data.isCertificate && this.data.isCertificate.state == 'WaitAudit') { - // wx.showToast({ - // title: "鎮ㄧ敵璇风殑璇佷功姝e湪瀹℃牳涓�", - // icon: "none", - // duration: 1000, - // }); - // return false - // } + if (this.data.isCertificate && this.data.isCertificate.state == 'WaitAudit') { + wx.showToast({ + title: "鎮ㄧ敵璇风殑璇佷功姝e湪瀹℃牳涓�", + icon: "none", + duration: 1000, + }); + return false + } var page = getCurrentPages().pop(); // 鑾峰彇褰撳墠椤甸潰瀹炰緥 page.setData({ -- Gitblit v1.9.1