|
@@ -3,11 +3,11 @@
|
|
|
var lnglat;
|
|
|
var mainMap;
|
|
|
var getVehicleData;
|
|
|
- var vehicleMarker;
|
|
|
- var overlayData;
|
|
|
- var vehicleMarker;
|
|
|
- var circle;
|
|
|
- var userInfo;
|
|
|
+ var overlayData;//
|
|
|
+ var vehicleMarker;//车辆marker
|
|
|
+ var circle;//主页显示围栏
|
|
|
+ var userInfo;//用户信息
|
|
|
+ var timeInterval = 10000;//定时刷新车辆数据间隔ms
|
|
|
var page = {
|
|
|
init: function ($page) {
|
|
|
userInfo = renlian.storage.get('userinfo');
|
|
@@ -195,11 +195,14 @@
|
|
|
|
|
|
get_mobile_gps_location();
|
|
|
//车辆信息初始化
|
|
|
- var timeInterval = 10000;
|
|
|
//地图初始化
|
|
|
+ var defaultCity = renlian.storage.get('userinfo').baseinfo.defaultCity;
|
|
|
+ if(!defaultCity){
|
|
|
+ defaultCity = [109.84040,40.658168];
|
|
|
+ }
|
|
|
if(!mainMap){
|
|
|
mainMap = new AMap.Map('amapcontainer', {
|
|
|
- center: [120.202222,30.184811],
|
|
|
+ center: defaultCity,
|
|
|
zoom: 15
|
|
|
});
|
|
|
}
|
|
@@ -254,6 +257,7 @@
|
|
|
if(!latlngSign){
|
|
|
first = false;
|
|
|
if(first){
|
|
|
+ console.log('first');
|
|
|
t.map.setZoomAndCenter(15,startEnd.start);
|
|
|
}
|
|
|
t.vehicle.setPosition(null);
|
|
@@ -268,6 +272,7 @@
|
|
|
}
|
|
|
|
|
|
if(first){
|
|
|
+ console.log('firstB');
|
|
|
t.map.setZoomAndCenter(15,vehiclePt);
|
|
|
}
|
|
|
|
|
@@ -290,25 +295,23 @@
|
|
|
|
|
|
//在线状态
|
|
|
if(mapData.onlineTime){
|
|
|
- var routeTime = new Date(mapData.onlineTime*1000);
|
|
|
- routePageData = {speed: mapData.speed == null ? 0 : mapData.speed, lastTime:routeTime.Format("yyyy-MM-dd hh:mm:ss")};
|
|
|
- var interval = parseInt(new Date().getTime()/1000) - mapData.onlineTime;
|
|
|
- if(interval < 24*3600){
|
|
|
+ routePageData = {speed: mapData.speed == null ? 0 : mapData.speed, lastTime:mapData.lastLoactionTime ? mapData.lastLoactionTime : ''};
|
|
|
+ if(mapData.onlineTime.online){
|
|
|
$('#on-off-online').text('在线中');
|
|
|
$('#on-off-online').css({color:"green"})
|
|
|
}else{
|
|
|
- var day = parseInt(interval/24/3600);
|
|
|
- $('#on-off-online').text('离线'+day+'天');
|
|
|
+ var display = mapData.onlineTime.humenDisplay;
|
|
|
+ $('#on-off-online').text('离线'+display);
|
|
|
$('#on-off-online').css({color:"gray"})
|
|
|
}
|
|
|
}else{
|
|
|
$('#on-off-online').text('未在线过');
|
|
|
$('#on-off-online').css({color:"gray"})
|
|
|
- var routeTime = new Date(0);
|
|
|
- routePageData = {speed: mapData.speed == null ? 0 : mapData.speed, lastTime:routeTime.Format("yyyy-MM-dd hh:mm:ss")};
|
|
|
+ routePageData = {speed: mapData.speed == null ? 0 : mapData.speed, lastTime:''};
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
var fence = mapData.fenceShapeInfo;
|
|
|
if(fence){
|
|
|
fence = JSON.parse(fence);
|
|
@@ -473,7 +476,7 @@
|
|
|
|
|
|
//轨迹页跳转
|
|
|
$('#route-play').on('tap', function () {
|
|
|
- renlian.nav.go({ path: 'amap/route', title: '轨迹回放', isBack: true, isHead: true, param: {textData:routePageData, defaultCenter: defaultCenter || startEnd.start} });
|
|
|
+ renlian.nav.go({ path: 'amap/route', title: '轨迹回放', isBack: true, isHead: true, param: {textData:routePageData, defaultCenter: defaultCenter || startEnd.start || null} });
|
|
|
if(infoWindow){infoWindow.close( );}
|
|
|
});
|
|
|
|
|
@@ -502,7 +505,6 @@
|
|
|
|
|
|
|
|
|
reload: function ($page, pageinfo) {
|
|
|
-
|
|
|
if(userInfo.baseinfo.token != renlian.storage.get('userinfo').baseinfo.token){
|
|
|
vehicleMarker.setMap(null);
|
|
|
infoWindow = null;
|