git 6 年之前
父節點
當前提交
676b911ad8

二進制
images/gelocation.png


二進制
images/icon-anchor.png


+ 6 - 1
index.html

@@ -11,9 +11,13 @@
         <meta name="format-detection" content="telephone=no">
         <meta name="msapplication-tap-highlight" content="no">
         <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
+        
+        <!-- <link rel="stylesheet" type="text/css" href="css/mui.min.css"> -->
         <link rel="stylesheet" type="text/css" href="font/iconfont.css">
+        
         <link rel="stylesheet" type="text/css" href="css/lrmui.min.css">
         <link rel="stylesheet" type="text/css" href="css/index.css">
+
         <title>力软敏捷框架</title>
     </head>
     <body>
@@ -28,7 +32,8 @@
         <script type="text/javascript" src="config/config.js"></script>
         <script type="text/javascript" src="scripts/learun-custmerform.js"></script>
         <script type="text/javascript" src="scripts/index.js"></script>
-        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.12&key=78735d0efd243f8085837edf355526cb"></script>
+        <script type="text/javascript" src="scripts/fence-slider.js"></script>
+        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.12&key=78735d0efd243f8085837edf355526cb&plugin=AMap.Riding"></script>
         
         <!-- ui组件库 -->
         <script src="https://webapi.amap.com/ui/1.0/main.js"></script>

+ 30 - 4
pages/amap/amap.js

@@ -110,9 +110,15 @@
 			}
 			init_nav();
 
-			
+            
+            
+            var startEnd = {start:new AMap.LngLat(113.951104,22.542902), end:new AMap.LngLat(113.955439,22.542956)};
 
+            var fencePageData = null;
 
+            var userIcon = new AMap.Icon({size: new AMap.Size(50,50), image:'./images/gelocation.png'})
+            var userMarker = new AMap.Marker({icon: userIcon, offset:new AMap.Pixel(10, 10),position:[113.952,22.542991]});
+            
             //车辆信息初始化
             learun.timeInterval = 5000;
             //地图初始化
@@ -174,18 +180,33 @@
                         t.circle.setCenter(new AMap.LngLat(fence.data.center.lng, fence.data.center.lat));
                         t.circle.setRadius(fence.data.radius);
                     
-                        t.circle.setMap(t.map);                   
+                        t.circle.setMap(t.map);                 
                     }
 
                     if(mapData.lockStatus == 1){
                         $page.find('#lockStatus').removeClass('icon-jiesuo');
                         $page.find('#lockStatus').addClass('icon-suo');
                     }
+                    
+                    fencePageData = {fenceInfo: fence, defaultLocation: vehiclePt};
                 });
          
             };
 
-// 
+
+
+
+
+            //定位
+            $page.find('#user-location').on('tap', function(){
+                get_mobile_gps_location(function(position){
+                    // position.coords.latitude
+                    var lnglat = new AMap.LngLat(position.coords.longitude, position.coords.latitude);
+                    userMarker.setPosition(lnglat);
+                    userMarker.setMap(learun.map);
+                    learun.map.setFitView();
+                });
+            });
             
             //锁车
             $page.find('#car-lock').on('tap', function(){
@@ -233,7 +254,7 @@
                 openInfoWin();
                 //marker 点击时打开
                 infoWindow.get$Container().on('click', function(){
-                    learun.nav.go({ path: 'amap/navigation', title: '导航', isBack: true, isHead: true, param: '我是一个参数' });
+                    learun.nav.go({ path: 'amap/navigation', title: '导航', isBack: true, isHead: true, param: startEnd });
                 });
         
                 
@@ -288,6 +309,11 @@
                 learun.nav.go({ path: 'amap/route', title: '轨迹回放', isBack: true, isHead: true, param: '我是一个参数' });
             });
 
+            //围栏页跳转
+            $page.find('#electric-fence').on('tap', function () {
+                learun.nav.go({ path: 'amap/fence', title: '围栏设置', isBack: true, isHead: true, param: fencePageData });
+            });
+
 
             //定时刷新数据
             

+ 161 - 0
pages/amap/fence/fence.css

