Ver código fonte

change format of fence

git 5 anos atrás
pai
commit
d971c25d4d

+ 6 - 5
pages/amap/amap.js

@@ -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( );}
             });
 

+ 1 - 1
pages/amap/fence/fence.js

@@ -75,7 +75,7 @@
 
                   
                     if(fence.fenceInfo){
-                        var fenceInfo = JSON.parse(fence.fenceInfo).data;
+                        var fenceInfo = fence.fenceInfo.data;
                         fenceInfo.radius =  parseInt(fenceInfo.radius)
                         fenceInfo.center = new AMap.LngLat(fenceInfo.center.lng, fenceInfo.center.lat)
                         oldCircle.setCenter(fenceInfo.center);

+ 1 - 1
pages/baojing/baojing.html

@@ -15,7 +15,7 @@
         <input id='mobile' type="text">
     </div>
 	<div class="lr-form-row">
-        <label>选择日期</label>
+        <label>被盗日期</label>
         <div id="date2"></div>
     </div>
      <div class="lr-form-row">

+ 1 - 1
pages/baojing/baojing.js

@@ -44,7 +44,7 @@
 				//var plate = $('#plateselect').children("div").text();
 				var mobile = $('#mobile').val();
 				var date = $('#date2').children("div").text();
-				var stolencityid = $('#select3').children("div").text();
+				var stolencityid = $page.find('#select3').lrpickerGet('vaule');
 				console.log($page.find('#select3').lrpickerGet('vaule'));
 				var stolenaddress = $('#address').val();
 				var reason = $('#textarea').val();