|
@@ -18,20 +18,24 @@
|
|
|
map.on('complete', function(){
|
|
|
renlian.layer.loading(false);
|
|
|
|
|
|
- });
|
|
|
+ });
|
|
|
+ var riding = null;
|
|
|
|
|
|
var userMarker = new AMap.Marker({icon: "./images/location.png", offset:new AMap.Pixel(-16, -16)});
|
|
|
|
|
|
//骑行导航
|
|
|
- var riding = new AMap.Riding({
|
|
|
- map: map,
|
|
|
- autoFitView: true
|
|
|
- });
|
|
|
+ if(!riding){
|
|
|
+ var riding = new AMap.Riding({
|
|
|
+ map: map,
|
|
|
+ autoFitView: true
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//根据起终点坐标规划骑行路线
|
|
|
riding.search(param.start, param.end, function(status, result) {
|
|
|
// result即是对应的骑行路线数据信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_RidingResult
|
|
|
if (status === 'complete') {
|
|
|
- renlian.layer.toast('绘制骑行路线完成:');
|
|
|
+ // renlian.layer.toast('绘制骑行路线完成:');
|
|
|
} else {
|
|
|
renlian.layer.toast('骑行路线数据查询失败:' + result);
|
|
|
}
|
|
@@ -57,7 +61,7 @@
|
|
|
// onError Callback receives a PositionError object
|
|
|
//
|
|
|
function onError(error) {
|
|
|
- alert('code: ' + error.code + '\n' +
|
|
|
+ console.log('code: ' + error.code + '\n' +
|
|
|
'message: ' + error.message + '\n');
|
|
|
}
|
|
|
navigator.geolocation.getCurrentPosition(onSuccess, onError);
|
|
@@ -89,13 +93,17 @@
|
|
|
}else{console.log(JSON.stringify(result))}
|
|
|
});
|
|
|
}
|
|
|
- }, 2000);
|
|
|
+ }, 10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ reload:function(pageinfo){
|
|
|
+ console.log('testsfadfasd')
|
|
|
}
|
|
|
};
|
|
|
|