From 7974f3266c323e4cd4fdff7d457fe75f39b8c199 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 25 九月 2024 15:59:06 +0800 Subject: [PATCH] 云学习跳转逻辑修改 --- packageBookService/pages/bookServices/detail/components/tree/index.js | 46 ++++++++++++++++++++++------------------------ 1 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index c5c622c..1709e7e 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -53,6 +53,12 @@ }, cloundMenuIsBuy: { type: Boolean + }, + learnMenu: { + type: Object + }, + isCloundHaveSaleMethod: { + type: Boolean } }, data: { @@ -210,37 +216,29 @@ } } if (this.properties.tab == "jsek_cloudLearning") { - // 鍒ゆ柇鐖剁骇鎴栬嚜韬槸鍚﹁喘涔� - var myEventOption = { - bubbles: true, - composed: true, - }; - // 鍑哄彂鍒ゆ柇浜戝涔犳槸鍚﹁喘涔板垽鏂� - this.triggerEvent("getCloundIsBuy", {}, myEventOption) - if (!this.properties.cloundMenuIsBuy) { - // 浜戝涔犳湭璐拱锛屾煡鎵句互璐拱鐨勭洰褰曞拰璧勬簮鏈韩 - const learn = this.handleTreeData(this.properties.treeList).filter( + // 1.鎵惧嚭鎵�鏈夌埗绾х洰褰曞拰鏈韩(鏈夐攢鍞柟寮�) 鍜� 浜戝涔犳湰韬�(鏈夐攢鍞柟寮�) 鏀惧埌涓�涓暟缁� 涓虹┖鍒欐殏鏈紑鏀鹃攢鍞� + let learn = [] + if (this.properties.isCloundHaveSaleMethod) { + // 1.1 浜戝涔犳湁閿�鍞柟寮忥紝鍔犲叆鐖剁骇鏁扮粍 + learn.push(this.properties.learnMenu) + } else { + // 1.2 浜戝涔犳棤閿�鍞柟寮忥紝灏嗙埗绾х洰褰曞拰鏈韩鍔犲叆鏁扮粍 + const learn = this.handleTreeData(this.properties.learnList).filter( (citem) => citem.saleMethod && citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal') && new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').EndDate).getTime() >= new Date().getTime() && new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').BeginDate).getTime() <= new Date().getTime() && item.productLinkPath.includes(citem.productLinkPath) ) - // 璧勬簮鍜岀埗绾х洰褰曢兘鏃犻攢鍞柟寮� - // if (!learn.length) return wx.showToast({ - // icon: 'error', - // title: '鏆傛湭寮�鍞�', - // }) - const buyList = learn.filter((citem) => this.properties.buyIds.includes(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').Id)) - if (!buyList.length && learn.length) { - // 璧勬簮鍜屾湰韬兘鏈喘涔� 涓� 鐖剁骇鎴栨湰韬湁閿�鍞柟寮� - const itemSaleMethod = item.saleMethod && item.saleMethod.length ? item.saleMethod.find(citem => citem.SaleType == 'Normal') : undefined - return wx.showToast({ - icon: 'error', - title: itemSaleMethod && itemSaleMethod.Price == 0 ? '璇峰厛棰嗗彇璧勬簮' : '璇峰厛璐拱璧勬簮', - }) - } } + // 2.鎵惧嚭杩欎釜鏁扮粍閲屽凡璐拱鐨� 褰㈡垚鏂版暟缁� 涓虹┖鍒欐湭璐拱 + let buyList = [] + if (learn.length) buyList = learn.filter((item) => this.properties.buyIds.includes(item.saleMethod.find((citem) => citem.SaleType == 'Normal').Id)) + // 鏈夌埗绾�(鍖呭惈閿�鍞柟寮�)锛屼笖鏈喘涔� + if (learn.length && !buyList.length) return wx.showToast({ + icon: 'error', + title: '璇峰厛璐拱璇ヨ祫婧�', + }) } let url; if (item.selectType == "video" || item.learnSelectType == "video") { -- Gitblit v1.9.1