| | |
| | | showData: '', |
| | | titleName: '', |
| | | selectType: '', |
| | | learnSelectType: '', |
| | | zipData: '', |
| | | naturalResources: [], |
| | | titleName: '', |
| | |
| | | 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({ |
| | | pauseTime: Date.now() |
| | | }) |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | |
| | | this.setData({ |
| | | pauseTime: Date.now() |
| | | }) |
| | | if (wx.getStorageSync(app.config.tokenKey) && epubObj && epubObj.bookBuy) { |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | |
| | | query.storeInfo = this.data.storeInfo |
| | | } |
| | | 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({ |
| | | titleName: item.name, |
| | | selectType: item.selectType |
| | | selectType: item.selectType, |
| | | learnSelectType: item.learnSelectType |
| | | }) |
| | | } |
| | | }) |
| | |
| | | }) |
| | | } |
| | | } |
| | | if (!item || !item.file) { |
| | | if (!item || !item.file || !item.protectedFile) { |
| | | wx.showToast({ |
| | | title: '文件信息缺失', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file; |
| | | let file = item.file ? item.file : item.protectedFile |
| | | const downloadUrl = app.config.requestCtx + '/file/api/ApiDownload?md5=' + file; |
| | | wx.showLoading({ |
| | | title: '正在下载...', |
| | | }); |
| | |
| | | //刚进来的时候调用 |
| | | handleTeachData(item) { |
| | | //图片 |
| | | if (item.selectType == 'picture') { |
| | | if (item.selectType == 'picture' || item.learnSelectType == 'picture') { |
| | | let file = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile |
| | | this.setData({ |
| | | showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile, |
| | | showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file, |
| | | }) |
| | | wx.hideLoading(); |
| | | } |
| | | // 下载文件zip |
| | | if (item.selectType == 'zip') { |
| | | if (item.selectType == 'zip' || item.learnSelectType == 'zip') { |
| | | this.setData({ |
| | | zipData: item |
| | | }) |
| | | wx.hideLoading(); |
| | | } |
| | | //网页 |
| | | if (item.selectType == 'webpage') { |
| | | if (item.selectType == 'webpage' || item.learnSelectType == 'webpage') { |
| | | this.setData({ |
| | | webpageSrc: item.jsek_link |
| | | }) |
| | |
| | | // }) |
| | | // } |
| | | //文档等 |
| | | if (item.selectType == 'document' || item.selectType == 'pdf') { |
| | | let md5 = item.file ? item.file : item.freeFile |
| | | if (item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') { |
| | | let md5 = item.file ? item.file : item.protectedFile ? item.protectedFile : item.freeFile |
| | | app.MG.file.getPdfInfo({ |
| | | md5: md5 |
| | | }).then((res) => { |
| | |
| | | |
| | | handleTap: function () { |
| | | const naturalResources = this.data.naturalResources; |
| | | naturalResources.forEach(function (item) { |
| | | // console.log(item); |
| | | }); |
| | | naturalResources.forEach(function (item) {}); |
| | | }, |
| | | |
| | | onClick() { |
| | |
| | | const { |
| | | trigger |
| | | } = e.detail; |
| | | console.log(trigger); |
| | | this.setData({ |
| | | visible: false, |
| | | }); |