| | |
| | | }, |
| | | 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") { |
| | |
| | | tab="{{tab}}" |
| | | buyIds="{{buyIds}}" |
| | | openIds="{{openIds}}" |
| | | learnMenu="{{learnMenu}}" |
| | | isCloundHaveSaleMethod="{{isCloundHaveSaleMethod}}" |
| | | ></tree> |
| | | </view> |
| | | <!-- 暂无数据 --> |
| | |
| | | fileList: [], |
| | | isShowUp: true, |
| | | protocolShow: false, |
| | | protocolTxt: '' |
| | | protocolTxt: '', |
| | | learnMenu: null |
| | | }, |
| | | |
| | | resetTree: function (e) { |
| | |
| | | this.setData({ |
| | | resourceCodeList: res.datas.cmsDatas[0].datas, |
| | | learnTaskData: res.datas.cmsDatas[0].datas.filter((item) => item.refCode == 'jsek_learningTasks')[0] |
| | | }) |
| | | if (res.datas.cmsDatas[0].datas.length) this.setData({ |
| | | learnMenu: res.datas.cmsDatas[0].datas.find(item => item.refCode == 'jsek_cloudLearning') |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | // 判断云学习全部购买按钮是否显示 |
| | | let isShowBuyCloundMenu = flags && cloundSaleMethod.Price >= 0 |
| | | // 判断资源购买按钮是否显示 |
| | | let isShowBuyCloundBtn = res.datas.cmsDatas[0].datas.some(citem => citem.saleMethod.length != 0) || type.saleMethod.length |
| | | let isShowBuyCloundBtn = !flags && res.datas.cmsDatas[0].datas.some(citem => citem.saleMethod.length != 0) |
| | | // 判断购物车按钮和锁按钮是否显示 |
| | | this.handleTreeData(list).forEach(item => { |
| | | item.isbuy = this.resourceIsBuy(item); |
| | |
| | | bookInfo="{{bookDetail}}" |
| | | tab="{{tabValue}}" |
| | | treeList="{{learn}}" |
| | | learnList="{{learn}}" |
| | | buyIds="{{buyIdList}}" |
| | | openLearnids="{{openLearnids}}" |
| | | cloundMenuIsBuy="{{cloundMenuIsBuy}}" |
| | | learnMenu="{{learnMenu}}" |
| | | isCloundHaveSaleMethod="{{isCloundHaveSaleMethod}}" |
| | | bind:updateShoppingCartHidden="updateShoppingCartHidden" |
| | | bind:updateCloudLearning="updateCloudLearning" |
| | | bind:getCloundIsBuy="getCloundIsBuy" |
| | |
| | | this.digitalCoursesDetailsGet(options.id) |
| | | this.getPlayerList() |
| | | this.getType() |
| | | this.setData({ |
| | | userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name, |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | if (this.data.tabValue == 2) { |
| | | if (this.data.tabValue == 2 && this.data.selectActive == 'learn') { |
| | | this.getPlayerList() |
| | | this.getResource() |
| | | this.getRelationBook() |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | keys: [this.data.bookId + ''] |
| | | }) |
| | | .then((res) => { |
| | | console.log(1, res); |
| | | if (res.length > 0) { |
| | | this.setData({ |
| | | playerList: JSON.parse(res[0].value) |
| | |
| | | learnList: list, |
| | | openTeachids: result, |
| | | }); |
| | | console.log(1, this.data.learnList, this.data.playerList) |
| | | } |
| | | } else { |
| | | const data = test.filter( |