| | |
| | | // pages/resourceDetails/document/index.js |
| | | import Toast from 'tdesign-miniprogram/toast/index'; |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | visible: false, |
| | | showIndex: false, |
| | | closeBtn: false, |
| | | deleteBtn: false, |
| | | images: [], |
| | | webpageSrc: '', |
| | | navBarHeight: '', |
| | | barHeight: '', |
| | |
| | | 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'); |
| | | } |
| | | // 下载文件zip |
| | | if (item.selectType == 'zip') { |
| | |
| | | naturalResources.forEach(function (item) { |
| | | // console.log(item); |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | |
| | | |
| | | onClick() { |
| | | this.setData({ |
| | | images: [ |
| | | this.data.showData, |
| | | // 'https://tdesign.gtimg.com/mobile/demos/swiper2.png', |
| | | ], |
| | | showIndex: true, |
| | | visible: true, |
| | | }); |
| | | }, |
| | | onChange(e) { |
| | | const { |
| | | index |
| | | } = e.detail; |
| | | |
| | | console.log('change', index); |
| | | }, |
| | | |
| | | onDelete(e) { |
| | | const { |
| | | index |
| | | } = e.detail; |
| | | |
| | | Toast({ |
| | | context: this, |
| | | selector: '#t-toast', |
| | | message: `删除第${index + 1}个`, |
| | | }); |
| | | }, |
| | | |
| | | onClose(e) { |
| | | const { |
| | | trigger |
| | | } = e.detail; |
| | | console.log(trigger); |
| | | this.setData({ |
| | | visible: false, |
| | | }); |
| | | }, |
| | | //预览图片,放大预览 |
| | | preview(event) { |
| | | console.log(event.currentTarget.dataset.src) |
| | | let currentUrl = event.currentTarget.dataset.src |
| | | |
| | | wx.previewImage({ |
| | | current: currentUrl, // 当前显示图片的http链接 |
| | | // urls: this.data.showData // 需要预览的图片http链接列表 |
| | | }) |
| | | }, |
| | | |
| | | }) |