| | |
| | | }, |
| | | cloundMenuIsBuy: { |
| | | type: Boolean |
| | | }, |
| | | learnMenu: { |
| | | type: Object |
| | | }, |
| | | isCloundHaveSaleMethod: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data: { |
| | |
| | | purchaseList: [] |
| | | }, |
| | | ready() {}, |
| | | |
| | | onLoad() {}, |
| | | observers: { |
| | | treeList: function (newValue) { |
| | |
| | | } |
| | | } |
| | | 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) { |
| | | 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") { |
| | |
| | | ) { |
| | | url = "/packageDomain/pages/resourceDetails/myAudio/index"; |
| | | } |
| | | if (item.selectType == "picture") { |
| | | if (item.selectType == "picture" || item.selectType == 'document') { |
| | | url = "/packageDomain/pages/resourceDetails/document/index"; |
| | | } |
| | | wx.navigateTo({ |
| | |
| | | |
| | | // 全选 |
| | | checkAll() { |
| | | wx.showLoading() |
| | | const ids = []; |
| | | let list = []; |
| | | let checked = ""; |
| | |
| | | composed: true, |
| | | }; // 触发事件的选项 |
| | | this.triggerEvent("changeCheckAll", myEventDetail, myEventOption); |
| | | wx.hideLoading() |
| | | }, |
| | | |
| | | // 章节勾选 |
| | | checkResourceTitle(e) { |
| | | wx.showLoading() |
| | | const flag = e.detail.checked; |
| | | // 这个时候checked的值是fals |
| | | const item = e.currentTarget.dataset.item; |
| | |
| | | }, |
| | | // 子项勾选 |
| | | checkResource(e) { |
| | | wx.showLoading() |
| | | const citem = e.currentTarget.dataset.item; |
| | | const parent = e.currentTarget.dataset.parent; |
| | | let outermost; |