import { fetchSelfPatrolDetails } from '../../../services/patrol/fetchSelfPatrol'; import { useLoading } from '../../../behaviors/loading'; Page({ behaviors: [useLoading], data: { recordList: [], previewImageUrls: [], previewCurrent: 0, showPreview: false, }, onLoad(options) { this.setData({ taskId: options.taskId }); this._startLoad(); }, onReachBottom() { this._loadMore(); }, _fetchData(page) { const { taskId } = this.data; return fetchSelfPatrolDetails({ taskId }).then(res => { this.setData({ recordList: page == 1 ? res.data : this.data.recordList.concat(res.data), }); return res.head; }); }, previewImage(e) { const { index } = e.currentTarget.dataset; const ledger = this.data.recordList[index]; if (ledger.ledgerFinished) { const previewTitle = ledger.ledgerName; const previewRemark = ledger.remark1; const previewImageUrls = ledger.path1; this.setData({ previewImageUrls, previewRemark, previewTitle, previewCurrent: 0, showPreview: true, }); } }, });