litian
2024-07-09 86cbb2a45a153a704bcc0d63697f83d2832caa71
pages/index/resourceCover.js
@@ -12,16 +12,30 @@
    cmsId: '',
    productLinkPath: '',
    parentProductLinkPath: '',
    formPath: ''
    formPath: '',
    copyUrl: '',
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if (options.scene) {
      this.getBookInfo(options.scene)
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        // 如果不是第一次登录,会执行回调
        if (data) {
          if (options.scene) {
            this.getBookInfo(options.scene)
          }
        }
      })
    } else {
      if (options.scene) {
        this.getBookInfo(options.scene)
      }
    }
  },
  /**
@@ -112,6 +126,9 @@
          "/file/api/ApiDownload?md5=" +
          book.freeFile;
        console.log(fileLink, "fileLink");
        this.setData({
          copyUrl: fileLink
        })
        // wx.redirectTo({
        //   url: "/packageBookService/pages/bookServices/webView/index?url=" + fileLink
        // });
@@ -122,6 +139,21 @@
    })
  },
  copyUrl(e) {
    let url = e.currentTarget.dataset.value
    console.log(url)
    // wx.setClipboardData(url)
    wx.setClipboardData({
      data: `${e.currentTarget.dataset.value}`,
      success(res) {
        console.log(res.data) // data
      },
      fail(err) {
        reject(err);
      }
    })
  },
  /**
   * 用户点击右上角分享
   */