Commit c4d32c73 by wangzhihui

区域查车百度转高德

1 parent 05befc34
...@@ -569,13 +569,21 @@ export default { ...@@ -569,13 +569,21 @@ export default {
}); });
}); });
}, },
// 将坐标转换封装为返回 Promise 的函数
convertCoordinate(item) {
item = item.split(",")
return new Promise((resolve) => {
AMap.invoke('Convertor', [AMap.invoke('Point', item[0], item[1])], 3, 5, res => {
const convertedPoint = res.points.length ? res.points[0] : item;
resolve(convertedPoint);
});
});
},
// 区域查车 // 区域查车
async getAreaLocation() { async getAreaLocation() {
let _this = this; let _this = this;
let params = this.getParams(); let params = this.getParams();
let _options = this.$route.query; let _options = this.$route.query;
console.log(_options);
if (!_this.rectangle) { if (!_this.rectangle) {
showToast({ showToast({
...@@ -596,6 +604,14 @@ export default { ...@@ -596,6 +604,14 @@ export default {
_this.loading = true; _this.loading = true;
delete params.paths; delete params.paths;
let left = await this.convertCoordinate(params.leftLngLat)
let right = await this.convertCoordinate(params.rightLngLat)
params.leftLngLat = `${left.lng},${
left.lat
}`;
params.rightLngLat = `${right.lng},${
right.lat
}`;
let res = await GER_REGIONAL_SEARCH(params); let res = await GER_REGIONAL_SEARCH(params);
console.log(res, "res"); console.log(res, "res");
_this.loading = false; _this.loading = false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!