litian
2024-11-07 37a205e037614e497b00a076f5bc83520337dbea
packageDomain/pages/resourceDetails/document/index.js
@@ -29,6 +29,7 @@
    showData: '',
    titleName: '',
    selectType: '',
    learnSelectType: '',
    zipData: '',
    naturalResources: [],
    titleName: '',
@@ -50,7 +51,6 @@
    wx.setNavigationBarTitle({
      title: '资源详情'
    });
    console.log(options);
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
@@ -105,7 +105,7 @@
    this.setData({
      pauseTime: Date.now()
    })
    if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) {
    if (wx.getStorageSync(app.config.tokenKey)) {
      let duration = this.data.pauseTime - this.data.startTime
      this.count(duration)
    }
@@ -118,7 +118,7 @@
    this.setData({
      pauseTime: Date.now()
    })
    if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) {
    if (wx.getStorageSync(app.config.tokenKey)) {
      let duration = this.data.pauseTime - this.data.startTime
      this.count(duration)
    }
@@ -195,13 +195,13 @@
      query.storeInfo = this.data.storeInfo
    }
    app.MG.store.getProductDetail(query).then((res) => {
      console.log(res);
      res.datas.cmsDatas[0].datas.forEach((item) => {
        if (this.data.productLinkPath == item.productLinkPath) {
          this.handleTeachData(item)
          this.setData({
            titleName: item.name,
            selectType: item.selectType
            selectType: item.selectType,
            learnSelectType: item.learnSelectType
          })
        }
      })
@@ -219,14 +219,15 @@
        })
      }
    }
    if (!item || !item.file) {
    if (!item || !item.file || !item.protectedFile) {
      wx.showToast({
        title: '文件信息缺失',
        icon: 'none'
      });
      return;
    }
    const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file;
    let file = item.file ? item.file : item.protectedFile
    const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + file;
    wx.showLoading({
      title: '正在下载...',
    });
@@ -284,21 +285,22 @@
  //刚进来的时候调用
  handleTeachData(item) {
    //图片
    if (item.selectType == 'picture') {
    if (item.selectType == 'picture' || item.learnSelectType == 'picture') {
      let file = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile
      this.setData({
        showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile,
        showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file,
      })
      wx.hideLoading();
    }
    // 下载文件zip
    if (item.selectType == 'zip') {
    if (item.selectType == 'zip' || item.learnSelectType == 'zip') {
      this.setData({
        zipData: item
      })
      wx.hideLoading();
    }
    //网页
    if (item.selectType == 'webpage') {
    if (item.selectType == 'webpage' || item.learnSelectType == 'webpage') {
      this.setData({
        webpageSrc: item.jsek_link
      })
@@ -314,8 +316,8 @@
    //   })
    // }
    //文档等
    if (item.selectType == 'document' || item.selectType == 'pdf') {
      let md5 = item.file ? item.file : item.freeFile
    if (item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') {
      let md5 = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile
      app.MG.file.getPdfInfo({
        md5: md5
      }).then((res) => {
@@ -337,9 +339,7 @@
  handleTap: function () {
    const naturalResources = this.data.naturalResources;
    naturalResources.forEach(function (item) {
      // console.log(item);
    });
    naturalResources.forEach(function (item) {});
  },
  onClick() {
@@ -375,7 +375,6 @@
    const {
      trigger
    } = e.detail;
    console.log(trigger);
    this.setData({
      visible: false,
    });