From a4f188da5ebe64095492f1ebc935cbdcb199fd11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=81=A5?= Date: Thu, 19 Aug 2021 10:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=88=AA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail-announcement.js | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/components/detail-announcement/detail-announcement.js b/components/detail-announcement/detail-announcement.js index 8a81dd8..be7daae 100644 --- a/components/detail-announcement/detail-announcement.js +++ b/components/detail-announcement/detail-announcement.js @@ -1,4 +1,5 @@ const $api = require('../../utils/api').API; +const WKT = require('../../utils/terraformer-wkt-parser.min'); Component({ options: { addGlobalClass: true @@ -85,25 +86,31 @@ Component({ // var landListedId = 'CQ202106280037' if (this.properties.info.transactionStatus == 'toBeListed') { $api.AJAX('GET', 'applets/landtolistlonlat/list/' + proposedseriaId, true).then(res => { - var latitude = res.data[0].landLonLat.split(';')[0].split(',')[0] - var longitude = res.data[0].landLonLat.split(';')[0].split(',')[1] - wx.openLocation({ - latitude: Number(longitude), - longitude: Number(latitude), - name: res.data[0].name, - scale: 28 - }) + 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 => { - var latitude = res.data[0].landLonLat.split(';')[0].split(',')[0] - var longitude = res.data[0].landLonLat.split(';')[0].split(',')[1] - wx.openLocation({ - latitude: Number(longitude), - longitude: Number(latitude), - name: res.data[0].name, - scale: 28 - }) + 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 + }) + } }) } }