@@ -0,0 +1,161 @@
+.fence-layout{
+    display: flex;
+    flex-direction: column;
+    height: 100%;
+}
+
+.fence-range{
+    flex: 0 0 auto;
+}
+
+.amap-fence-contarner{
+    flex: 1 0 auto;
+}
+
+.fence-isable{
+    width: 100%;
+    flex: 0 0 auto;
+    min-height: 40px;
+}
+
+.fence-bottom-button{
+    width: 100%;
+    height: 30px;
+    flex: 0 0 auto;
+    align-self: flex-end;
+    min-height: 40px;
+}
+
+.part-layout{
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: center;
+}
+
+
+/* id */
+#save-fence{
+    width: 100%;
+    height: 100%;
+    font-size: 1em;
+}
+
+#display-radius{
+    margin-left: 10px;
+}
+
+#centerMarker{
+    position: absolute;
+    z-index: 9999;
+    width: 32px;
+    height: 32px;
+    margin: auto;
+    top: 0;
+    left: 0;
+    bottom: 0;
+    right: 0;
+}
+/* mui */
+.mui-input-row.mui-input-range
+{
+    overflow: visible;
+
+    padding-right: 20px;
+}
+
+.mui-input-range
+{
+  /*input[type="range"] {
+      -webkit-appearance: none;
+      background: #999;
+      height: 36px;
+      border-radius: 1px;
+      overflow: hidden;
+      margin-top: 2px;
+      margin-bottom: 2px;
+      outline:none;
+      position:relative;
+      width:100%;
+  }*/
+  /*input[type='range']::-webkit-slider-thumb {
+      -webkit-appearance: none!important;
+      opacity: 0.5;
+      height:28px;
+      width:28px;
+      border-radius: 50%;
+      background:#00b7fb;
+      position: relative;
+      pointer-events: none;
+      -webkit-box-sizing: border-box;
+      box-sizing: border-box;
+      &:before{
+          position: absolute;
+          top: 13px;
+          left: -2000px;
+          width: 2000px;
+          height: 2px;
+          background: #00b7fb;
+          content:' ';
+      }
+  }*/
+}
+
+.mui-input-range input[type='range']
+{
+    position: relative;
+
+    width: 100%;
+    height: 2px;
+    margin: 17px 0;
+    padding: 0;
+
+    cursor: pointer;
+
+    border: 0;
+    border-radius: 3px;
+    outline: none;
+    background-color: #999;
+
+    -webkit-appearance: none !important;
+}
+
+.mui-input-range input[type='range']::-webkit-slider-thumb
+{
+    width: 28px;
+    height: 28px;
+
+    border-color: #0062cc;
+    border-radius: 50%;
+    background-color: #007aff;
+    background-clip: padding-box;
+
+    -webkit-appearance: none !important;
+}
+
+.mui-input-range label ~ input[type='range']
+{
+    width: 75%;
+}
+
+.mui-input-range .mui-tooltip
+{
+    font-size: 36px;
+    line-height: 64px;
+
+    position: absolute;
+    z-index: 1;
+    top: -70px;
+
+    width: 64px;
+    height: 64px;
+
+    text-align: center;
+
+    opacity: .8;
+    color: #333;
+    border: 1px solid #ddd;
+    border-radius: 6px;
+    background-color: #fff;
+    text-shadow: 0 1px 0 #f3f3f3;
+}

+ 33 - 0
pages/amap/fence/fence.html

@@ -0,0 +1,33 @@
+
+<div class="fence-layout">
+    <div class="fence-range lr-form-container">
+        <div style="padding-left:15px" class="lr-form-row">
+            <div class="mui-input-row mui-input-range">
+                <div class="part-layout">
+                    <span style="min-width:40px">半径</span>
+                    <input type="range" min="0" max="1000" value="100" id="fence-radius" data-input-slider="1">
+                    <span id="display-radius"></span>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="fence-isable lr-form-container">
+            <div class="lr-form-row">
+                    <label>启用围栏</label>
+                    <div id="switch1"></div>
+                </div>
+    </div>
+
+    <div id='fence-map' class="amap-fence-contarner">
+        <div id="centerMarker">
+            <img src="./images/icon-anchor.png" alt="">
+        </div>
+    </div>
+    <div class="fence-bottom-button">
+        <button id="save-fence" type="button" class="lr-btn-primary">
+            保存
+        </button>
+    </div>
+</div>
+

+ 188 - 0
pages/amap/fence/fence.js

