| | |
| | | let that = this |
| | | //图片 |
| | | if (item.selectType == 'picture' || item.learnSelectType == 'picture') { |
| | | let file = isTry ? item.freeFile : item.protectedFile || item.file |
| | | this.setData({ |
| | | showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file, |
| | | }) |
| | | let file = isTry ? item.freeFile : item.protectedFile || item.file; |
| | | if (isTry) { |
| | | this.setData({ |
| | | showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file, |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey) |
| | | }) |
| | | } |
| | | wx.hideLoading(); |
| | | } |
| | | // 下载文件zip |
| | |
| | | } |
| | | //文档等 |
| | | if (item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') { |
| | | let md5 = isTry ? item.freeFile : item.protectedFile || item.file || item.freeFile |
| | | let md5 = isTry ? item.freeFile : item.protectedFile || item.file || item.freeFile; |
| | | let urlPage = '' |
| | | if (isTry) { |
| | | urlPage = app.config.requestCtx + '/file/api/ApiDownload?md5=' + md5 |
| | | } else { |
| | | urlPage = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + md5 + '&token=' + wx.getStorageSync(app.config.tokenKey) |
| | | } |
| | | if (item.fileMap[md5]?.extension == 'xlsx' || item.fileMap[md5]?.extension == 'xls') { |
| | | this.setData({ |
| | | selectTypeData: 'excel', |
| | | showMd5: md5, |
| | | }) |
| | | wx.request({ |
| | | url: app.config.requestCtx + '/file/api/ApiDownload?md5=' + md5, |
| | | url: urlPage, |
| | | method: 'GET', // 请求方式 |
| | | responseType: 'arraybuffer', // 指定返回类型为 arraybuffer |
| | | success: (res) => { |
| | |
| | | wx.previewImage({ |
| | | urls: urls // 需要预览的图片http链接列表 |
| | | }) |
| | | }, |
| | | // 判断当前点击的数据是否购买 |
| | | cmsItemIsBuy(item) { |
| | | let flag = false |
| | | // 买了 |
| | | if (this.data.buyList.length) { |
| | | if (this.data.buyList.some(citem => item.productLinkPath.includes(citem.productLinkPath))) |
| | | flag = true |
| | | } else { |
| | | // 没买且无销售方式 |
| | | if (!item.saleMethod.length) { |
| | | flag = true |
| | | } else { |
| | | // 没买且销售方式过期//没买,销售方式价格为0 |
| | | const itemSaleMethod = item.saleMethod.find(citem => citem.SaleType == 'Normal') |
| | | if (new Date().getTime() > new Date(itemSaleMethod.EndDate).getTime() || itemSaleMethod.Price == 0) flag = true |
| | | } |
| | | } |
| | | return flag |
| | | }, |
| | | // |
| | | scrolltolower(e) { |