|
@@ -178,17 +178,21 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
mapEvent(e) {
|
|
|
- const arr = this.data.list[this.data.dataIndex].polygon.map(item => {
|
|
|
- return [
|
|
|
- item.longitude,
|
|
|
- item.latitude
|
|
|
- ]
|
|
|
- })
|
|
|
- if (this.pointInPolygon([e.detail.longitude, e.detail.latitude], arr)) {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/map2/map?dataIndex=' + this.data.dataIndex + '&type=tdcr',
|
|
|
+ this.data.list[this.data.dataIndex].polygon.forEach(item => {
|
|
|
+ const arr = item.map(p => {
|
|
|
+ return [
|
|
|
+ p.longitude,
|
|
|
+ p.latitude
|
|
|
+ ]
|
|
|
})
|
|
|
- }
|
|
|
+ if (this.pointInPolygon([e.detail.longitude, e.detail.latitude], arr)) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/map2/map?dataIndex=' + this.data.dataIndex + '&type=tdcr',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
pointInPolygon(point, polygon) {
|
|
|
let x = point[0], y = point[1];
|