@@ -0,0 +1,188 @@
+(function () {
+    var page = {
+        init: function ($page, param) {
+            // //地图初始化
+            var map = new AMap.Map("fence-map", {
+                center: [113.955439, 22.542956],//地图中心点
+                zoom: 12 //地图显示的缩放级别
+            });
+
+
+
+
+            // // var polygonFence = new AMap.Polygon({
+            // //     strokeColor: "#FF33FF", 
+            // //     strokeWeight: 6,
+            // //     strokeOpacity: 0.2,
+            // //     fillOpacity: 0.4,
+            // //     fillColor: '#1791fc',
+            // //     zIndex: 50,
+            // // })
+
+
+
+            var fenceInfo = param.fenceInfo;
+            var defaultPt = param.defaultLocation;
+            console.log(param);
+
+
+
+
+            var circleFence = new AMap.Circle({
+                center: defaultPt,
+                radius: fenceInfo.data.radius, 
+                strokeOpacity: 0,
+                strokeWeight: 0,
+                strokeOpacity: 0.2,
+                fillOpacity: 0.3,
+                fillColor : '#1791fc',
+                zIndex: 50,
+            });
+
+            circleFence.setMap(map)
+            map.setFitView(circleFence);
+
+            // displayFence(fenceInfo);
+
+
+            $page.find('#switch1').lrswitch();
+
+            var rangeObj = $('#fence-radius');
+            $('#display-radius')[0].innerHTML = rangeObj[0].value;
+            //获取要设置的半径
+            function getSetRadius(){
+                return rangeObj[0].value; 
+            }
+
+            $('#fence-radius').on('input',function(){
+                $('#display-radius')[0].innerHTML = this.value;
+                var radius = getSetRadius();
+                circleFence.setRadius(radius);
+                console.log(circleFence.getRadius( ));
+                setFenceView(circleFence);
+                
+            });
+
+
+
+            map.on('moveend', function(){
+                var center = map.getCenter();
+                circleFence.setCenter(center);
+            });
+
+            function setFenceCenter(center){
+                circleFence.setCenter(center); 
+            }
+
+            function getPresentCenter(map){
+                return map.getCenter();
+            }
+
+            //围栏自适应地图等级
+            function setFenceView(fence){
+                map.setFitView([ fence ]);
+            };
+
+            
+            //显示围栏(初始)
+            // function displayFence(fenceInfo){
+            //     if(!fenceInfo){
+            //         circleFence.setCenter(defaultPt);
+            //         var radius = getSetRadius();
+            //         circleFence.setRadius(radius);
+            //         // circleFence.setMap(map);
+            //         map.setFitView([ circleFence ]);
+            //         return;
+            //     }
+
+            //     var fence = fenceInfo;
+            //     console.log(fence);
+            //     if(fence.type == 'circle'){
+            //         var pt = new AMap.LngLat(fence.data.center.lng, fence.data.center.lat);
+            //         // circleFence.setCenter(pt);
+            //         circleFence.setRadius(fence.data.radius);
+            //         // circleFence.setMap(map);
+            //         map.setFitView([ circleFence ]);
+            //         return;
+            //     }
+
+            //     // if(fence.type == 'polygon'){
+            //     //     var pts = [];
+            //     //     var paths = fence.data.vertex;
+                    
+            //     //     paths.forEach(v => {
+            //     //         pts.push([v.lng, v.lat]);
+            //     //     });
+            //     //     polygonFence.setPath(pts);
+            //     //     polygonFence.setMap(map);
+            //     //     map.setFitView([ polygonFence ]);
+            //     //     return;
+            //     // }
+            // }
+
+
+            
+
+
+
+            // //post围栏信息
+            // function postFence(data){
+            //     var post_data = data;
+
+            //     learun.httppost(config.webapi+'?s=api/save_fence_info',post_data,function(res){
+            //         if(!res.success){
+            //             learun.layer.toast(res.message);
+            //             return;
+            //         }
+            //         learun.layer.toast('保存成功');
+            //     });
+            // }
+
+
+
+
+            // var circle = new AMap.Circle({
+            //     center: [116.433322, 39.900255],
+            //     radius: 1000, //半径
+            //     borderWeight: 3,
+            //     strokeColor: "#FF33FF", 
+            //     strokeOpacity: 1,
+            //     strokeWeight: 6,
+            //     strokeOpacity: 0.2,
+            //     fillOpacity: 0.4,
+            //     strokeStyle: 'dashed',
+            //     strokeDasharray: [10, 10], 
+            //     // 线样式还支持 'dashed'
+            //     fillColor: '#1791fc',
+            //     zIndex: 50,
+            // })
+        
+            // circle.setMap(map)
+            // // 缩放地图到合适的视野级别
+
+            
+
+            // map.setFitView([ circle ])
+            //     map.on('moveend', function(){
+            //     var center = map.getCenter();
+            //     circle.setCenter(center);
+            // });
+
+            // $('#fence-radius').on('input',function(){
+            //     $('#display-radius')[0].innerHTML = this.value;
+            //     circle.setRadius(this.value);
+            //     map.setFitView([circle]);
+                
+            // });
+
+
+
+
+            
+
+            
+        }
+    };
+
+    return page;
+})();

+ 1 - 1
pages/amap/navigation/navigation.html

@@ -1,3 +1,3 @@
 <div class="lr-amap-page" >
-    <div id='navigation-map'></div>
+    <div id='navigation-map' class="lr-amap-contarner"></div>
 </div>

+ 17 - 4
pages/amap/navigation/navigation.js

@@ -2,11 +2,24 @@
     var page = {
         init: function ($page, param) {
             //地图初始化
-            learun.routeMap = new AMap.Map('navigation-map', {
-                center: [117.000923, 36.675807],
-                zoom: 15
+            var map = new AMap.Map("navigation-map", {
+                resizeEnable: true,
+                center: [113.955439, 22.542956],//地图中心点
+                zoom: 12 //地图显示的缩放级别
+            });
+            //骑行导航
+           var riding = new AMap.Riding({
+                map: map,
+            }); 
+            //根据起终点坐标规划骑行路线
+            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') {
+                    learun.layer.toast('绘制骑行路线完成:');
+                } else {
+                    learun.layer.toast('骑行路线数据查询失败:' + result);
+                }
             });
-            console.log(param);
         }
     };
 

+ 148 - 39
pages/amap/route/route.js

