Commit 1000f308 authored by youjie's avatar youjie

no message

parent 1d280a52
...@@ -354,19 +354,20 @@ export default { ...@@ -354,19 +354,20 @@ export default {
x.CityList.forEach(y => { x.CityList.forEach(y => {
listCity.push(y.MName); listCity.push(y.MName);
this.listCity.push({ this.listCity.push({
PMName: x.MName,
MName: y.MName, MName: y.MName,
MId: y.MId MId: y.MId
}); });
}); });
}); });
this.pois = listCity.join(","); this.pois = listCity.join(",");
this.citys = [...new Set(this.pois.split(","))]; this.citys = [...new Set(this.listCity)];//[...new Set(this.pois.split(","))]
this.clearCitiesMarkersHandler(); this.clearCitiesMarkersHandler();
this.citiesData = this.citiesData.filter( this.citiesData = this.citiesData.filter(
x => this.citys.indexOf(x.name) != -1 x => this.citys.indexOf(x.name) != -1
); );
this.citys = this.citys.filter( this.citys = this.citys.filter(
x => this.citiesData.findIndex(y => y.name == x) == -1 x => this.citiesData.findIndex(y => y.name == x.MName) == -1
); );
// console.log(this.citys,'-----222') // console.log(this.citys,'-----222')
// console.log(this.citiesData,'-----111') // console.log(this.citiesData,'-----111')
...@@ -753,10 +754,10 @@ export default { ...@@ -753,10 +754,10 @@ export default {
this.deviceMarkers.push(marker); this.deviceMarkers.push(marker);
}, },
async getCoordinates(cityName) { async getCoordinates(x) {
try { try {
const response = await fetch( const response = await fetch(
`https://api.mapbox.com/geocoding/v5/mapbox.places/${cityName}.json?types=place&access_token=pk.eyJ1IjoiYWxleDkwMTIiLCJhIjoiY2xtOGw4NHdkMGFndTNjcnFkeWZncGc2dyJ9.lVrAdPHE0Dg5zoWFidfj4Q` `https://api.mapbox.com/geocoding/v5/mapbox.places/${x.PMName}/${x.MName}.json?types=place&access_token=pk.eyJ1IjoiYWxleDkwMTIiLCJhIjoiY2xtOGw4NHdkMGFndTNjcnFkeWZncGc2dyJ9.lVrAdPHE0Dg5zoWFidfj4Q`
); );
if (!response.ok) { if (!response.ok) {
...@@ -766,9 +767,9 @@ export default { ...@@ -766,9 +767,9 @@ export default {
const data = await response.json(); const data = await response.json();
if (data.features.length > 0) { if (data.features.length > 0) {
const [longitude, latitude] = data.features[0].center; const [longitude, latitude] = data.features[0].center;
let tempI = this.citiesData.findIndex(y=>y.name==cityName) let tempI = this.citiesData.findIndex(y=>y.name==x.MName)
if(tempI==-1) this.citiesData.push({ if(tempI==-1) this.citiesData.push({
name: cityName, name: x.MName,
longitude, longitude,
latitude, latitude,
Lng: "", Lng: "",
...@@ -945,6 +946,7 @@ export default { ...@@ -945,6 +946,7 @@ export default {
let TripMapList = that.TripMapList.filter(y=> y.MName==x.MName) let TripMapList = that.TripMapList.filter(y=> y.MName==x.MName)
TripMapList[0].Lng = currentMarkerLngLat.lng; TripMapList[0].Lng = currentMarkerLngLat.lng;
TripMapList[0].Lat = currentMarkerLngLat.lat; TripMapList[0].Lat = currentMarkerLngLat.lat;
console.log(that.TripMapList,'====that.TripMapList')
marker.on("dragend", function() { marker.on("dragend", function() {
currentMarkerLngLat = marker.getLngLat(); currentMarkerLngLat = marker.getLngLat();
TripMapList = that.TripMapList.filter(y=> y.MName==x.MName) TripMapList = that.TripMapList.filter(y=> y.MName==x.MName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment