|
@@ -158,11 +158,11 @@
|
|
|
var that = this
|
|
|
this.makeJsonData()
|
|
|
AMapLoader.load({
|
|
|
- "key": "211dd6f989e719022aaf47ddb0659c47", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
- "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
- "plugins": ['plugin=AMap.Scale', 'AMap.ToolBar','AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch','AMap.Geolocation', 'Geolocation'],
|
|
|
- "Loca": { // 是否加载 Loca, 缺省不加载
|
|
|
- "version": '2.0.0' // Loca 版本,缺省 1.3.2
|
|
|
+ 'key': '211dd6f989e719022aaf47ddb0659c47', // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
+ 'version': '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
+ 'plugins': ['plugin=AMap.Scale', 'AMap.ToolBar','AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch','AMap.Geolocation', 'Geolocation'],
|
|
|
+ 'Loca': { // 是否加载 Loca, 缺省不加载
|
|
|
+ 'version': '2.0.0' // Loca 版本,缺省 1.3.2
|
|
|
},
|
|
|
}).then((AMap) => {
|
|
|
this.loadmap()
|
|
@@ -192,26 +192,26 @@
|
|
|
_coordinates1.push(Number(_position1[1]))
|
|
|
_coordinates1.push(Number(_position1[0]))
|
|
|
let _obj1 = {
|
|
|
- "type": "Feature",
|
|
|
- "properties": {
|
|
|
- "type": i,
|
|
|
+ 'type': 'Feature',
|
|
|
+ 'properties': {
|
|
|
+ 'type': i,
|
|
|
},
|
|
|
- "geometry": {
|
|
|
- "type": "Point",
|
|
|
- "coordinates": _coordinates1
|
|
|
+ 'geometry': {
|
|
|
+ 'type': 'Point',
|
|
|
+ 'coordinates': _coordinates1
|
|
|
}
|
|
|
}
|
|
|
let _position11 = _data.startPlace ? _data.startPlace.split(',') : []
|
|
|
_coordinates11.push(Number(_position11[1]))
|
|
|
_coordinates11.push(Number(_position11[0]))
|
|
|
let _obj11 = {
|
|
|
- "type": "Feature",
|
|
|
- "properties": {
|
|
|
- "type": i,
|
|
|
+ 'type': 'Feature',
|
|
|
+ 'properties': {
|
|
|
+ 'type': i,
|
|
|
},
|
|
|
- "geometry": {
|
|
|
- "type": "Point",
|
|
|
- "coordinates": _coordinates11
|
|
|
+ 'geometry': {
|
|
|
+ 'type': 'Point',
|
|
|
+ 'coordinates': _coordinates11
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -235,31 +235,31 @@
|
|
|
_marker.name = _data.name
|
|
|
this.markerList.push(_marker)
|
|
|
let _obj2 = {
|
|
|
- "type": "Feature",
|
|
|
- "properties": {
|
|
|
+ 'type': 'Feature',
|
|
|
+ 'properties': {
|
|
|
|
|
|
},
|
|
|
- "geometry": {
|
|
|
- "type": "LineString",
|
|
|
- "coordinates": _coordinates2
|
|
|
+ 'geometry': {
|
|
|
+ 'type': 'LineString',
|
|
|
+ 'coordinates': _coordinates2
|
|
|
}
|
|
|
}
|
|
|
_features2.push(_obj2)
|
|
|
}
|
|
|
this.mapPointData = {
|
|
|
- "type": "FeatureCollection",
|
|
|
- "features": _features1
|
|
|
+ 'type': 'FeatureCollection',
|
|
|
+ 'features': _features1
|
|
|
}
|
|
|
this.mapLineData = {
|
|
|
- "type": "FeatureCollection",
|
|
|
- "features": _features2
|
|
|
+ 'type': 'FeatureCollection',
|
|
|
+ 'features': _features2
|
|
|
}
|
|
|
- console.log("this.mapPointData", this.mapPointData)
|
|
|
- console.log("this.mapPointData", this.mapLineData)
|
|
|
+ console.log('this.mapPointData', this.mapPointData)
|
|
|
+ console.log('this.mapPointData', this.mapLineData)
|
|
|
|
|
|
},
|
|
|
loadmap(val) {
|
|
|
- var map = new AMap.Map('mapContainer', {
|
|
|
+ let map = new AMap.Map('mapContainer', {
|
|
|
zoom: 4.89,
|
|
|
showLabel: true,
|
|
|
viewMode: '3D',
|
|
@@ -270,13 +270,13 @@
|
|
|
showIndoorMap: false,
|
|
|
});
|
|
|
|
|
|
- var loca = new Loca.Container({
|
|
|
+ let loca = new Loca.Container({
|
|
|
map,
|
|
|
});
|
|
|
for (let i = 0; i < this.markerList.length; i++) {
|
|
|
// 构造点标记
|
|
|
if (this.markerList[i].iconSrc[0] && this.markerList[i].iconSrc[1]) {
|
|
|
- var marker = new AMap.Marker({
|
|
|
+ let marker = new AMap.Marker({
|
|
|
position: this.markerList[i].iconSrc,
|
|
|
anchor: 'bottom-center',
|
|
|
icon: new AMap.Icon({
|
|
@@ -288,7 +288,7 @@
|
|
|
map.add(marker);
|
|
|
marker.setLabel({
|
|
|
offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
|
|
|
- content: "<div class = 'maker-item'>" + this.markerList[i].name + "</div>", //设置文本标注内容
|
|
|
+ content: '<div class = \'maker-item\'>' + this.markerList[i].name + '</div>', //设置文本标注内容
|
|
|
direction: 'right' //设置文本标注方位
|
|
|
|
|
|
});
|
|
@@ -301,8 +301,8 @@
|
|
|
this.timer = setInterval(function() {
|
|
|
_markerDom[_index].style.opacity = 1
|
|
|
_markerDom[_index].style.transition = '2s'
|
|
|
- var elseLi = _markerDom;
|
|
|
- for (var i = 0; i < elseLi.length; i++) {
|
|
|
+ let elseLi = _markerDom;
|
|
|
+ for (let i = 0; i < elseLi.length; i++) {
|
|
|
if (elseLi[i] !== _markerDom[_index]) { //判断是否是ele节点,是否与触发事件的节点相同
|
|
|
elseLi[i].style.opacity = 0
|
|
|
_markerDom[_index].style.transition = '2s'
|
|
@@ -314,7 +314,7 @@
|
|
|
|
|
|
|
|
|
// 呼吸点
|
|
|
- var scatter = new Loca.ScatterLayer({
|
|
|
+ let scatter = new Loca.ScatterLayer({
|
|
|
loca,
|
|
|
zIndex: 10,
|
|
|
opacity: 0.6,
|
|
@@ -322,7 +322,7 @@
|
|
|
zooms: [2, 22],
|
|
|
});
|
|
|
|
|
|
- var pointGeo = new Loca.GeoJSONSource({
|
|
|
+ let pointGeo = new Loca.GeoJSONSource({
|
|
|
// url: 'https://a.amap.com/Loca/static/loca-v2/demos/mock_data/pulselink-china-city-point.json',
|
|
|
data: this.mapPointData
|
|
|
});
|
|
@@ -338,7 +338,7 @@
|
|
|
loca.add(scatter);
|
|
|
|
|
|
// 弧线
|
|
|
- var pulseLink = new Loca.PulseLinkLayer({
|
|
|
+ let pulseLink = new Loca.PulseLinkLayer({
|
|
|
// loca,
|
|
|
zIndex: 10,
|
|
|
opacity: 1,
|
|
@@ -347,7 +347,7 @@
|
|
|
depth: true,
|
|
|
});
|
|
|
|
|
|
- var geo = new Loca.GeoJSONSource({
|
|
|
+ let geo = new Loca.GeoJSONSource({
|
|
|
// url: 'https://a.amap.com/Loca/static/loca-v2/demos/mock_data/data-line-out.json',
|
|
|
data: this.mapLineData
|
|
|
});
|