@@ -2,36 +2,66 @@
     var page = {
         init: function ($page) {
             //页面初始化
-            $page.find('#date2').lrdate({
+            /*
+			$page.find('#date2').rldate({
                 type: 'date'
             });
 
-            $page.find('.lr-btn-primary').on('tap', function(){
-                var date = $('#date2')[0].innerText;
-                console.log(date);
-                $('.widthset').hide();
-                $('.outcase').show();
-            });
-
 
 
+            $page.find('.date-set').on('tap', function(){
+                console.log('dsafd');
+                $('.widthset').show();
+                $('.outcase').hide();
+                
+            });
+            */
 
+			
+            //播放控制相关事件清除
+            function removeEvents(){
+                $(".icon-bofang").off("tap");
+                $(".icon-last").off("tap");
+                $(".icon-next").off("tap");
+                $(".speed-set").off("tap");
+            }
 
 
             //地图初始化
-            learun.routeMap = new AMap.Map('route-map', {
+            var routeMap = new AMap.Map('route-map', {
                 center: [117.000923, 36.675807],
                 zoom: 15
             });
             //test
-            learun.initPage = function(PathSimplifier) {
+            var initPage = function(PathSimplifier, data) {
+
+                if(!data){
+                    window.pathSimplifierIns.setData([]);
+                    window.pathSimplifierIns = null;
+                }
+
+                removeEvents();
+                console.log
+                if(window.pathSimplifierIns){
+                    window.pathSimplifierIns.setData([]);
+                    window.pathSimplifierIns = null;
+                }
                 //创建组件实例
-                learun.pathSimplifierIns = new PathSimplifier({
+                var pathSimplifierIns = new PathSimplifier({
                     zIndex: 100,
-                    map: learun.routeMap, //所属的地图实例
+                    map: routeMap, //所属的地图实例
                     getPath: function(pathData, pathIndex) {
                         //返回轨迹数据中的节点坐标信息,[AMap.LngLat, AMap.LngLat...] 或者 [[lng|number,lat|number],...]
-                        return pathData.path;
+                        // return pathData.path;
+                        
+                        var points = pathData.points,
+                            lnglatList = [];
+
+                        for (var i = 0, len = points.length; i < len; i++) {
+                            lnglatList.push(points[i].lngLat);
+                        }
+
+                        return lnglatList;
                     },
                     renderOptions: {
                         //轨迹线的样式
@@ -43,27 +73,15 @@
                     }
                 });
             
-                //这里构建两条简单的轨迹,仅作示例
-                learun.pathSimplifierIns.setData([{
-                    name: '轨迹0',
-                    path: [
-                        [100.340417, 27.376994],
-                        [100.239417, 27.3764],
-                        [100.238417, 27.386994],
-                        [100.137417, 27.379994],
-                        [100.436417, 27.396994],
-                        [100.535417, 27.376694],
-                        [100.134417, 27.374994],
-                        [100.232417, 27.372994],
-                        [100.331417, 27.376994],
-                    ]
-                }]);
-            
+
+                pathSimplifierIns.setData(data);
+                
+                console.log(pathSimplifierIns.getPathNavigators());
                 //创建一个巡航器
-                var navg0 = learun.pathSimplifierIns.createPathNavigator(0, //关联第1条轨迹
+                var navg0 = pathSimplifierIns.createPathNavigator(0, //关联第1条轨迹
                     {
                         loop: false, //循环播放
-                        speed: 10000
+                        speed: 1000
                     });
                 
 
@@ -125,7 +143,7 @@
                     }
 
                     navg0.moveToPoint(presentNode-1, 0);
-                    learun.pathSimplifierIns.render();
+                    pathSimplifierIns.render();
                 });
                 $page.find('.icon-next').on('tap', function () {
                     if(navg0.getNaviStatus() == 'stop'){
@@ -144,16 +162,15 @@
                     }
 
                     navg0.moveToPoint(presentNode+1, 0);
-                    learun.pathSimplifierIns.render();
+                    pathSimplifierIns.render();
                 });
 
+                // $page.find('.text-area').on('tap', function(){
+                //     navg0.destroy();
 
+                // });
 
-
-                $page.find('date-set').on('tap', function(){
-                    // $('.outcase').hide();
-                    $('.widthset').show();
-                });
+                window.pathSimplifierIns = pathSimplifierIns;
     
             }
             
@@ -163,9 +180,101 @@
                     alert('当前环境不支持 Canvas!');
                     return;
                 }
+
+                $page.find('.date-set').rldate({
+                    type: 'date'
+                },function(date){
+
+
+                    
+                    // $page.find('.f-dtpicker-ok').on('tap', function(){
+                        
+                    // });
+                    var pattern = /\d{4}(\-|\/|.)\d{1,2}\1\d{1,2}/;
+                    
+
+                    if(!pattern.test(date)){
+                        learun.layer.toast('请选择正确轨迹的日期');
+                        return;
+                    }
+
+
+                    var post_data = {
+                        "date":date,
+                        "deviceNumber":'868500028325363'
+                    }
+                    learun.httppost(config.webapi+'?s=api/get_gps_route',post_data,function(res){
+                        if(!res.success){
+                            learun.layer.toast(res.message);
+                        }
+                        var data = null;
+                        if(res.data){
+                            data = [{name:'test1',points:[]}];
+                            JSON.parse(res.data).forEach(v => {
+                               data[0].points.push({speed:v.speed, lngLat:[v.lng, v.lat]});
+                            });
+                            console.log(data);
+                        }
+                        initPage(PathSimplifier, data);
+					});
+                });
+
+                // $page.find('.lr-btn-primary').on('tap', function(){
+                //     var date = $('#date2')[0].innerText;
+                //     console.log(date);
+
+                //     $('.widthset').hide();
+                //     $('.outcase').show();
+
+
+    
+                // });
+
+
+
+
+                //日期格式化
+            Date.prototype.Format = function(fmt)   
+                { //author: meizz   
+                    var o = {   
+                        "M+" : this.getMonth()+1,                 //月份   
+                        "d+" : this.getDate(),                    //日   
+                        "h+" : this.getHours(),                   //小时   
+                        "m+" : this.getMinutes(),                 //分   
+                        "s+" : this.getSeconds(),                 //秒   
+                        "q+" : Math.floor((this.getMonth()+3)/3), //季度   
+                        "S"  : this.getMilliseconds()             //毫秒   
+                    };   
+                    if(/(y+)/.test(fmt))   
+                        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
+                    for(var k in o)   
+                        if(new RegExp("("+ k +")").test(fmt))   
+                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
+                    return fmt;   
+                }  
             
                 //启动页面
-                learun.initPage(PathSimplifier);
+                // initPage(PathSimplifier);
+                // 6789012345
+                var nowDate = new Date().Format("yyyy-MM-dd");
+                console.log(nowDate);
+                var post_data = {
+                    "date": nowDate,
+                    "deviceNumber":'6789012345'
+                }
+                learun.httppost(config.webapi+'?s=api/get_gps_route',post_data,function(res){
+                    if(!res.success){
+                        learun.layer.toast(res.message);
+                        return;
+                    }
+                    var data = [{name:'test1',points:[]}];
+                    JSON.parse(res.data).forEach(v => {
+                        data[0].points.push({speed:v.speed, lngLat:[v.lng, v.lat]});
+                    });
+                    console.log(data);
+
+                    learun.initPage(PathSimplifier, data);
+                });
 
             });
 

+ 5 - 0
pages/login/login.html

@@ -15,6 +15,11 @@
         <button id="loginBtn" type="button" class="lr-btn-primary lr-btn-block">
             登录
         </button>
+		<div style="padding-left:10px;">
+			<button type="button" class="lr-btn-link" id="register">
+				立即注册
+			</button>
+		</div>
     </div>
     <div class="version">Copyright © 2019 内蒙古璟意中联科技有限公司</div>
 </div>

+ 3 - 0
pages/login/login.js

@@ -109,6 +109,9 @@
                     });
                 } 
             });
