From 04c7b0163caeae4ab1c5da62e301fa993101cfad Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 31 三月 2025 10:40:45 +0800 Subject: [PATCH] bug修改 --- packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js b/packageBookService/pages/bookServices/detail/components/learnResource/learnResource.js index 5df1b31..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({ /** * 缁勪欢鐨勫睘鎬у垪琛� @@ -23,10 +27,13 @@ type: Boolean, default: false }, - isShowBuyCloundBtn:{ - type:Boolean, - default:true - } + isShowBuyCloundBtn: { + type: Boolean, + default: true + }, + learnTaskData: { + type: Object, + }, }, /** @@ -51,15 +58,23 @@ }, // 璺宠浆璧勬簮璐拱椤� goBuyResource() { - if (!this.properties.isGoBuyResource) { - return wx.showToast({ - icon: 'error', - title: '鏆傛棤鍙喘涔拌祫婧�', + 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}`, }) } - 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) { @@ -73,9 +88,20 @@ }) }, goLearnTask() { - wx.navigateTo({ - url: `/packageBookService/pages/bookServices/detail/components/learnTask/index?bookId=${this.properties.bookId}`, - }) + 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瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 -- Gitblit v1.9.1