| | |
| | | // pages/index/resourceCover.js |
| | | const app = getApp() |
| | | import { |
| | | loginInfo |
| | | } from '../../assets/js/login'; |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | |
| | | getBookInfo(refcode) { |
| | | const obj = { |
| | | storeInfo: app.config.jslx, |
| | | path: app.config.jslx, |
| | | storeInfo: app.config.goodsStore, |
| | | path: app.config.goodsStore, |
| | | queryType: 'ProductCmsItem', |
| | | SysType: "CmsItem", |
| | | RefCode: refcode, |
| | |
| | | formPath: book.learnSelectType ? 'jsek_cloudLearning' : '' |
| | | }) |
| | | wx.redirectTo({ |
| | | 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}`, |
| | | url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&formPath=${this.data.formPath}`, |
| | | }); |
| | | |
| | | if (book.selectType == "pdf" || book.selectType == 'document') { |
| | |
| | | "/file/api/ApiDownload?md5=" + |
| | | book.freeFile; |
| | | console.log(fileLink, "fileLink"); |
| | | this.setData({ |
| | | copyUrl: fileLink |
| | | }) |
| | | // wx.redirectTo({ |
| | | // url: "/packageBookService/pages/bookServices/webView/index?url=" + fileLink |
| | | // }); |
| | |
| | | }) |
| | | }, |
| | | |
| | | 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); |
| | | } |
| | | }) |
| | | }, |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |