pdf
litian
2024-09-19 b9d08f45e3dc1fce9b8ae37ae8b95562843d4cbe
packageBookService/pages/components/webView/index.js
@@ -1,5 +1,8 @@
// packageBookService/pages/components/webView/index.js
const app = getApp()
import {
  loginInfo
} from '../../../../assets/js/login';
Page({
  /**
@@ -21,6 +24,7 @@
   */
  onLoad(options) {
    console.log(options)
    if (options && options.link) {
      this.setData({
        src: decodeURIComponent(options.link),
@@ -32,13 +36,23 @@
        src: ''
      })
      if (options) {
        console.log(options)
        wx.setNavigationBarTitle({
          title: options.fileName,
          skeletonLoding: true
        })
        this.getProgress(options)
      }
    }
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          this.getProgress(options)
        } else {
          this.getProgress(options)
        }
      })
    } else {
      this.getProgress(options)
    }
  },
@@ -88,7 +102,7 @@
      app.MG.file.getPdfInfo({
        md5: data.md5
      }).then((res) => {
        let pageCount = data.bookBuy == "true" ? res.totalPages : Number(data.freePage)
        let pageCount = data.bookBuy == "true" ? JSON.parse(res).totalPages : Number(data.freePage)
        console.log(pageCount, "connt")
        if (pageCount) {
          let list = [];
@@ -96,12 +110,10 @@
            const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + data.md5 + '&index=' + (i + 1) + '&dpi=300'
            list.push(src)
          }
          console.log(list)
          that.setData({
            pdfList: list,
            skeletonLoding: false,
          })
        }
      })
    }
@@ -244,4 +256,9 @@
  onReachBottom() {
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
  onShareTimeline() {},
})