litian
2024-06-28 75a9abca4f4cf0ebe579705abc369489cfe20e7c
pages/index/resourceCover.js
@@ -79,7 +79,7 @@
        book.learnSelectType == "audio"
      ) {
        url = "/packageDomain/pages/resourceDetails/myAudio/index";
      } else if (book.selectType == "picture" || book.selectType == "zip") {
      } else if (book.selectType == "picture") {
        url = "/packageDomain/pages/resourceDetails/document/index";
      }
      this.setData({
@@ -91,22 +91,21 @@
        formPath: book.learnSelectType ? 'jsek_cloudLearning' : ''
      })
      wx.redirectTo({
        url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`,
        url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`,
      });
      if (book.selectType == "pdf") {
      if (book.selectType == "pdf" || book.selectType == 'document') {
        const fileLink = book.file ? book.file : book.freeFile
        console.log(fileLink);
        wx.navigateTo({
        wx.redirectTo({
          url: "/packageBookService/pages/components/webView/index?md5=" +
            fileLink +
            "&fileName=" +
            book.name +
            "&fileType=" +
            book.selectType + "&bookBuy=true"
            "&fileType=pdf" + "&bookBuy=true"
        });
      }
      if (book.selectType == 'document') {
      if (book.selectType == 'zip') {
        const fileLink = book.file ?
          app.config.requestCtx + "/file/api/ApiDownload?md5=" + book.file :
          app.config.requestCtx +
@@ -121,24 +120,9 @@
          success: function (res) {
            console.log(res, "wx.downloadFile success res");
            if (res.statusCode != 200) {
              util.hideLoadingWithErrorTips();
              return false;
            }
            var Path = res.tempFilePath; //返回的文件临时地址,用于后面打开本地预览所用
            let data = res.filePath;
            wx.openDocument({
              filePath: data,
              showMenu: true,
              success: function (res) {
                console.log("打开成功");
                util.hideLoading();
              },
            });
          },
          fail: function (err) {
            console.log(err, "wx.downloadFile fail err");
            util.hideLoadingWithErrorTips();
          },
          }
        });
      }
    })