| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | wx.setNavigationBarTitle({ |
| | | title: '资源详情' |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | console.log(options); |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | |
| | | this.setData({ |
| | | navBarHeight: navBarHeight, |
| | | barHeight: systInfo.statusBarHeight, |
| | |
| | | this.setData({ |
| | | pauseTime: Date.now() |
| | | }) |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | |
| | | this.setData({ |
| | | pauseTime: Date.now() |
| | | }) |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | |
| | | app.MG.store.getProductDetail(query).then((res) => { |
| | | console.log(res); |
| | | res.datas.cmsDatas[0].datas.forEach((item) => { |
| | | |
| | | |
| | | |
| | | |
| | | //刚刚进来的时候 |
| | | if (this.data.productLinkPath == item.productLinkPath) { |
| | | this.handleTeachData(item) |
| | | this.setData({ |
| | |
| | | selectType: item.selectType |
| | | }) |
| | | } |
| | | |
| | | |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | onDownloadButton() { |
| | | const item = this.data.zipData; |
| | | if (this.data.applyState !== 'Normal') { |
| | | return wx.showToast({ |
| | | icon: 'none', |
| | | title: '请先申请下载', |
| | | }) |
| | | } else { |
| | | const flag = new Date(this.data.deadline) > new Date() |
| | | if (!flag) return wx.showToast({ |
| | | icon: 'none', |
| | | title: '请先申请下载', |
| | | }) |
| | | if (!this.data.deadline == '永久') { |
| | | const flag = new Date(this.data.deadline) > new Date() |
| | | return wx.showToast({ |
| | | icon: 'none', |
| | | title: '请先申请下载', |
| | | }) |
| | | } |
| | | } |
| | | if (!item || !item.file) { |
| | | wx.showToast({ |
| | |
| | | wx.showLoading({ |
| | | title: '正在下载...', |
| | | }); |
| | | |
| | | wx.downloadFile({ |
| | | url: downloadUrl, |
| | | success(res) { |
| | |
| | | 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'); |
| | | } |
| | |
| | | webpageSrc: item.jsek_link |
| | | }) |
| | | } |
| | | |
| | | //文档等 |
| | | if (item.selectType == 'pdf' || item.selectType == 'document') { |
| | | app.MG.file.getPdfInfo({ |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, |
| | | |
| | | |
| | | |
| | | handleTap: function () { |
| | | const naturalResources = this.data.naturalResources; |
| | |
| | | // console.log(item); |
| | | }); |
| | | }, |
| | | |
| | | |
| | | |
| | | onClick() { |
| | | this.setData({ |
| | |
| | | const { |
| | | index |
| | | } = e.detail; |
| | | |
| | | console.log('change', index); |
| | | }, |
| | | |
| | |
| | | preview(event) { |
| | | console.log(event.currentTarget.dataset.src) |
| | | let currentUrl = event.currentTarget.dataset.src |
| | | |
| | | wx.previewImage({ |
| | | current: currentUrl, // 当前显示图片的http链接 |
| | | // urls: this.data.showData // 需要预览的图片http链接列表 |