소스 검색

battery display change, fix vehicle location offset

git 5 년 전
부모
커밋
b4b6933259
1개의 변경된 파일12개의 추가작업 그리고 5개의 파일을 삭제
  1. 12 5
      pages/amap/amap.js

+ 12 - 5
pages/amap/amap.js

@@ -250,7 +250,7 @@
             });
             var bicycleIcon = new AMap.Icon({size: new AMap.Size(32,32), image:'./images/bicycle-2.png', imageSize:new AMap.Size(32,32)})
             if(!vehicleMarker){
-                vehicleMarker = new AMap.Marker({icon:bicycleIcon, offset:new AMap.Pixel(0, -51)});
+                vehicleMarker = new AMap.Marker({icon:bicycleIcon, offset:new AMap.Pixel(0, -24)});
             }
             if(!circle){
                 circle = new AMap.Circle({
@@ -318,8 +318,14 @@
                         $('#battery').css({color:"gray"});
                     }else{
                         if(!mapData.battery){
-                            $('#battery').html('正常');
-                            $('#battery').css({color:"green"});
+                            if(mapData.onlineTime.online){
+                                $('#battery').html('正常');
+                                $('#battery').css({color:"green"});
+                            }else{
+                                $('#battery').html('正常');
+                                $('#battery').css({color:"gray"});
+                            }
+                            
                         }else{
                             $('#battery').html(mapData.battery);
                             $('#battery').css({color:"red"});
@@ -334,8 +340,9 @@
                     if(mapData.onlineTime){
                         routePageData = {speed: mapData.speed == null ? 0 : mapData.speed, lastTime:mapData.lastLoactionTime ? mapData.lastLoactionTime : ''};
                         if(mapData.onlineTime.online){
-                            $('#on-off-online').text('在线');
+                            $('#on-off-online').text('在线');
                             $('#on-off-online').css({color:"green"})
+                            // $('#battery').css({color:"gray"});
                         }else{
                             var display = mapData.onlineTime.humenDisplay;
                             $('#on-off-online').text('离线'+display);
@@ -443,7 +450,7 @@
                                     infoWindow = new SimpleInfoWindow({
                                     infoBody: '<span>'+address+'</span>',
                                     //基点指向marker的头部位置
-                                    offset: new AMap.Pixel(50, -64)
+                                    offset: new AMap.Pixel(50, -36)
                                 });
                             }
                             infoWindow.open(mainMap, lnglat);