Quellcode durchsuchen

nagegation test

git vor 5 Jahren
Ursprung
Commit
3fc8b5d3d3

+ 2 - 2
config/config.js

@@ -1,7 +1,7 @@
 var config = {
     //webapi: 'http://localhost:31173/'// 后台地址
 	//webapi: 'http://www.renlian.cn/admsapi/'
-	//webapi: 'http://czapp.rltest.cn'
-	webapi: 'http://czapi.zgjtgs.com'
+	webapi: 'http://czapp.rltest.cn'
+	// webapi: 'http://czapi.zgjtgs.com'
 	//webapi: 'http://hfczapi.renlianiot.com'
 };

+ 19 - 0
data/maplist.js

@@ -0,0 +1,19 @@
+var mapList = [
+    {
+        value: "com.baidu.BaiduMap",
+        text: "百度地图",
+    },
+    {
+        value: "com.autonavi.minimap",
+        text: "高德地图",  
+    },
+    {
+        value: "com.tencent.map",
+        text: "腾讯地图",  
+    },
+    {
+        value: "com.google.android.apps.maps",
+        text: "谷歌地图",  
+    }
+];
+

+ 2 - 2
index.html

@@ -26,8 +26,8 @@
         <script type="text/javascript" src="data/city.js"></script>
 		<script type="text/javascript" src="data/bjtype.js"></script>
         <script type="text/javascript" src="scripts/echarts.js"></script>
-        <script type="text/javascript" src="scripts/rlmui.js"></script>
-        <!-- <script type="text/javascript" src="scripts/rlmuidebug.js"></script> -->
+        <!-- <script type="text/javascript" src="scripts/rlmui.js"></script> -->
+        <script type="text/javascript" src="scripts/rlmuidebug.js"></script>
         <script type="text/javascript" src="scripts/rlmuiex.js"></script>
         <script type="text/javascript" src="scripts/platformOverrides.js"></script>
         <script type="text/javascript" src="config/config.js"></script>

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

