Commit 4459abf6 authored by 黄奎's avatar 黄奎

页面修改

parent 56d1057c
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
mapboxgl.accessToken = mapboxgl.accessToken =
"pk.eyJ1IjoiYWxleDkwMTIiLCJhIjoiY2xtOGw4NHdkMGFndTNjcnFkeWZncGc2dyJ9.lVrAdPHE0Dg5zoWFidfj4Q"; "pk.eyJ1IjoiYWxleDkwMTIiLCJhIjoiY2xtOGw4NHdkMGFndTNjcnFkeWZncGc2dyJ9.lVrAdPHE0Dg5zoWFidfj4Q";
import html2Canvas from "html2canvas"; import html2Canvas from "html2canvas";
import { continueRobotMsg } from '../../../store/actions/msgs'; import {
continueRobotMsg
} from '../../../store/actions/msgs';
export default { export default {
props: ["PostConfig"], props: ["PostConfig"],
data() { data() {
...@@ -95,7 +97,7 @@ import { continueRobotMsg } from '../../../store/actions/msgs'; ...@@ -95,7 +97,7 @@ import { continueRobotMsg } from '../../../store/actions/msgs';
deviceMarkers: [], //城市Markers deviceMarkers: [], //城市Markers
allMapCityList: [], //地图显示所有城市 allMapCityList: [], //地图显示所有城市
countriesMarkers: [], //国家的Markers countriesMarkers: [], //国家的Markers
chooseCountry: [], //选中的国家 chooseCountry: [], //选中的国家
chooseCity: [], //选中的城市 chooseCity: [], //选中的城市
}; };
...@@ -213,10 +215,11 @@ import { continueRobotMsg } from '../../../store/actions/msgs'; ...@@ -213,10 +215,11 @@ import { continueRobotMsg } from '../../../store/actions/msgs';
this.map.fitBounds(bounds, { this.map.fitBounds(bounds, {
padding: 150, // 可选:在地图边界周围添加一些内边距 padding: 150, // 可选:在地图边界周围添加一些内边距
}); });
if (this.countriesData && this.countriesData.length > 0 && this.countriesData.length == 1) {
this.map.setCenter(bounds.getCenter());
}
} }
if (this.countriesData && this.countriesData.length > 0 && this.countriesData.length == 1) {
this.map.setCenter(bounds.getCenter());
}
this.addMarker(); //标记 this.addMarker(); //标记
this.createLineHandler(); this.createLineHandler();
await this.addCountriesMaker(); //标记国家 await this.addCountriesMaker(); //标记国家
...@@ -232,17 +235,25 @@ import { continueRobotMsg } from '../../../store/actions/msgs'; ...@@ -232,17 +235,25 @@ import { continueRobotMsg } from '../../../store/actions/msgs';
return cItem.ID === countryItem; return cItem.ID === countryItem;
}); });
if (tempCountry && tempCountry.ID > 0) { if (tempCountry && tempCountry.ID > 0) {
var countryLng = "";
var countryLat = "";
if (tempCountry.Lng) {
countryLng = Number(tempCountry.Lng);
}
if (tempCountry.Lng) {
countryLat = Number(tempCountry.Lat);
}
let countryObj = { let countryObj = {
Id: 0, Id: 0,
MName: tempCountry.Name, MName: tempCountry.Name,
name: tempCountry.Name, name: tempCountry.Name,
MId: tempCountry.ID, MId: tempCountry.ID,
ColorStr: this.PostConfig.TripColor ? this.PostConfig.TripColor : "#409eff", ColorStr: this.PostConfig.TripColor ? this.PostConfig.TripColor : "#409eff",
Lng: tempCountry.Lng, Lng: countryLng,
Lat: tempCountry.Lat, Lat: countryLat,
longitude: tempCountry.Lng, longitude: countryLng,
latitude: tempCountry.Lat, latitude: countryLat,
MType:1, MType: 1,
}; };
//判断是否存在国家 //判断是否存在国家
let tempCountryIndex = this.countriesData.findIndex(y => y.MName == countryObj.MName) let tempCountryIndex = this.countriesData.findIndex(y => y.MName == countryObj.MName)
...@@ -259,6 +270,14 @@ import { continueRobotMsg } from '../../../store/actions/msgs'; ...@@ -259,6 +270,14 @@ import { continueRobotMsg } from '../../../store/actions/msgs';
var tempCity = this.SourceCityList.find((cItem) => { var tempCity = this.SourceCityList.find((cItem) => {
return cItem.ID === qcity; return cItem.ID === qcity;
}); });
var cityLng = "";
var cityLat = "";
if (tempCity.Lng) {
cityLng = Number(tempCity.Lng);
}
if (tempCity.Lng) {
cityLat = Number(tempCity.Lat);
}
var cityObj = { var cityObj = {
Id: 0, Id: 0,
MName: tempCity.Name, MName: tempCity.Name,
...@@ -266,12 +285,12 @@ import { continueRobotMsg } from '../../../store/actions/msgs'; ...@@ -266,12 +285,12 @@ import { continueRobotMsg } from '../../../store/actions/msgs';
MId: tempCity.ID, MId: tempCity.ID,
PMName: tempCity.CountryName, PMName: tempCity.CountryName,
ColorStr: this.PostConfig.TripColor ? this.PostConfig.TripColor : "#409eff", ColorStr: this.PostConfig.TripColor ? this.PostConfig.TripColor : "#409eff",
Lng: tempCity.Lng, Lng: cityLng,
Lat: tempCity.Lat, Lat: cityLat,
longitude: tempCity.Lng, longitude: cityLng,
latitude: tempCity.Lat, latitude: cityLat,
ParentId: tempCity.CountryId, ParentId: tempCity.CountryId,
MType:2, MType: 2,
} }
//判断城市是否存在 //判断城市是否存在
let tempCityIndex = this.citiesData.findIndex(y => y.MName == cityObj.MName) let tempCityIndex = this.citiesData.findIndex(y => y.MName == cityObj.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