From 6d749fa8b6bf939c610e70ead8ee536acb9957a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=81=A5?= Date: Thu, 2 Sep 2021 17:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=BA=BF=E5=AE=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/look-detail/look-detail.js | 12 +++-- pages/look/look.js | 66 +++++++----------------- pages/lookStay-detail/lookStay-detail.js | 12 +++-- 3 files changed, 36 insertions(+), 54 deletions(-) diff --git a/pages/look-detail/look-detail.js b/pages/look-detail/look-detail.js index 3a23000..27ed9c4 100644 --- a/pages/look-detail/look-detail.js +++ b/pages/look-detail/look-detail.js @@ -218,9 +218,15 @@ Page({ }) } }) - let strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); - let strokeWidth = item.strokeWidth ? Number(item.strokeWidth) : 2; - let fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + let strokeColor; + let fillColor; + if(item.lineColor){ + strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); + } + let strokeWidth = item.lineWidth ? Number(item.lineWidth) : 2; + if(item.fillColor){ + fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + } let polygon = { points, strokeColor, diff --git a/pages/look/look.js b/pages/look/look.js index e67e2ca..c426aad 100644 --- a/pages/look/look.js +++ b/pages/look/look.js @@ -180,22 +180,9 @@ Page({ let l = number.indexOf('(') + 1; let z = number.indexOf(' '); let r = number.indexOf(')'); - - console.log(l, z, r) - let log = number.substr(l, z - l); let lag = number.substr(z, r - z); - - // console.log(data) - this.setWKT1(data, 2) - // let polygon = this.wkt2polygon(data.data[0].geom); - // polygon.strokeColor = '#fe00fe'; - // polygon.strokeWidth = 2; - // polygon.fillColor = '#00fe04' + util.ten2XO(50); - // let polygons = [polygon]; - - this.setData({ // polygons, latitude: lag, @@ -205,33 +192,6 @@ Page({ } }) }, - - wkt2polygon(geom) { - let geomPoints = WKT.parse(geom); - let points = []; - geomPoints.coordinates[0].forEach(ele => { - if (typeof (ele[0]) === 'number') { - points.push({ - longitude: ele[0], - latitude: ele[1] - }) - } else { - points = ele.map(once => { - let lonlat = { - longitude: once[0], - latitude: once[1] - } - return lonlat - }) - } - }) - let polygon = { - points, - zIndex: 1, - } - return polygon; - }, - bindPickerChangeStart(e) { let sIdx = Number(e.detail.value); if (sIdx > this.data.indexEnd) { @@ -906,7 +866,6 @@ Page({ return item.geoms || item.geom; }).map(item => { let geomPoints = WKT.parse(item.geoms || item.geom); - console.log(geomPoints); let points = []; geomPoints.coordinates[0].forEach(ele => { if (typeof (ele[0]) === 'number') { @@ -924,9 +883,15 @@ Page({ }) } }) - let strokeColor = '' + item.line_color + util.ten2XO(item.line_opaqueness); - let strokeWidth = item.strokeWidth ? Number(item.strokeWidth) : 2; - let fillColor = '' + item.fill_color + util.ten2XO(item.fill_opaqueness); + let strokeColor; + let fillColor; + if(item.line_color){ + strokeColor = '' + item.line_color + util.ten2XO(item.line_opaqueness); + } + let strokeWidth = item.line_width ? Number(item.line_width) : 2; + if(item.fill_color){ + fillColor = '' + item.fill_color + util.ten2XO(item.fill_opaqueness); + } let polygon = { points, strokeColor, @@ -951,7 +916,6 @@ Page({ return item.geoms || item.geom; }).map(item => { let geomPoints = WKT.parse(item.geoms || item.geom); - console.log(geomPoints); let points = []; geomPoints.coordinates[0].forEach(ele => { if (typeof (ele[0]) === 'number') { @@ -969,9 +933,15 @@ Page({ }) } }) - let strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); - let strokeWidth = item.strokeWidth ? Number(item.strokeWidth) : 2; - let fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + let strokeColor; + let fillColor; + if(item.lineColor){ + strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); + } + let strokeWidth = item.lineWidth ? Number(item.lineWidth) : 2; + if(item.fillColor){ + fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + } let polygon = { points, strokeColor, diff --git a/pages/lookStay-detail/lookStay-detail.js b/pages/lookStay-detail/lookStay-detail.js index 9c63261..4a1d961 100644 --- a/pages/lookStay-detail/lookStay-detail.js +++ b/pages/lookStay-detail/lookStay-detail.js @@ -195,9 +195,15 @@ Page({ }) } }) - let strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); - let strokeWidth = item.strokeWidth ? Number(item.strokeWidth) : 2; - let fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + let strokeColor; + let fillColor; + if(item.lineColor){ + strokeColor = '' + item.lineColor + util.ten2XO(item.lineOpaqueness); + } + let strokeWidth = item.lineWidth ? Number(item.lineWidth) : 2; + if(item.fillColor){ + fillColor = '' + item.fillColor + util.ten2XO(item.fillOpaqueness); + } let polygon = { points, strokeColor,