From 5997579aa13e3b11677ee4d6eac3584f4e11429f Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期二, 08 七月 2025 16:53:57 +0800 Subject: [PATCH] 优化 --- packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js | 83 +++++++++++++++++++++++++++++++++-------- 1 files changed, 67 insertions(+), 16 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js index 259c5f3..5ce392d 100644 --- a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js +++ b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js @@ -1,4 +1,8 @@ // pages/bookServices/detail/components/learnResource/learnResource.js +import { + loginInfo +} from "../../../../../../assets/js/login"; +const app = getApp() Component({ /** * 缁勪欢鐨勫睘鎬у垪琛� @@ -10,9 +14,26 @@ bookId: { type: Number }, - isshowDrawBtn:{ - type:Boolean - } + isshowDrawBtn: { + type: Boolean + }, + successOrderNumber: { + type: Number, + }, + isGoBuyResource: { + type: Boolean + }, + isShowBuyCloundMenu: { + type: Boolean, + default: false + }, + isShowBuyCloundBtn: { + type: Boolean, + default: true + }, + learnTaskData: { + type: Object, + }, }, /** @@ -35,19 +56,25 @@ } // 瑙﹀彂浜嬩欢鐨勯�夐」 this.triggerEvent('getFreeResource', myEventDetail, myEventOption) }, - // allAddShoppiingCar() { - // var myEventDetail = {} // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - // var myEventOption = { - // bubbles: true, - // composed: true - // } // 瑙﹀彂浜嬩欢鐨勯�夐」 - // this.triggerEvent('allAddShoppiingCar', myEventDetail, myEventOption) - // }, + // 璺宠浆璧勬簮璐拱椤� goBuyResource() { - wx.navigateTo({ - url: `/packageBookService/pages/bookServices/detail/buyResource/index?productLinkPath=${this.properties.buyResourceData.productLinkPath}&refCode=${this.properties.buyResourceData.refCode}&bookId=${this.properties.bookId}`, - }) - + const gotoPageFun = () => { + if (!this.properties.isGoBuyResource) { + return wx.showToast({ + icon: 'error', + title: '鏆傛棤鍙喘涔拌祫婧�', + }) + } + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/detail/buyResource/index?productLinkPath=${this.properties.buyResourceData.productLinkPath}&refCode=${this.properties.buyResourceData.refCode}&bookId=${this.properties.bookId}`, + }) + } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + gotoPageFun() + } else { + loginInfo(app, (data) => {}) + } }, changeReceive(type) { @@ -59,6 +86,30 @@ this.setData({ buy: type }) + }, + goLearnTask() { + const gotoPageFun = () => { + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.properties.bookId}&cmsPath=${this.properties.learnTaskData?.productLinkPath}`, + }) + } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + gotoPageFun() + } else { + loginInfo(app, (data) => { + if (data) gotoPageFun() + }) + } + + }, + buyCloudLearnClass() { + var myEventDetail = {} // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 + var myEventOption = { + bubbles: true, + composed: true + } // 瑙﹀彂浜嬩欢鐨勯�夐」 + this.triggerEvent('buyCloudLearnClass', myEventDetail, myEventOption) } } -}) +}) \ No newline at end of file -- Gitblit v1.9.1