Эх сурвалжийг харах

添加手机地图带值跳转到百度

李雪梅 2 жил өмнө
parent
commit
0e0421b2e4

+ 43 - 192
nngkxxdp/src/main/resources/static/district/js/sy_mobile.js

@@ -696,38 +696,38 @@ $(function () {
         indexList = 2;
         if (cyytext == '产业园区'){
             applyClickList();
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             xrList(cyy);
         }else if (cyytext == '停车泊车') {
             applyClickList();
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             xrList(tc);
 		}else if (cyytext == '不动产登记') {
             applyClickList();
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             xrList(bdcdjzxbsdt);
 		}else if(cyytext == "便民公厕"){
             applyClickList();
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
 			xrList(gc);
 		}else if(cyytext == "住房保障"){
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             applyClickList();
 			xrList(fwglzx);
 		}else if(cyytext == "住房公积金"){
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             applyClickList();
 			xrList(gjj);
 		}else if(cyytext == "办税服务"){
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             applyClickList();
 			xrList(bsfwt);
 		}else if(cyytext == "核酸检测"){
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             applyClickList();
 			xrList(hscyd);
 		}else if(cyytext == "市场监管"){
-            $('.show-fifth .title-second>h6').text(cyytext);
+            $('.show-fifth .title-second>h6').text('搜索结果');
             applyClickList();
             xrList(scjdglj);
 		}
@@ -844,26 +844,14 @@ $(function () {
             if ((arrtel == "" || arrtel == undefined)||arrtel==null){
                 sContnet += ''
             } else {
-                var discriptone_tel =arrtel.split(';')[0];
-                var discripttwo_tel =arrtel.split(';')[1];
-                var discriptthree_tel =arrtel.split(';')[2];
-                var discriptfour_tel =arrtel.split(';')[3];
                 sContnet += "<p><span class='flex_address'>办公电话:</span>"
-                sContnet += "<a href='tel:"+discriptone_tel+"' style='text-decoration:underline'>"+discriptone_tel+"</a>"
-                if (discripttwo_tel == undefined) {
-                    sContnet += ''
-                } else {
-                    sContnet += ";<a href='tel:"+discripttwo_tel+"' style='text-decoration:underline'>"+discripttwo_tel+"</a>"
-                }
-                if (discriptthree_tel == undefined) {
-                    sContnet += ''
-                } else {
-                    sContnet += ";<a href='tel:"+discriptthree_tel+"' style='text-decoration:underline'>"+discriptthree_tel+"</a>"
-                }
-                if (discriptfour_tel == undefined) {
-                    sContnet += ''
-                } else {
-                    sContnet += ";<a href='tel:"+discriptfour_tel+"' style='text-decoration:underline'>"+discriptfour_tel+"</a>"
+                for (var i=0;i<arrtel.split(';').length;i++){
+                    if(arrtel.split(';').length-i != 1){
+                        sContnet += "<a href='tel:"+arrtel.split(';')[i]+"' style='text-decoration:underline'>"+arrtel.split(';')[i]+"</a>"
+                        sContnet += ";"
+                    }else{
+                        sContnet += "<a href='tel:"+arrtel.split(';')[i]+"' style='text-decoration:underline'>"+arrtel.split(';')[i]+"</a>"
+                    }
                 }
                 sContnet += "</p>"
             }
@@ -904,7 +892,6 @@ $(function () {
                 if(point){
                     var address = new BMap.Point(point.lng, point.lat);
                     addFirst = address;
-                    var discrptAddress;
                     let getClick = getAllArr.filter(i => {
                         return i.address == discriptText;
                     });
@@ -1998,116 +1985,23 @@ $(function () {
         var endGJ = $('#gj-two').val();
         var startZJ = $("#zj-one").val();
 		var endZJ = $("#zj-two").val();
-        var line = JSON.parse(localStorage.getItem("line"));
-        var lineText = JSON.parse(localStorage.getItem("lineText"));
-        var discern = localStorage.getItem("discern");
         if (gjzjtext == '公交') {
-            if (startZJ == '' && endZJ == '') {
-                // console.log(1111)
-                $('.show-first').show().siblings().hide();
-                $('.top_search').show().siblings('.right-map').show();
-                $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
-                map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-                localStorage.setItem("discern", 0);
-                $('#gj-one').val(startZJ);
-                $('#gj-two').val(endZJ);
-                var gjobj = JSON.stringify(['','']);
-                localStorage.setItem("line",gjobj);
-                var objgj = JSON.stringify(['','']);
-                localStorage.setItem("lineText",objgj);
-            } else if (startZJ == '' || endZJ == '') {
-                // console.log(2222)
-                $('.show-first').show().siblings().hide();
-                $('.top_search').show().siblings('.right-map').show();
-                $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
-                map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-                localStorage.setItem("discern", 0);
-                $('#gj-one').val(startZJ);
-                $('#gj-two').val(endZJ);
-                var gjobj = JSON.stringify(['','']);
-                localStorage.setItem("line",gjobj);
-                var objgj = JSON.stringify(['','']);
-                localStorage.setItem("lineText",objgj);
-            } else if (discern == 1){
-				// console.log(3333);
-				// busResultLine(startZJ,endZJ);
-                $('.show-second').show().siblings().hide();
-				$('#gj-one').val(startZJ);
-                $('#gj-two').val(endZJ);
-			} else if ((startZJ == line[0] && endZJ == line[1]) && discern == 3){
-                // console.log(4444);
-                busResultLine(startZJ,endZJ);
-                $('.show-third').hide().siblings('.show-second').show();
-                $('.show-second .content-third').hide();
-                $('.zjboxpanel').show()
-                localStorage.setItem("discern", 1);
-                $("#gj-one").val(startZJ);
-                $("#gj-two").val(endZJ);
-            } else if (startZJ == line[0] && endZJ == line[1]){
-                // console.log(5555)
-                $('.show-third').hide().siblings('.show-second').show();
-                $('.show-second .content-third').show();
-                localStorage.setItem("discern", 2);
-                $("#gj-one").val(startZJ);
-                $("#gj-two").val(endZJ);
-            } else if(startZJ != lineText[0] || endZJ != lineText[1]){
-                // console.log(7777)
-                busResultLine(startZJ,endZJ);
-                $("#gj-one").val(startZJ);
-                $("#gj-two").val(endZJ);
-                localStorage.setItem("discern", 1);
-            }
+            console.log('1:',startZJ,endZJ)
+            $('.show-first').show().siblings().hide();
+            $('.top_search').show().siblings('.right-map').show();
+            $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
+            map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
+            $('#gj-one').val(startZJ);
+            $('#gj-two').val(endZJ);
         }
         if (gjzjtext == '自驾') {
-            if (startGJ == '' && endGJ == '') {
-                // console.log(8888)
-                $('.show-first').show().siblings().hide();
-                $('.top_search').show().siblings('.right-map').show();
-                $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
-                map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-                localStorage.setItem("discern", 0);
-                $("#zj-one").val(startGJ);
-                $("#zj-two").val(endGJ);
-                var gjobj = JSON.stringify(['','']);
-                localStorage.setItem("line",gjobj);
-                var objgj = JSON.stringify(['','']);
-                localStorage.setItem("lineText",objgj);
-            } else if (startGJ == '' || endGJ == '') {
-                // console.log(9999)
-                $('.show-first').show().siblings().hide();
-                $('.top_search').show().siblings('.right-map').show();
-                $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
-                map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-                localStorage.setItem("discern", 0);
-                $("#zj-one").val(startGJ);
-                $("#zj-two").val(endGJ);
-                var gjobj = JSON.stringify(['','']);
-                localStorage.setItem("line",gjobj);
-                var objgj = JSON.stringify(['','']);
-                localStorage.setItem("lineText",objgj);
-            } else if ((startGJ == line[0] && endGJ == line[1]) && discern == 1){
-                // console.log(1010)
-                drivingResultLine(startGJ,endGJ);
-                $('.show-second').hide().siblings('.show-third').show();
-                $('.show-third .content-third').hide();
-                $('.boxpanel').show();
-                localStorage.setItem("discern", 3);
-                $("#zj-one").val(startGJ);
-                $("#zj-two").val(endGJ);
-            } else if (startGJ == line[0] && endGJ == line[1]){
-                // console.log(1313)
-                $('.show-second').hide().siblings('.show-third').show();
-                $('.show-third .content-third').show();
-                localStorage.setItem("discern", 4);
-                $("#zj-one").val(startGJ);
-                $("#zj-two").val(endGJ);
-            } else if(startGJ != lineText[0] || endGJ != lineText[1]){
-                // console.log(1515)
-                drivingResultLine(startGJ,endGJ)
-                $("#zj-one").val(startGJ);
-                $("#zj-two").val(endGJ);
-                localStorage.setItem("discern", 3);
-            }
+            console.log('2:',startGJ,endGJ)
+            $('.show-first').show().siblings().hide();
+            $('.top_search').show().siblings('.right-map').show();
+            $('.right-search').css('top',msHeight).siblings('.right-map').css('top','0px');
+            map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
+            $("#zj-one").val(startGJ);
+            $("#zj-two").val(endGJ);
         }
     });
     var obj = JSON.stringify(['','']);
@@ -2116,12 +2010,10 @@ $(function () {
     localStorage.setItem("lineText",resultObject);
     localStorage.setItem("discern", 0);
     // 点击头部的公交的搜索按钮在左边出现结果
-    $('.inp-icon2').click(function() {
+    $('.inp-icon2').click(function(){
 		map.clearOverlays();
         var startZD = $('#gj-one').val();
         var endZD = $('#gj-two').val();
-        var line = JSON.parse(localStorage.getItem("line"));
-        var discern = localStorage.getItem("discern");
         if (startZD == '' || endZD == ''){
             $('.top_search').show().siblings('.right-map').show().css('top','0px').siblings('.right-search').css('top',msHeight);
             $('.show-first').show().siblings().hide();
@@ -2129,22 +2021,9 @@ $(function () {
             map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
             localStorage.setItem('discern','0');
             layer.msg('请输入起点或终点!');
-            var gjobj = JSON.stringify(['','']);
-            localStorage.setItem("line",gjobj);
-            var objgj = JSON.stringify(['','']);
-            localStorage.setItem("lineText",objgj);
-        } else if((startZD != line[0] || endZD != line[1]) && (discern == 1 || discern == 2)){
-            $('#result').empty();
-            busResultLine(startZD,endZD);
-            localStorage.setItem('discern','1');
-        } else if(startZD == line[0] && endZD == line[1]){
-            return;
-        } else {
-            $('#result').empty();
-            busResultLine(startZD,endZD);
-            localStorage.setItem('discern','1');
-            $("#zj-one").val(line[0]);
-            $("#zj-two").val(line[1]);
+        }else{
+            var url = 'http://api.map.baidu.com/direction?origin='+startZD+'&destination='+endZD+'&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo'
+            window.location.href = url
         }
 	});
     $('#gj-one').bind('keyup',function(event) {
@@ -2156,7 +2035,7 @@ $(function () {
                 $('.right-search').css('top',msHeight);
                 localStorage.setItem('discern','0');
 				map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-			    layer.msg('请输入起点或终点!');
+			    layer.msg('请输入起点!');
 			} else {
                 $('#gj-two').focus();
             }
@@ -2166,7 +2045,6 @@ $(function () {
         map.clearOverlays();
         var startZD = $('#gj-one').val();
         var endZD = $('#gj-two').val();
-        var line = JSON.parse(localStorage.getItem("line"));
 		if(event.keyCode==13){
 			if (startZD == '') {
                 $('.top_search').show().siblings('.right-map').show();
@@ -2182,17 +2060,10 @@ $(function () {
                 localStorage.setItem('discern','0');
 				map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
 				layer.msg('请输入终点!');
-			} else if(startZD != line[0] || endZD != line[1]){
-                busResultLine(startZD,endZD);
-                localStorage.setItem('discern','1');
-            } else if(startZD == line[0] && endZD == line[1]){
-                return;
-            } else {
-                busResultLine(startZD,endZD);
-                localStorage.setItem('discern','1');
-                $("#zj-one").val(line[0]);
-                $("#zj-two").val(line[1]);
-			}
+			} else {
+                var url = 'http://api.map.baidu.com/direction?origin='+startZD+'&destination='+endZD+'&mode=transit&region=重庆&output=html&src=webapp.baidu.openAPIdemo'
+                window.location.href = url
+            }
             document.activeElement.blur();  // 关闭软键盘
 		}
 	});
@@ -2398,7 +2269,6 @@ $(function () {
         map.clearOverlays();
         var startZD = $("#zj-one").val();
         var endZD = $("#zj-two").val();
-        var line = JSON.parse(localStorage.getItem("line"));
         if (startZD == '' || endZD == '') {
             $('.top_search').show().siblings('.right-map').show();
             $('.show-first').show().siblings().hide();
@@ -2411,23 +2281,13 @@ $(function () {
             localStorage.setItem("line",gjobj);
             var objgj = JSON.stringify(['','']);
             localStorage.setItem("lineText",objgj);
-        } else if(startZD != line[0] || endZD != line[1]){
-            $('#result1').empty();
-            drivingResultLine(startZD,endZD);
-            localStorage.setItem('discern','3');
-        } else if(startZD == line[0] && endZD == line[1]){
-            return;
         } else {
-            $('#result1').empty();
-            drivingResultLine(startZD,endZD);
-            localStorage.setItem('discern','3');
-            $("#gj-one").val(line[0]);
-            $("#gj-two").val(line[1]);
+            var url = 'http://api.map.baidu.com/direction?origin='+startZD+'&destination='+endZD+'&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo'
+            window.location.href = url
         }
     });
     $('#zj-one').bind('keyup',function(event) {
         var startZD = $("#zj-one").val();
-        var endZD = $("#zj-two").val();
         if(event.keyCode==13){
             if (startZD == '') {
                 $('.top_search').show().siblings('.right-map').show();
@@ -2444,7 +2304,6 @@ $(function () {
     $('#zj-two').bind('keyup',function(event) {
         var startZD = $("#zj-one").val();
         var endZD = $("#zj-two").val();
-        var line = JSON.parse(localStorage.getItem("line"));
         if(event.keyCode==13){
             if (startZD == '') {
                 $('.top_search').show().siblings('.right-map').show();
@@ -2460,17 +2319,9 @@ $(function () {
                 localStorage.setItem('discern','0');
                 layer.msg('请输入终点!');
                 map.centerAndZoom(new BMap.Point(106.563, 29.523), 14);
-            } else if(startZD != line[0] || endZD != line[1]){
-                drivingResultLine(startZD,endZD);
-                localStorage.setItem('discern','3');
-            } else if(startZD == line[0] && endZD == line[1]){
-                return;
             } else {
-                map.clearOverlays();
-                drivingResultLine(startZD,endZD);
-                localStorage.setItem('discern','3');
-                $("#gj-one").val(line[0]);
-                $("#gj-two").val(line[1]);
+                var url = 'http://api.map.baidu.com/direction?origin='+startZD+'&destination='+endZD+'&mode=driving&region=重庆&output=html&src=webapp.baidu.openAPIdemo'
+                window.location.href = url
             }
             document.activeElement.blur();  // 关闭软键盘
         }