@@ -1,6 +1,11 @@
 (function () {
     var page = {
         init: function ($page, param) {
+
+            var originName='我的当前位置';//北四环东路 望和路
+			var origin = new Array(39.98871,116.43234);//origin[0]为纬度,origin[1]为经度
+			var destinationName = '故宫博物馆';
+			var destination=new Array(39.9168,116.3908);//目的地纬度、经度。先纬度后经度
             
             renlian.layer.loading(true, "加载数据中");
             //地图初始化
@@ -10,10 +15,25 @@
                 zoom: 12 //地图显示的缩放级别
             });
 
-            console.log('aa');
-            
-
 
+            var mapList = [
+                {
+                    value: "com.baidu.BaiduMap",
+                    text: "百度地图",
+                },
+                {
+                    value: "com.autonavi.minimap",
+                    text: "高德地图",  
+                },
+                {
+                    value: "com.tencent.map",
+                    text: "腾讯地图",  
+                },
+                {
+                    value: "com.google.android.apps.maps",
+                    text: "谷歌地图",  
+                }
+            ];
 
             map.on('complete', function(){
                 renlian.layer.loading(false);
@@ -30,7 +50,7 @@
                     autoFitView: true
                 }); 
             } 
-
+            param.start = [121.13, 30.33];
             //根据起终点坐标规划骑行路线
             riding.search(param.start, param.end, function(status, result) {
                 // result即是对应的骑行路线数据信息,相关数据结构文档请参考  https://lbs.amap.com/api/javascript-api/reference/route-search#m_RidingResult
@@ -108,6 +128,135 @@
 
 
 
+            function haveInstalledApp(){//通过包名判断app是否安装
+				var mapList = document.getElementsByClassName('mapLi');
+				var baiduPackageName = "com.baidu.BaiduMap";
+				var gaodePackageName = "com.autonavi.minimap";
+				var tengxunPackageName = "com.tencent.map";
+				var gugePackageName = "com.google.android.apps.maps";
+				appAvailability.check(baiduPackageName,function () {//success callback
+					mapList.item(0).style.display = 'block';
+				},function () {//
+					mapList.item(0).style.display = 'none';
+				});
+				appAvailability.check(gaodePackageName,function () {//success callback
+					mapList.item(1).style.display = 'block';
+				},function () {//
+					mapList.item(1).style.display = 'none';
+				});
+				appAvailability.check(tengxunPackageName,function () {//success callback
+					mapList.item(2).style.display = 'block';
+				},function () {//
+					mapList.item(2).style.display = 'none';
+
+				});
+				appAvailability.check(gugePackageName,function () {//success callback
+					mapList.item(3).style.display = 'block';
+					// mapList.item(4).style.display = 'block';
+				},function () {
+					mapList.item(3).style.display = 'none';
+					// mapList.item(4).style.display = 'none';
+				});
+            }
+
+            // $('#daohang-button').on('tap', function(){
+                
+            // });
+            
+            $('#daohang-button').rlpicker({
+                data: mapList
+            },function(map){
+                appAvailability.check(map,function () {//success callback
+					if(map == 'com.baidu.BaiduMap'){
+                        checkBaidu();
+                    }
+                    if(map == 'com.autonavi.minimap'){
+                        checkGaode();
+                    }
+                    if(map == 'com.tencent.map'){
+                        checkTengxun();
+                    }
+                    if(map == 'com.google.android.apps.maps'){
+                        checkGuge();
+                    }
+				},function () {//
+					renlian.layer.msg('未检测到该地图应用');
+				});
+            });
+
+
+
+            //
+            function checkBaidu(){ 
+				var sApp = startApp.set({ /* params */
+					"action":"ACTION_VIEW",
+					"category":"CATEGORY_DEFAULT",
+					"type":"text/css",
+					"package":"com.baidu.BaiduMap",
+					"uri":"baidumap://map/direction?origin=name:"+originName+"|latlng:"+origin[0]+","+origin[1]+"&destination=name:"+destinationName+"|latlng:"+destination[0]+","+destination[1]+"&mode=driving",
+					"flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"],
+					"intentstart":"startActivity"
+				});
+				sApp.start(function() { /* success */
+					//alert("OK");
+				}, function(error) { /* fail */
+					alert(error);
+				});
+            }
+            
+            function checkGaode(){
+				var sApp = startApp.set({ /* params */
+					"action":"ACTION_VIEW",
+					"category":"CATEGORY_DEFAULT",
+					"type":"text/css",
+					"package":"com.autonavi.minimap",
+					"uri":"amapuri://route/plan/?slat="+origin[0]+"&slon="+origin[1]+"&sname="+originName+"&dlat="+destination[0]+"&dlon="+destination[1]+"&dname="+destinationName+"&dev=0&t=0",
+					"flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"],
+					"intentstart":"startActivity"
+				});
+				sApp.start(function() { /* success */
+					//alert("OK");
+				}, function(error) { /* fail */
+					alert(error);
+				});
+            }
+            
+            function checkTengxun(){
+				var sApp = startApp.set({ /* params */
+					"action":"ACTION_VIEW",
+					"category":"CATEGORY_DEFAULT",
+					"type":"text/css",
+					"package":"com.tencent.map",
+					"uri":"qqmap://map/routeplan?type=drive&from="+originName+"&fromcoord="+origin[0]+","+origin[1]+"&to="+destinationName+"&tocoord="+destination[0]+","+destination[1]+"&coord_type=1&policy=0",
+					"flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"],
+					"intentstart":"startActivity"
+				});
+				sApp.start(function() { /* success */
+					//alert("OK");
+				}, function(error) { /* fail */
+					alert(error);
+				});
+            }
+            
+            function checkGuge(){//指定终点经纬度,默认当前位置
+				var sApp = startApp.set({ /* params */
+					"action":"ACTION_VIEW",
+					"category":"CATEGORY_DEFAULT",
+					"type":"text/css",
+					"package":"com.google.android.apps.maps",
+					"uri":"google.navigation:q="+destination[0]+","+destination[1],
+					"flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"],
+					"intentstart":"startActivity"
+				});
+				sApp.start(function() { /* success */
+					//alert("OK");
+				}, function(error) { /* fail */
+					alert(error);
+				});
+			}
+
+
+
 
 
             

pages/amap/navigation_test/navigation.css → pages/amap/navigation_temp/navigation.css


pages/amap/navigation_test/navigation.html → pages/amap/navigation_temp/navigation.html


pages/amap/navigation_test/navigation.js → pages/amap/navigation_temp/navigation.js


+ 31 - 1
scripts/rlmuidebug.js

@@ -6375,7 +6375,37 @@ u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(
 (function ($, renlian, fui, window) {
     "use strict";
 
-    // 选择器(初始化)
+    //任联单选择框
+    $.fn.rlpicker = function (op, call) {
+        var $this = $(this);
+        if ($this.length === 0) {
+            return $this;
+        }
+        var dfop = {
+            placeholder: '请选择',
+            data: [],
+            level: 1,
+            ivalue: 'value',
+            itext: 'text'
+        };
+        $.extend(dfop, op || {});
+        dfop.callback = function () {
+            // renlian.formblur();
+        };
+
+        setTimeout(function () {
+            $this.fpoppicker(dfop).on('change', function () {
+                var $self = $(this);
+                var text = $self[0].fop.text;
+                // $self.find('.text').text(text.replace(/,/g, '/'));
+                call($self[0].fop.value);
+            });
+        }, 100);
+
+        return $this;
+    };
+
+    
     $.fn.lrpicker = function (op) {
         var $this = $(this);
         if ($this.length === 0) {