+			$page.find('#register').on('tap', function () {
+				learun.nav.go({ path: 'register', title: '注册', type: 'right'});
+			})
         }
     };
     return page;

+ 1 - 1
pages/my/modifypassword/modifypassword.html

@@ -1,4 +1,4 @@
-<<div style="margin-top:10px;" class="lr-form-container" id="modifypasswordform">
+<div style="margin-top:10px;" class="lr-form-container" id="modifypasswordform">
     <div class="lr-form-row">
         <label>原密码</label>
         <input id="oldpassword" type="password" isvalid="yes" checkexpession="NotNull" errormsg="原密码">

+ 1 - 1
pages/my/modifypassword/modifypassword.js

@@ -19,7 +19,7 @@
 					
                     // 访问后台修改密码
                     //learun.httppost(config.webapi + "learun/adms/user/modifypw", req, function(data,info){
-                    learun.http.post('http://czapp.rltest.cn/?s=api/modifypassword', req, function(data,info){
+                    learun.httppost(config.webapi + '/?s=api/modifypassword', req, function(data,info){
                         learun.layer.loading(false);
                         if (data.success === true) {// 表单数据保存成功,发起流程
                             learun.layer.toast(info);

+ 2 - 0
pages/register/register.css

@@ -0,0 +1,2 @@
+body {
+}

+ 29 - 0
pages/register/register.html

@@ -0,0 +1,29 @@
+<div style="margin-top:10px;" class="lr-form-container" id="registerform">
+    <div class="lr-form-row">
+        <label>车牌号</label>
+        <input id='licenseplate' type="text"  isvalid="yes" checkexpession="NotNull" errormsg="车牌号">
+    </div>
+	<div class="lr-form-row">
+        <label>姓名</label>
+        <input id='username' type="text"  isvalid="yes" checkexpession="NotNull" errormsg="姓名">
+    </div>
+	<div class="lr-form-row">
+        <label>身份证</label>
+        <input id='idcard' type="text"  isvalid="yes" checkexpession="NotNull" errormsg="身份证">
+    </div>
+    <div class="lr-form-row">
+        <label>密码</label>
+        <input id="password1" type="password" isvalid="yes" checkexpession="NotNull" errormsg="密码">
+    </div>
+    <div class="lr-form-row">
+        <label>确认密码</label>
+        <input id="password2" type="password" isvalid="yes" checkexpession="NotNull" errormsg="确认密码">
+    </div>
+</div>
+
+<div class="lr-list" style="margin-top:15px;">
+    <div class="lr-list-item" style="color:green;text-align:center;" id="saveuserinfo">
+        注册
+    </div>
+</div>
+

+ 40 - 0
pages/register/register.js

@@ -0,0 +1,40 @@
+(function () {
+    var page = {
+        isScroll: true,
+        init: function ($page) {
+            $page.find('#saveuserinfo').on('tap', function () {
+                if (!$('#registerform').lrformValid()) {
+                    return false;
+                }
+                var formdata = $('#registerform').lrformGet();
+                if (formdata.password2 === formdata.password1) {
+
+                    var req = {
+						FullName: formdata.username,
+                        Password: $.md5(formdata.password1),
+						LicensePlate: formdata.licenseplate,
+						IdCard: formdata.idcard,
+                    };
+                    learun.layer.loading(true);
+					
+                    // 访问后台修改密码
+                    //learun.httppost(config.webapi + "learun/adms/user/modifypw", req, function(data,info){
+                    learun.http.post('http://czapp.rltest.cn/?s=api/register', req, function(data,info){
+                        learun.layer.loading(false);
+                        if (data.success === true) {// 表单数据保存成功,发起流程
+                            //learun.layer.toast(info);
+                            //learun.storage.set('logininfo', null);
+                            learun.nav.go({ path: 'login', isBack: false, isHead: false });
+                        }else{
+							learun.layer.warning(data.message, function () { }, '提示', '关闭');
+						}
+                    });
+                }
+                else {
+                    learun.layer.toast('二次输入密码不同');
+                }
+            });
+        }
+    };
+    return page;
+})();

+ 11 - 0
pages/tongji/tongji.html

@@ -1,4 +1,15 @@
 <div class="lr-desktop-msg" id="lr_desktop_msg">
 	<div id="lr_desktop_msg_content" style="padding-top:10px;">
+	 <div class="lr-black-panel">
+		<div class="lr-title">统计数据</div>
+		<div class="lr-content lr-chart-content">
+			<div class="lr-chart-container" id="chart-bingtu"></div>
+			</div>
+		</div>
+	</div>
+	<div class="lr-black-panel">
+		<div class="lr-title">行驶数据</div>
+		<div class="lr-content lr-flex-content" id='driving-data'>
+		</div>
 	</div>
 </div>

+ 57 - 252
pages/tongji/tongji.js

@@ -1,258 +1,63 @@
 (function () {
-
-    var custmerform = {};
-    var $scroll = '';
-	
-	var chartMap = {};
-    // 图表数据
-    function chart(data, $page) {
-		
-        if (data.length > 0) {
-            chartMap = {};
-            $.each(data, function (_index, _item) {
-                var _html = '\
-                <div class="lr-black-panel">\
-                    <div class="lr-title">'+ _item.F_Name + '</div>\
-                    <div class="lr-content lr-chart-content">\
-                        <div class="lr-chart-container" id="'+ _item.F_Id + '"  data-desktop="' + _item.F_Type + '" ></div>\
-                    </div>\
-                </div>';
-				
-                $page.find('#lr_desktop_msg_content').append(_html);
-                chartMap[_item.F_Id] = echarts.init(document.getElementById(_item.F_Id));
-
-                // 获取后台数据
-				var data = '{"Id":"1064e045-f075-42a2-8431-ba717e1539b3","value":[{"name":"2017.07.13","value":9000.00},{"name":"2017.08.11","value":100900.00},{"name":"2017.09.25","value":0.00},{"name":"2018.04.03","value":100.00},{"name":"2018.05.21","value":2.00}]}';
-                //learun.httpget("", { type: 'chart', id: _item.F_Id }, function(data) {
-				data = JSON.parse(data);
-                    if (data) {
-                        var type = $('#' + data.Id).attr('data-desktop');
-                        var legendData = [];
-                        var valueData = [];
-                        $.each(data.value, function (_index, _item) {
-                            legendData.push(_item.name);
-                            valueData.push(_item.value);
-                        });
-                        var option = {};
-						option.tooltip = {
-							trigger: 'item',
-							formatter: "{a} <br/>{b}: {c} ({d}%)"
-						};
-						console.log(option.tooltip);
-						option.legend = {
-							orient: 'vertical',
-							left: 'left',
-							data: legendData
-						};
-						console.log(option.legend);
-						option.series = [{
-							name: '占比',
-							type: 'pie',
-							radius: ['50%', '70%'],
-							avoidLabelOverlap: false,
-							label: {
-								normal: {
-									show: false,
-									position: 'center'
-								},
-								emphasis: {
-									show: true,
-									textStyle: {
-										fontSize: '30',
-										fontWeight: 'bold'
-									}
-								}
-							},
-							labelLine: {
-								normal: {
-									show: false
-								}
-							},
-							data: data.value
-						}];
-						console.log(option.series);
-						option.color = ['#df4d4b', '#304552', '#52bbc8', 'rgb(224,134,105)', '#8dd5b4', '#5eb57d', '#d78d2f'];
-						console.log(option);
-                        chartMap[data.Id].setOption(option);
-                    }
-                //});
-            });
-        }
-    }
-
-    // 统计数据
-    function target(data, $page) {
-        if (data.length > 0) {
-            var _html = '\
-            <div class="lr-black-panel">\
-                <div class="lr-title">统计数据</div>\
-                <div class="lr-content lr-flex-content">\
-                </div>\
-            </div>';
-            $page.find('#lr_desktop_msg_content').append(_html);
-            //var $content = $desktop.find('.lr-flex-content');
-            $.each(data, function (_index, _item) {
-                var _itemHtml = '\
-                    <div class="targetItem">\
-                        <div class="name">'+ _item.F_Name + '</div>\
-                        <div class="number" data-number="'+ _item.F_Id + '" ></div>\
-                    </div>';
-				$('#lr_desktop_msg_content').find('.lr-flex-content').append(_itemHtml);
-                //$content.append(_itemHtml);
-                // 获取后台数据
-                learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'Target', id: _item.F_Id }, function(data){
-                    if (data) {
-                        $('[data-number="' + data.Id + '"]').text(data.value);
-                    }
-                });
-
-            });
-
-        }
-    }
-
-
-    function refreshDeskTop($page) {
-        learun.clientdata.get('desktop', {
-            callback: function (data) {
-                //var $desktop = $('#lr_desktop_msg_content');
-                //$desktop.html('');
-				chart(data.chart || [], $page);
-                target(data.target || [], $page);
-
-                /*if (self) {
-                    self.refresh(true);
-                    self.endPulldownToRefresh();
-                }*/
-            }
-        });
-    }
-
     var page = {
         init: function ($page) {
-            // 基础数据初始化
-            learun.clientdata.init();
-            refreshDeskTop($page);
-           
-            $scroll = $page.find('#lr_desktop_msg').pullRefresh({
-                down: {
-                    height: 30,
-                    contentinit: '下拉可以刷新',
-                    contentdown: '下拉可以刷新',
-                    contentover: '松开立即刷新',
-                    contentrefresh: '正在刷新...',
-                    callback: function () {
-                        refreshDeskTop($page);
-                    }
-                }
-            });
-
-            // 加载功能列表
-            learun.clientdata.get('module', {
-                callback: function (data) {
-                    learun.myModule.get(data, function (myModules) {
-                        var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
-                        switch (mylen) {
-                            case 1:
-                                $page.find('.lr-workspace-page').css('padding-top', '210px');
-                                break;
-                            case 2:
-                                $page.find('.lr-workspace-page').css('padding-top', '290px');
-                                break;
-                            case 3:
-                                $page.find('.lr-workspace-page').css('padding-top', '370px');
-                                break;
-                        }
-
-                        var map = {};
-                        $.each(data, function (_index, _item) {
-                            map[_item.F_Id] = _item;
-                        });
-                        var $appbox = $page.find('.appbox');
-                        var $last = null;
-                        $.each(myModules, function (_index, _id) {
-                            var item = map[_id];
-                            if (item) {
-                                var _html = '\
-                                        <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
-                                            <div><i class="'+ item.F_Icon + '"></i></div>\
-                                            <span>'+ item.F_Name + '</span>\
-                                        </div>';
-                                var _$html = $(_html);
-                                _$html[0].item = item;
-                                if ($last === null) {
-                                    $appbox.prepend(_$html);
-                                }
-                                else {
-                                    $last.after(_$html);
-                                }
-                                $last = _$html;
-
-                            }
-                        });
-                        $last = null;
-                    });
-                }
-            });
-        },
-        reload: function ($page, pageinfo) {
-            if (learun.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
-                learun.isOutLogin = false;
-                refreshDeskTop($page);
-                learun.clientdata.clear('module');
-                learun.myModule.states = -1;
-            }
-            // 加载功能列表
-            learun.clientdata.get('module', {
-                callback: function (data) {
-                    learun.myModule.get(data, function (myModules) {
-                        var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
-                        switch (mylen) {
-                            case 1:
-                                $page.find('.lr-workspace-page').css('padding-top', '210px');
-                                break;
-                            case 2:
-                                $page.find('.lr-workspace-page').css('padding-top', '290px');
-                                break;
-                            case 3:
-                                $page.find('.lr-workspace-page').css('padding-top', '370px');
-                                break;
-                        }
-
-                        var map = {};
-                        $.each(data, function (_index, _item) {
-                            map[_item.F_Id] = _item;
-                        });
-                        var $appbox = $page.find('.appbox');
-                        var $last = null;
-                        $appbox.find(".appitem2").remove();
-                        $.each(myModules, function (_index, _id) {
-                            var item = map[_id];
-                            if (item) {
-                                var _html = '\
-                                        <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
-                                            <div><i class="'+ item.F_Icon + '"></i></div>\
-                                            <span>'+ item.F_Name + '</span>\
-                                        </div>';
-                                var _$html = $(_html);
-                                _$html[0].item = item;
-                                if ($last === null) {
-                                    $appbox.prepend(_$html);
-                                }
-                                else {
-                                    $last.after(_$html);
-                                }
-                                $last = _$html;
-
-                            }
-                        });
-                        $last = null;
-                    });
-                }
-            });
-            $.each(chartMap, function (id, obj) {
-                obj.resize();
-            });
+			//扇形图数据
+			chartMap = {};
+			chartMap['chart-bingtu'] = echarts.init(document.getElementById('chart-bingtu'));
+			var data = [{"name":"测试11","value":"9000.00"},{"name":"测试22","value":"100900.00"},{"name":"测试33","value":"0.00"}];
+			var data2 = [{"name":"9000.00","value":"9000.00"},{"name":"100900.00","value":"100900.00"},{"name":"0.00","value":"0.00"}];
+			//learun.httpget("", { type: 'chart', id: _item.F_Id }, function(data) {
+			//var type = $('#' + data.Id).attr('data-desktop');
+			var legendData = [];
+			$.each(data, function (_index, _item) {
+				legendData.push(_item.name + _item.value);
+				var data3 = {};
+				data3.name = _item.name + _item.value;
+				data3.value = _item.value;
+				data2.push(data3);
+			});
+			console.log(data2);
+			console.log(legendData);
+			var option = {};
+			option.tooltip = {
+				trigger: 'item',
+				formatter: "{a} <br/>{b}: {c} ({d}%)"
+			};
+			option.legend = {
+				orient: 'vertical',
+				left: 'right',
+				data: legendData
+			};
+			option.series = [{
+				name: '占比',
+				type: 'pie',
+				radius : '55%',
+				center: ['40%', '60%'],
+				itemStyle: {
+					emphasis: {
+						shadowBlur: 10,
+						shadowOffsetX: 0,
+						shadowColor: 'rgba(0, 0, 0, 0.5)'
+					}
+				},
+				data: data2
+			}];
+			//option.color = ['#df4d4b', '#304552', '#52bbc8', 'rgb(224,134,105)', '#8dd5b4', '#5eb57d', '#d78d2f'];
+			chartMap['chart-bingtu'].setOption(option);
+			
+			//列表数据
+			//learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'Target', id: _item.F_Id }, function(data){});
+			var drivingdata = '[{"name":"测试1","value":"29"},{"name":"测试2","value":"20"}]';
+			data = JSON.parse(drivingdata);
+			var _itemHtml = ''
+			$.each(data, function (_index, _item) {
+				_itemHtml += '\
+					<div class="targetItem">\
+						<div class="name">'+ _item.name + '</div>\
+						<div class="number">'+ _item.value +'</div>\
+					</div>';
+				$page.find('#driving-data').html(_itemHtml);
+			}); 
         }
     };
     return page;

+ 42 - 0
scripts/fence-slider.js

@@ -0,0 +1,42 @@
+$.fn.input = function(options) {
+    var inputApis = [];
+    this.each(function() {
+        var inputApi = null;
+        var actions = [];
+        var row = findRow(this.parentNode);
+        if (this.type === 'range' && row.classList.contains('mui-input-range')) {
+            actions.push('slider');
+        } else {
+            var classList = this.classList;
+            if (classList.contains('mui-input-clear')) {
+                actions.push('clear');
+            }
+            if (!($.os.android && $.os.stream) && classList.contains('mui-input-speech')) {
+                actions.push('speech');
+            }
+            if (classList.contains('mui-input-password')) {
+                actions.push('password');
+            }
+            if (this.type === 'search' && row.classList.contains('mui-search')) {
+                actions.push('search');
+            }
+        }
+        var id = this.getAttribute('data-input-' + actions[0]);
+        if (!id) {
+            id = ++$.uuid;
+            inputApi = $.data[id] = new Input(this, {
+                actions: actions.join(',')
+            });
+            for (var i = 0, len = actions.length; i < len; i++) {
+                this.setAttribute('data-input-' + actions[i], id);
+            }
+        } else {
+            inputApi = $.data[id];
+        }
+        inputApis.push(inputApi);
+    });
+    return inputApis.length === 1 ? inputApis[0] : inputApis;
+};
+$.ready(function() {
+    $('.mui-input-row input').input();
+});

+ 24 - 0
scripts/lrmui.js

@@ -719,6 +719,30 @@ u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(
         }, 100);
         return $this;
     };
+	//任联自定义日期选择
+	$.fn.rldate = function (op,call) {
+        var $this = $(this);
+        var dfop = {
+            placeholder: '请选择',
+            type: 'datetime',//datetime:2017-10-12 00:00;date:2017-10-12; time:00:00; month:2017-10
+            label: ['年', '月', '日', '时', '分'],
+            change: false    // 选择时间改变的时候触发
+
+        };
+        $.extend(dfop, op || {});
+        dfop.callback = function () {
+            learun.formblur();
+        };
+
+        setTimeout(function () {
+            $this.fdtpicker(dfop).on('change', function () {
+                var $self = $(this);
+                //$self.attr('route-date',$self[0].fop.value);
+				call($self[0].fop.value);
+            });
+        }, 100);
+        return $this;
+    };
     // 日期选择插件(设置数据)
     $.fn.lrdateSet = function (value) {
         var $this = $(this);