litian
2024-09-30 e5f45ec9c2eabaa3e4241caad2d49c3629eaf0c8
packageDomain/pages/resourceDetails/document/index.js
@@ -70,10 +70,16 @@
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {} else {}
        if (data) {
          this.resourceDetailsData()
        } else {
          this.resourceDetailsData()
        }
      })
    } else {
      this.resourceDetailsData()
    }
    this.resourceDetailsData()
  },
  /**
@@ -153,14 +159,16 @@
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
  },
  onShareAppMessage() {},
  onShareTimeline() {},
  goBack() {
    wx.navigateBack()
  },
  resourceDetailsData() {
    wx.showLoading({
      title: '正在加载...',
    });
    let query = {
      path: '*',
      queryType: '*',
@@ -278,39 +286,46 @@
  //刚进来的时候调用
  handleTeachData(item) {
    //图片
    console.log(item, 'item11111');
    if (item.selectType == 'picture') {
      this.setData({
        showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile,
      })
      console.log(this.data.showData, 'showData');
      wx.hideLoading();
    }
    // 下载文件zip
    if (item.selectType == 'zip') {
      this.setData({
        zipData: item
      })
      wx.hideLoading();
    }
    //网页
    if (item.selectType == 'webpage') {
      this.setData({
        webpageSrc: item.jsek_link
      })
      wx.hideLoading();
    }
    //文档等
    if (item.selectType == 'pdf' || item.selectType == 'document') {
      app.MG.file.getPdfInfo({
        md5: item.file
      }).then((res) => {
        if (res && res.totalPages) {
          for (let i = 0; i < res.totalPages; i++) {
        let naturalResources = []
        if (res && JSON.parse(res).totalPages) {
          for (let i = 0; i < JSON.parse(res).totalPages; i++) {
            const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + item.file + '&index=' + (i + 1) + '&dpi=300'
            this.data.naturalResources.push(src)
            // console.log(this.data.naturalResources, ' this.data.naturalResources');
            naturalResources.push(src)
          }
        }
        this.setData({
          naturalResources
        })
        wx.hideLoading();
      })
    }
  },
  handleTap: function () {