闫增涛
2024-09-25 7974f3266c323e4cd4fdff7d457fe75f39b8c199
云学习跳转逻辑修改
5个文件已修改
68 ■■■■■ 已修改文件
packageBookService/pages/bookServices/detail/components/tree/index.js 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.wxml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/digitalCourses/digitalCoursesDetails/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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") {
packageBookService/pages/bookServices/detail/components/tree/index.wxml
@@ -313,6 +313,8 @@
          tab="{{tab}}"
          buyIds="{{buyIds}}"
          openIds="{{openIds}}"
          learnMenu="{{learnMenu}}"
          isCloundHaveSaleMethod="{{isCloundHaveSaleMethod}}"
        ></tree>
      </view>
      <!-- 暂无数据 -->
packageBookService/pages/bookServices/detail/index.js
@@ -208,7 +208,8 @@
    fileList: [],
    isShowUp: true,
    protocolShow: false,
    protocolTxt: ''
    protocolTxt: '',
    learnMenu: null
  },
  resetTree: function (e) {
@@ -527,6 +528,9 @@
      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')
      })
    })
  },
@@ -1042,7 +1046,7 @@
        // 判断云学习全部购买按钮是否显示
        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);
packageBookService/pages/bookServices/detail/index.wxml
@@ -268,9 +268,12 @@
                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"
pages/digitalCourses/digitalCoursesDetails/index.js
@@ -179,6 +179,9 @@
    this.digitalCoursesDetailsGet(options.id)
    this.getPlayerList()
    this.getType()
    this.setData({
      userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name,
    })
  },
  /**
@@ -192,11 +195,11 @@
   * 生命周期函数--监听页面显示
   */
  onShow() {
    if (this.data.tabValue == 2) {
    if (this.data.tabValue == 2 && this.data.selectActive == 'learn') {
      this.getPlayerList()
      this.getResource()
      this.getRelationBook()
    }
  },
  /**
@@ -240,6 +243,7 @@
        keys: [this.data.bookId + '']
      })
      .then((res) => {
        console.log(1, res);
        if (res.length > 0) {
          this.setData({
            playerList: JSON.parse(res[0].value)
@@ -545,7 +549,6 @@
              learnList: list,
              openTeachids: result,
            });
            console.log(1, this.data.learnList, this.data.playerList)
          }
        } else {
          const data = test.filter(