|
@@ -17,6 +17,7 @@
|
|
|
myStyle:"width: 100%; height: 1200rpx;",
|
|
|
chargerIcon:'',
|
|
|
chargerSelectedIcon:'',
|
|
|
+ positionIcon:'',
|
|
|
personIcon:'',
|
|
|
longitude: 112.276527,
|
|
|
latitude: 30.306427,
|
|
@@ -284,6 +285,21 @@
|
|
|
this.myEmit("person",marker,pos)
|
|
|
//this.chargerList.push(marker)
|
|
|
},
|
|
|
+ /*
|
|
|
+ addPosition() {
|
|
|
+ console.log('addPosition'+JSON.stringify(pos))
|
|
|
+ let marker = new AMap.Marker({
|
|
|
+ content: "<img src='"+this.positionIcon+"' style='height: 40px;width: 40px' />",
|
|
|
+ //icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
|
|
|
+ //position: [pos.longitude,pos.latitude],
|
|
|
+ offset: new AMap.Pixel(20, 220),
|
|
|
+ zIndex:900,
|
|
|
+ autoRotation: true,
|
|
|
+ });
|
|
|
+ marker.setMap(this.mapcharger);
|
|
|
+ //this.myEmit("person",marker,pos)
|
|
|
+ //this.chargerList.push(marker)
|
|
|
+ },*/
|
|
|
setChargerList(sz){
|
|
|
|
|
|
if(this.AMap==null){
|
|
@@ -387,6 +403,7 @@
|
|
|
init(){
|
|
|
// console.log('init')
|
|
|
var _this = this;
|
|
|
+// this.positionIcon = require('@/static/img/location.png')
|
|
|
// this.personIcon = require("@/static/img/charger_selected.png")
|
|
|
// this.chargerIcon = require("@/static/img/charger.png");
|
|
|
// this.chargerSelectedIcon = require("@/static/img/charger_selected_circle.png");
|
|
@@ -402,11 +419,68 @@
|
|
|
center: [this.longitude, this.latitude],
|
|
|
zoom: 14
|
|
|
});
|
|
|
+ /*
|
|
|
+ new SimpleMarker({
|
|
|
+ iconLabel: '2',
|
|
|
+ //自定义图标节点(img)的属性
|
|
|
+ iconStyle: {
|
|
|
+
|
|
|
+ src: '@/static/img/location.png',
|
|
|
+ style: {
|
|
|
+ width: '20px',
|
|
|
+ height: '30px'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //设置基点偏移
|
|
|
+ offset: new AMap.Pixel(-10, -30),
|
|
|
+
|
|
|
+ map: map,
|
|
|
+ showPositionPoint: true,
|
|
|
+ position: lngLats[1],
|
|
|
+ zIndex: 200
|
|
|
+ });
|
|
|
+*/
|
|
|
+ /*
|
|
|
+ _this.mapcharger.plugin('AMap.Geolocation', function () {
|
|
|
+ var geolocation = new AMap.Geolocation({
|
|
|
+ enableHighAccuracy: true,
|
|
|
+ timeout: 10000,
|
|
|
+ buttonOffset: new AMap.Pixel(10, 220),
|
|
|
+ zoomToAccuracy: true,
|
|
|
+ buttonPosition: 'RB'
|
|
|
+ });
|
|
|
+ _this.mapcharger.center = geolocation;
|
|
|
+ _this.mapcharger.addControl(geolocation);//地图控件右下角显示当前位置
|
|
|
+ });
|
|
|
+
|
|
|
+ _this.mapcharger.plugin(["AMap.ToolBar"],function(){
|
|
|
+ //加载工具条
|
|
|
+ var tool = new AMap.ToolBar({
|
|
|
+ locate:true,
|
|
|
+ direction:false,
|
|
|
+ ruler:false,
|
|
|
+ liteStyle:true,
|
|
|
+ useNative:true,
|
|
|
+// autoPosition:true,
|
|
|
+// locationMarker:
|
|
|
+ });
|
|
|
+ _this.mapcharger.addControl(tool);
|
|
|
+ });*/
|
|
|
+ /*
|
|
|
+ _this.mapcharger.plugin(["AMap.ControlBar"],function(){
|
|
|
+ var controlBar = new AMap.ControlBar({
|
|
|
+ showZoomBar:true,
|
|
|
+ showControlButton:true,
|
|
|
+ position:{top:'10px',right:'10px'}
|
|
|
+ })
|
|
|
+ _this.mapcharger.addControl(controlBar)
|
|
|
+ });*/
|
|
|
//var clickHandler = function(e) {
|
|
|
// console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
|
|
|
//};
|
|
|
//_this.mapcharger.on('click', clickHandler);
|
|
|
_this.$emit('onload')
|
|
|
+ //_this.addPosition();
|
|
|
_this.listenMove();
|
|
|
|
|
|
}, e => {
|