闫增涛
1 天以前 d7b7435558c15789e9a2c650389cd28ce88d443b
packageDomain/pages/resourceDetails/myVideo/index.js
@@ -61,6 +61,12 @@
    learnTimeList: [],
    learnTimeData: 0,
    toView: 'activeName',
    promptVisable: false,
    confirmBtn: {
      content: '确定',
      variant: 'base',
    },
    showMd5: ''
  },
  // 格式化笔记时间
  convertTimestamp(timestamp) {
@@ -436,22 +442,18 @@
              }
              this.setData({
                showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey),
                titleName: items.name
                titleName: items.name,
                selectedId: index
              })
              debugger
              this.aliVod(file, this.data.showData)
            } else {
              this.setData({
                showData: items.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + items.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + items.freeFile,
                titleName: items.name
                titleName: items.name,
                selectedId: index
              })
              this.aliVod(items.file, this.data.showData)
            }
            let selectedIndex = index; // 存储选中项的索引
            console.log(selectedIndex, "selectedIndex")
            this.setData({
              selectedId: selectedIndex // 设置选中项的索引
            });
          }
        });
      } else {
@@ -462,7 +464,6 @@
        wx.navigateTo({
          url: `/packageBookService/pages/bookServices/detail/index?id=${this.data.bookDetail.id}&name=${this.data.bookDetail.name}&tabValue=jsek_cloudLearning`,
        });
      }
      this.setData({
        loading: false,
@@ -524,6 +525,9 @@
        appRefCode: app.config.appRefCode
      }
      app.MG.file.getAliVod(query).then((res) => {
        this.setData({
          showMd5: md5
        })
        if (res) {
          if (res && res.data == '') {
            this.setData({
@@ -865,17 +869,41 @@
  },
  // 判断当前点击的数据是否购买
  cmsItemIsBuy(item) {
    // 1.this.data.buyIdList 上是否有 cmsItem的linkpath里的id
    const linkData = item.productLinkInfo.find(citem => citem.LinkType == 'Link' && citem.CmsItemId == item.id)
    let linkids = []
    try {
      linkids = linkData.LinkPath.split('\\')
    } catch (error) {}
    if (!this.data.buyIdList.length) return false
    const flag = linkids.some(citem => {
      return this.data.buyIdList.includes(Number(citem))
    })
    console.log(linkids, flag);
    let flag = false
    // 买了
    if (this.data.buyList.length) {
      if (this.data.buyList.some(citem => item.productLinkPath.includes(citem.productLinkPath)))
        flag = true
    } else {
      // 没买且无销售方式
      if (!item.saleMethod.length) {
        flag = true
      } else {
        // 没买且销售方式过期//没买,销售方式价格为0
        const itemSaleMethod = item.saleMethod.find(citem => citem.SaleType == 'Normal')
        if (new Date().getTime() > new Date(itemSaleMethod.EndDate).getTime() || itemSaleMethod.Price == 0) flag = true
      }
    }
    return flag
  },
  videoEnd() {
    const data = this.data.threeLeveData.find(item => item.id == this.data.activeId)
    if (data.freeFile && (this.data.showDataVod.includes(data.freeFile) || this.data.showMd5 == data.freeFile) && data.protectedFile)
      this.setData({
        promptVisable: true
      })
  },
  // 提示弹窗关闭
  closePromapDialog() {
    this.setData({
      promptVisable: false
    })
    if (this.data.source == 'qrcode') {
      wx.navigateTo({
        url: `/packageBookService/pages/bookServices/detail/index?id=${this.data.bookDetail.id}&name=${this.data.bookDetail.name}&tabValue=jsek_cloudLearning`,
      });
    } else {
      wx.navigateBack()
    }
  }
})