地图默认中心点埋点
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</u-popup>
|
||||
|
||||
@@ -62,7 +61,7 @@ export default {
|
||||
polygons: []
|
||||
}
|
||||
},
|
||||
computed: {...mapState(['user'])},
|
||||
computed: {...mapState(['user', 'config'])},
|
||||
created() {
|
||||
this.$dict.load('girdType', 'girdLevel')
|
||||
this.areaId = this.user.areaId
|
||||
@@ -82,7 +81,7 @@ export default {
|
||||
arr.push(e.points.map(p => [p.lng, p.lat]))
|
||||
}
|
||||
})
|
||||
arr.length>0&&this.renderGridMap(arr)
|
||||
arr.length > 0 && this.renderGridMap(arr)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -94,33 +93,38 @@ export default {
|
||||
this.polygons.forEach(e => e.destroy())
|
||||
this.polygons = []
|
||||
}
|
||||
let bounds = []
|
||||
paths.forEach((path, i) => {
|
||||
let color = colors[i % colors.length]
|
||||
let polygon = new TMap.MultiPolygon({
|
||||
map, styles: {
|
||||
default: new TMap.PolygonStyle({
|
||||
showBorder: true,
|
||||
borderColor: color,
|
||||
borderWidth: 2,
|
||||
color: this.$colorUtils.Hex2RGBA(color, 0.1),
|
||||
borderDashArray: [10, 10]
|
||||
})
|
||||
},
|
||||
geometries: [{paths: path.map(e => new TMap.LatLng(e[1], e[0]))}]
|
||||
if (paths?.length > 0) {
|
||||
let bounds = []
|
||||
paths.forEach((path, i) => {
|
||||
let color = colors[i % colors.length]
|
||||
let polygon = new TMap.MultiPolygon({
|
||||
map, styles: {
|
||||
default: new TMap.PolygonStyle({
|
||||
showBorder: true,
|
||||
borderColor: color,
|
||||
borderWidth: 2,
|
||||
color: this.$colorUtils.Hex2RGBA(color, 0.1),
|
||||
borderDashArray: [10, 10]
|
||||
})
|
||||
},
|
||||
geometries: [{paths: path.map(e => new TMap.LatLng(e[1], e[0]))}]
|
||||
})
|
||||
this.polygons.push(polygon)
|
||||
bounds.push(fitBounds(path.map(e => new TMap.LatLng(e[1], e[0]))))
|
||||
})
|
||||
this.polygons.push(polygon)
|
||||
bounds.push(fitBounds(path.map(e => new TMap.LatLng(e[1], e[0]))))
|
||||
})
|
||||
bounds = bounds.reduce((a, b) => {
|
||||
return fitBounds([
|
||||
a.getNorthEast(),
|
||||
a.getSouthWest(),
|
||||
b.getNorthEast(),
|
||||
b.getSouthWest(),
|
||||
]);
|
||||
});
|
||||
map.fitBounds(bounds, {padding: 100})
|
||||
bounds = bounds.reduce((a, b) => {
|
||||
return fitBounds([
|
||||
a.getNorthEast(),
|
||||
a.getSouthWest(),
|
||||
b.getNorthEast(),
|
||||
b.getSouthWest(),
|
||||
]);
|
||||
});
|
||||
map.fitBounds(bounds, {padding: 100})
|
||||
} else {
|
||||
map.setCenter(this.config.latlng)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (count < 5) {
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user