|
@@ -186,6 +186,7 @@
|
|
|
//地图
|
|
|
|
|
|
var startEnd = {start: null, end: null};
|
|
|
+ var fenceCenterVehicle = null;
|
|
|
|
|
|
var routePageData = null;
|
|
|
|
|
@@ -238,17 +239,16 @@
|
|
|
getVehicleData = function(t, first=false){
|
|
|
var deviceNumber = renlian.storage.get('userinfo').baseinfo['deviceNumber'];
|
|
|
var licensePlate = renlian.storage.get('userinfo').baseinfo.plate;
|
|
|
+ var gpsNumber = renlian.storage.get('userinfo').baseinfo.gpsNumber;
|
|
|
var mapData = null;
|
|
|
- renlian.httpget(config.webapi+"/?s=api/get_map_index_data", {deviceNumber:deviceNumber, licensePlate:licensePlate}, function (_res) {
|
|
|
+ renlian.httpget(config.webapi+"/?s=api/get_map_index_data", {deviceNumber:deviceNumber, licensePlate:licensePlate, gpsNumber:gpsNumber}, function (_res) {
|
|
|
mapData = _res.data;
|
|
|
if(!mapData){
|
|
|
renlian.layer.warning('无地图数据,请检测网络或联系管理员!', function () { }, '提示', '关闭');
|
|
|
return;
|
|
|
}
|
|
|
- console.log(mapData);
|
|
|
latlngSign = mapData.vehicleLocation.longitude;
|
|
|
if(!latlngSign){
|
|
|
- console.log('test')
|
|
|
first = false;
|
|
|
t.map.setZoomAndCenter(15,startEnd.start);
|
|
|
t.vehicle.setPosition(null);
|
|
@@ -256,6 +256,7 @@
|
|
|
}else{
|
|
|
var vehiclePt = new AMap.LngLat(+mapData.vehicleLocation.longitude, +mapData.vehicleLocation.latitude);
|
|
|
startEnd.end = vehiclePt;
|
|
|
+ fenceCenterVehicle = vehiclePt;
|
|
|
t.vehicle.setPosition(vehiclePt);
|
|
|
t.vehicle.setMap(t.map);
|
|
|
}
|
|
@@ -305,7 +306,7 @@
|
|
|
var fence = mapData.fenceShapeInfo;
|
|
|
if(fence){
|
|
|
fence = JSON.parse(fence);
|
|
|
- var fenceInfo = JSON.parse(fence.fenceInfo)
|
|
|
+ var fenceInfo = fence.fenceInfo;
|
|
|
if(fenceInfo.type == 'circle'){
|
|
|
t.circle.setCenter(new AMap.LngLat(fenceInfo.data.center.lng, fenceInfo.data.center.lat));
|
|
|
t.circle.setRadius(parseInt(fenceInfo.data.radius));
|
|
@@ -471,7 +472,7 @@
|
|
|
|
|
|
//围栏页跳转
|
|
|
$('#electric-fence').on('tap', function () {
|
|
|
- renlian.nav.go({ path: 'amap/fence', title: '围栏设置', isBack: true, isHead: true, param: {default:startEnd.start} });
|
|
|
+ renlian.nav.go({ path: 'amap/fence', title: '围栏设置', isBack: true, isHead: true, param: {default: fenceCenterVehicle || startEnd.start} });
|
|
|
if(infoWindow){infoWindow.close( );}
|
|
|
});
|
|
|
|