const $api = require('../../utils/api').API; const WKT = require('../../utils/terraformer-wkt-parser.min'); Component({ options: { addGlobalClass: true }, properties: { info: { type: Object }, }, data: {}, attached: function () { }, methods: { setMark(e) { this.triggerEvent('setMark', e) }, previewImage(e) { var type = e.target.dataset.type; if (this.properties.info.transactionStatus == "toBeListed") { $api.AJAX('GET', 'applets/landToListAttachment', { fileType: type, proposedseriaId: this.properties.info.proposedseriaId, }, true).then(res => { if (res.data.length > 0) { wx.navigateTo({ url: '/pages/preview/preview?src=' + res.data[0].filePath, }) } else { wx.showToast({ title: '暂无资料可预览', icon: 'none', duration: 2000 }) } }) } else { $api.AJAX('GET', 'applets/landAttachment', { fileType: type, landListedId: this.properties.info.landListedId, }, true).then(res => { if (res.data.length > 0) { wx.navigateTo({ url: '/pages/preview/preview?src=' + res.data[0].filePath, }) } else { wx.showToast({ title: '暂无资料可预览', icon: 'none', duration: 2000 }) } }) } }, preview() { if (this.properties.info.aerialLink) { wx.navigateTo({ url: '/pages/link/link?src=' + this.properties.info.aerialLink, }) } else { wx.showToast({ title: '暂无资料可预览', icon: 'none', duration: 2000 }) } }, //导航 navigato() { var proposedseriaId = this.properties.info.proposedseriaId var landListedId = this.properties.info.landListedId if (this.properties.info.transactionStatus == 'toBeListed') { $api.AJAX('GET', 'applets/landtolistlonlat/list/' + proposedseriaId, true).then(res => { if (res && res.data && res.data.length > 0) { let point = WKT.parse(res.data[0].centerPoint).coordinates let latitude = point[0] let longitude = point[1] wx.openLocation({ latitude: Number(longitude), longitude: Number(latitude), name: res.data[0].name, scale: 28 }) } }) } else { $api.AJAX('GET', 'applets/landlistedlonlat/list/' + landListedId, true).then(res => { if (res && res.data && res.data.length > 0) { let point = WKT.parse(res.data[0].centerPoint).coordinates let latitude = point[0] let longitude = point[1] wx.openLocation({ latitude: Number(longitude), longitude: Number(latitude), name: res.data[0].name, scale: 28 }) } }) } } } })