QYF-GitLab1
4 天以前 b55024ee2f42aa93e0ecaa3113bdeb286f6e59ac
packageDomain/pages/resourceDetails/myAudio/index.js
@@ -124,7 +124,6 @@
      })
      this.getLearnTime()
    }
    this.resourceDetailsData()
    this.getBookInfo(options.bookId)
  },
  /**
@@ -267,15 +266,19 @@
      coverSize: {
        height: 1,
      },
      fields: {},
      fields: {
        IsTextbook: []
      },
    };
    if (this.data.storeInfo) query['storeInfo'] = this.data.storeInfo
    app.MG.store.getProductDetail(query).then(async (res) => {
      this.setData({
        bookDetail: res.datas,
        bookName: res.datas.name,
        buyIdList: res.datas.purchasedSaleMethodIdList,
        learnClassData: res.datas.cmsDatas[0].datas.find(item => item.refCode == "jsek_cloudLearning")
      })
      this.resourceDetailsData()
      this.getResourceDataList(this.data.learnClassData)
    });
  },
@@ -388,7 +391,7 @@
      if (dataItem) {
        if (dataItem.saleMethod.length > 0) {
          isBuy = 2;
          if (this.data.bookDetail.purchasedSaleMethodIdList.indexOf(dataItem.saleMethod[0].Id) > -1) {
          if (this.data.bookDetail.purchasedSaleMethodIdList.indexOf(dataItem.saleMethod[0].Id) > -1 || dataItem.saleMethod[0].Price == 0) {
            isBuy = 3;
            break;
          } else {
@@ -400,12 +403,13 @@
    if (isBuy == 2) {
      // 未购买
      if (dataList[0].freeFile) {
        dataList[0].isFreeFile = true; // 这个资源可以试看
        cmsItemData = dataList[0]
      } else {
        wx.hideLoading();
        wx.showModal({
          title: '温馨提示',
          content: '该资源未购买,将返回购买',
          content: '该资源未激活或购买,即将返回图书详情页面',
          success: (res) => {
            if (res.confirm) {
              if (this.data.source == 'qrcode') {
@@ -458,9 +462,10 @@
      let selectedId = -1; // 初始化选中项索引
      let showDataUrl = '';
      let titleName = '';
      res.datas.cmsDatas[0].datas.forEach((item, index) => {
        if (item.selectType === "audio" || item.learnSelectType === "audio") {
          if (this.data.storeInfo == 'jsek_digitalCourses') {
      // ###视频页面这里判断了是否购买,但音频这里没有判断,需要再核实
      if (this.data.storeInfo == 'jsek_digitalCourses') {
        res.datas.cmsDatas[0].datas.forEach((item, index) => {
          if (item.selectType === "audio" || item.learnSelectType === "audio") {
            if (item.sysType == 'CmsItem') {
              this.data.threeLeveData.push(item)
            }
@@ -468,18 +473,25 @@
              this.data.threeLeveData.push(item)
            }
          }
        });
      } else {
        const itemCms = await this.getBuyCmsItem()
        if (itemCms != null) {
          this.data.threeLeveData.push(itemCms)
        }
      });
      const itemCms = await this.getBuyCmsItem()
      if (itemCms != null) {
        this.data.threeLeveData.push(itemCms)
      }
      if (this.data.threeLeveData.length > 0) {
        selectedId = this.data.threeLeveData.findIndex(items => items.productLinkPath == this.data.productLinkPath)
        if (selectedId !== -1) {
          let datas = this.data.threeLeveData[selectedId];
          if (this.data.formPath == 'jsek_cloudLearning') {
            let file = this.cmsItemIsBuy(datas) ? datas.protectedFile || datas.freeFile : datas.freeFile
            // let file = this.cmsItemIsBuy(datas) ? datas.protectedFile || datas.freeFile : datas.freeFile
            let file
            if (!datas.isFreeFile) {
              file = datas.protectedFile
            } else {
              file = datas.freeFile
            }
            showDataUrl = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey);
          } else {
            showDataUrl = datas.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + datas.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + datas.freeFile
@@ -517,7 +529,12 @@
      })
      if (item.selectType == "audio" || item.learnSelectType === "audio") {
        if (this.data.formPath == 'jsek_cloudLearning') {
          let file = item.protectedFile ? item.protectedFile : item.freeFile
          let file
          if (!item.isFreeFile) {
            file = item.protectedFile
          } else {
            file = item.freeFile
          }
          // 这里处理云学习的
          this.setData({
            showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey)