| | |
| | | }, |
| | | cloundMenuIsBuy: { |
| | | type: Boolean |
| | | }, |
| | | learnMenu: { |
| | | type: Object |
| | | }, |
| | | isCloundHaveSaleMethod: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data: { |
| | |
| | | } |
| | | } |
| | | 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({ |
| | | } |
| | | // 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: itemSaleMethod && itemSaleMethod.Price == 0 ? '请先领取资源' : '请先购买资源', |
| | | title: '请先购买该资源', |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | let url; |
| | | if (item.selectType == "video" || item.learnSelectType == "video") { |