|
|
|
@ -172,25 +172,34 @@ |
|
|
|
|
// tilerLayer |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
var options = { |
|
|
|
|
'showButton': true,//是否显示定位按钮 |
|
|
|
|
'buttonPosition': 'LB',//定位按钮的位置 |
|
|
|
|
/* LT LB RT RB */ |
|
|
|
|
'buttonOffset': new AMap.Pixel(10, 20),//定位按钮距离对应角落的距离 |
|
|
|
|
'showMarker': true,//是否显示定位点 |
|
|
|
|
'markerOptions':{//自定义定位点样式,同Marker的Options |
|
|
|
|
'offset': new AMap.Pixel(-18, -36), |
|
|
|
|
'content':'<img src="https://a.amap.com/jsapi_demos/static/resource/img/user.png" style="width:36px;height:36px"/>' |
|
|
|
|
}, |
|
|
|
|
'showCircle': true,//是否显示定位精度圈 |
|
|
|
|
'circleOptions': {//定位精度圈的样式 |
|
|
|
|
'strokeColor': '#0093FF', |
|
|
|
|
'noSelect': true, |
|
|
|
|
'strokeOpacity': 0.5, |
|
|
|
|
'strokeWeight': 1, |
|
|
|
|
'fillColor': '#02B0FF', |
|
|
|
|
'fillOpacity': 0.25 |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
map.plugin('AMap.Geolocation', function () { |
|
|
|
|
geolocation = new AMap.Geolocation({ |
|
|
|
|
enableHighAccuracy: true,//是否使用高精度定位,默认:true |
|
|
|
|
timeout: 5000, //超过10秒后停止定位,默认:无穷大 |
|
|
|
|
zoomToAccuracy:true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false |
|
|
|
|
buttonDom:'<img src="img/self-location.png" height="50" width="50"/>' |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function onComplete(obj){ |
|
|
|
|
console.log(obj.message); |
|
|
|
|
} |
|
|
|
|
var geolocation = new AMap.Geolocation(options); |
|
|
|
|
|
|
|
|
|
function onError(obj){ |
|
|
|
|
var position = new AMap.LngLat(clng, clat); // 标准写法 |
|
|
|
|
map.setCenter(position); |
|
|
|
|
} |
|
|
|
|
map.addControl(geolocation); |
|
|
|
|
AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息 |
|
|
|
|
AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息 |
|
|
|
|
|
|
|
|
|
geolocation.getCurrentPosition() |
|
|
|
|
map.event.addListener(geolocation, 'complete', onComplete);//返回定位信息 |
|
|
|
|
map.event.addListener(geolocation, 'error', onError); //返回定位出错信息 |
|
|
|
|
}); |
|
|
|
|
foundMarker(data); |
|
|
|
|
map.setZoom(start_maplevel) |
|
|
|
@ -352,7 +361,7 @@ |
|
|
|
|
name = data_marker[i].cname; |
|
|
|
|
data = JSON.stringify(data_marker[i]); |
|
|
|
|
img = '<img width="100%" onclick="toDetails(' + scenicId + ')" src="' + data_marker[i].imgsl + '\"style=\" width:5em; height:5em;"/>'; |
|
|
|
|
content = data_marker[i].content.substring(0, 30) + `...<br/><a style='color: #1FB8C9' onclick='toDetails(" + scenicId + ")\'>点击左侧查看详情</a>`; |
|
|
|
|
content = data_marker[i].content.substring(0, 30) + '...<br/><a style="color: #1FB8C9" onclick="toDetails(' + scenicId + ')"\'>点击左侧查看详情</a>'; |
|
|
|
|
video = data_marker[i].voiceurl; |
|
|
|
|
if (video == undefined || video == "" || video == null) { |
|
|
|
|
videoHtml = "<a><span ></span>暂无解说</a>"; |
|
|
|
|