李雪梅 пре 2 година
родитељ
комит
a853ba70ae
1 измењених фајлова са 70 додато и 181 уклоњено
  1. 70 181
      nngkxxdp/src/main/resources/static/district/js/sy.js

+ 70 - 181
nngkxxdp/src/main/resources/static/district/js/sy.js

@@ -866,9 +866,9 @@ $(function() {
 		$.each(getClick,function(i){
 			getClickDep = getClick[i].dep
 		});
-		var typepage = 1
+		var typepage = 0
 		pageAjax(getClickDep,getClick1,getClick,typepage);
-		addGEO(getClick);
+		// addGEO(getClick);
 		$(this).parents('.title-first').css('background-color', '#d6e5f7').siblings().css('background-color', '');
 	});
 
@@ -918,10 +918,9 @@ $(function() {
 			var typepage = 5
 			pageAjax(getClickDep,getClick1,getClick,typepage);
 		}else{
-			var typepage = 1
+			var typepage = 0
 			pageAjax(getClickDep,getClick1,getClick,typepage);
 		}
-		addGEO(getClick);
 		$(this).parents('.title-first1').css('background-color', '#d6e5f7').siblings().css('background-color', '');
 	});
 	
@@ -936,7 +935,6 @@ $(function() {
 	function pageAjax(getClickDep,getClick1,getClick,typepage){
 		if(typepage == 3){
 			addajax(getClickDep,getClick1,getClick,typepage);
-			addGEO(getClick1);
 		}else if(typepage == 5){
 			addajax(getClickDep,getClick1,getClick,typepage);
 		}else if (getClick.length == 0){
@@ -1075,7 +1073,7 @@ $(function() {
 							});
 							sContnet += "</ul></div></div></li></ul>"
 							if (tempAdd == arraddre) {
-								addMarker1(arrIndex,index,address,new BMap.InfoWindow(sContnet,arraddre));
+								addMarker(arrIndex,address,new BMap.InfoWindow(sContnet,arraddre),arrdep,typepage);
 								map.setCenter(addFirst);
 							}
 						}else{
@@ -1094,7 +1092,7 @@ $(function() {
 							sContnet += "</ul><ul class='text-tab-item'></ul></div>"
 							sContnet += "</div><div id='demo'></div></li></ul>"
 							if (tempAdd == arraddre) {
-								addMarker(arrIndex, index, address, new BMap.InfoWindow(sContnet, arraddre), arrdep);
+								addMarker(arrIndex,address,new BMap.InfoWindow(sContnet, arraddre),arrdep,typepage);
 								map.setCenter(addFirst);
 							}
 						}
@@ -1136,7 +1134,8 @@ $(function() {
 							var arrIndex = arr[index].clickIndex;
 							var arrUrl = arr[index].url;
 							var arrSptype = arr[index].sptype;
-							var arrgzh = arr[index].gzh
+							var arrgzh = arr[index].gzh;
+							var typepage;
 							var sContnet = ''
 							sContnet += "<ul class='titleFirst'><li class='title_flex' title='"+arrdep+"'>"+arrdep
 							if ((arrtype==null||arrtype==undefined)||arrtype==''){
@@ -1218,7 +1217,7 @@ $(function() {
 							}
 							sContnet += "<li class='btn_box'><button class='one_bus'>公交</button><button class='two_car'>自驾</button></li></ul>"
 							if (tempAdd==arraddre){
-								addMarker2(arrIndex, index, address, new BMap.InfoWindow(sContnet, arraddre), arrdep);
+								addMarker(arrIndex,address,new BMap.InfoWindow(sContnet, arraddre),arrdep,typepage);
 							}
 							document.querySelectorAll(".two_img").onload = function() {
 								infoWindow.redraw();
@@ -1267,21 +1266,22 @@ $(function() {
 		})
 	}
 
-	function addGEO(arr){
-		var addToFirst;
-		$.each(arr,function(z){
-			const tempaddress = arr[z].address;
-			myGeo.getPoint(tempaddress, function(point) {
-				if(point){
-					addToFirst = new BMap.Point(point.lng, point.lat);
-				}
-			}, "重庆市");
-		});
-		setTimeout(function() {
-			map.setCenter(addToFirst);
-		},100);
-	}
+	// function addGEO(arr){
+	// 	var addToFirst;
+	// 	$.each(arr,function(z){
+	// 		const tempaddress = arr[z].address;
+	// 		myGeo.getPoint(tempaddress, function(point) {
+	// 			if(point){
+	// 				addToFirst = new BMap.Point(point.lng, point.lat);
+	// 			}
+	// 		}, "重庆市");
+	// 	});
+	// 	setTimeout(function() {
+	// 		map.setCenter(addToFirst);
+	// 	},100);
+	// }
 
+	// 点击我要纠错
 	$(document).on('click','.correct_text',function(){
 		var address_text = $(this).siblings('li').find(".jzdz").text();
 		// var discript_text = address_text.split(":")[1];
@@ -1463,16 +1463,15 @@ $(function() {
 		    }
 		});
 	};
-	
 
-	function addMarker(getIndex, index, point, infoWindow, dep) {
+	function addMarker(getIndex,point,infoWindow,dep,typepage) {
 		var myIcon = new BMap.Icon("./img/location.png", new BMap.Size(40, 40));
 		var marker = new BMap.Marker(point, {
 			icon: myIcon
 		});
 		map.addOverlay(marker);
 		if (getIndex) {
-			marker.openInfoWindow(infoWindow);
+			map.openInfoWindow(infoWindow, point);
 			$(".one_bus").click(function() {
 				var _this = this;
 				busClickEvent(_this);
@@ -1481,6 +1480,7 @@ $(function() {
 				var _this = this;
 				drivingClickEvent(_this);
 			});
+			// 信息窗口内的我要纠错,点击之后跳转链接
 			$('.correct_html').click(function(){
 				var address_text = $(this).parent(".address_box").find("p:nth-child(1)").text();
 				var discript_text = address_text.split(":")[1];
@@ -1493,53 +1493,49 @@ $(function() {
 				$(this).attr('href','correct.html');
 			});
 			layui.use(['laypage', 'layer'], function(){
-				var laypage = layui.laypage,layer = layui.layer;
-				var count;
-				var firstpage = 1;
-				var pagetype = 0;
-				page(firstpage,pagetype)
-				function page(page,pagetype) {
-					$.ajax({
-						type: 'GET',
-						url: PATH + '/mapdata/getHandMatterPage',
-						// url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
-						async: false,
-						dataType: 'json',
-						data: {
-							page: page,
-							limit: 4,
-							type: pagetype,
-							matterDept: dep
-						},
-						success: function(res){
-							count = res.count;
-							var html = '';
-							$.each(res.data,function(j){
-								html += "<li>"
-								html += "<a href='"+res.data[j].matterUrl+"' target='_blank'>"
-								html += "<h6></h6>"
-								html += "<p title='"+res.data[j].itemName+"'>"+res.data[j].itemName+"</p>"
-								html += "</a>"
-								html += "</li>"
-							})
-							$('.text-tab-item').empty().append(html)
-						}
-					});
-				}
-				laypage.render({
-					elem: 'demo'
-					,count: count
-					,limit: 4
-					,layout: ['prev', 'next']
-					,prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>'
-					,next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>'
-					,jump: function(obj,first){
-						// if(!first){
+				var laypage = layui.laypage;
+				if(typepage==0){
+					var count;
+					var firstpage = 1;
+					var pagetype = 0;
+					page(firstpage,pagetype)
+					laypage.render({
+						elem: 'demo'
+						,count: count
+						,limit: 4
+						,layout: ['prev', 'next']
+						,prev: '<i class="layui-icon layui-icon-left"></i><span>上一页</span>'
+						,next: '<span>下一页</span><i class="layui-icon layui-icon-right"></i>'
+						,jump: function(obj){
 							pagetype = 0
 							page(obj.curr,pagetype)
-						// }
+						}
+					});
+					function page(page,pagetype) {
+						$.ajax({
+							type: 'GET',
+							url: PATH + '/mapdata/getHandMatterPage',
+							// url: "http://192.168.1.253:7777/mapdata/getHandMatterPage",
+							async: false,
+							dataType: 'json',
+							data: {
+								page: page,
+								limit: 4,
+								type: pagetype,
+								matterDept: dep
+							},
+							success: function(res){
+								count = res.count;
+								var html = '';
+								$.each(res.data,function(j){
+									html += "<li><a href='"+res.data[j].matterUrl+"' target='_blank'><h6></h6>"
+									html += "<p title='"+res.data[j].itemName+"'>"+res.data[j].itemName+"</p></a></li>"
+								})
+								$('.text-tab-item').empty().append(html)
+							}
+						});
 					}
-				});
+				}
 			});
 			$('.text-tab-title li').click(function(){
 				var tabtex = $(this).text();
@@ -1556,7 +1552,7 @@ $(function() {
 							$.ajax({
 								type: 'GET',
 								url: PATH + '/mapdata/getHandMatterPage',
-								// url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
+								// url: "http://192.168.1.253:7777/mapdata/getHandMatterPage",
 								async: false,
 								dataType: 'json',
 								data: {
@@ -1607,7 +1603,7 @@ $(function() {
 							$.ajax({
 								type: 'GET',
 								url: PATH + '/mapdata/getHandMatterPage',
-								// url: "http://192.168.0.40:7777/mapdata/getHandMatterPage",
+								// url: "http://192.168.1.253:7777/mapdata/getHandMatterPage",
 								async: false,
 								dataType: 'json',
 								data: {
@@ -1647,11 +1643,12 @@ $(function() {
 						});
 					});
 				}
-			})
+			});
 		}
 		marker.addEventListener("click", function() {
 			map.openInfoWindow(infoWindow, point); //开启信息窗口
 		});
+		// 在地图上点击图标之后,信息窗口打开
 		infoWindow.addEventListener("open", function () {
 			$(".one_bus").click(function () {
 				var that = this;
@@ -1831,114 +1828,6 @@ $(function() {
 		});
 	}
 
-	function addMarker1(getIndex, index, point, infoWindow) {
-		var myIcon = new BMap.Icon("./img/location.png", new BMap.Size(40, 40));
-		var marker = new BMap.Marker(point, {
-			icon: myIcon
-		});
-		map.addOverlay(marker);
-		if (getIndex) {
-			marker.openInfoWindow(infoWindow);
-			$(".one_bus").click(function() {
-				var _this = this;
-				busClickEvent(_this);
-			});
-			$(".two_car").click(function() {
-				var _this = this;
-				drivingClickEvent(_this);
-			});
-			$('.correct_html').click(function(){
-				var address_text = $(this).parent(".address_box").find("p:nth-child(1)").text();
-				var discript_text = address_text.split(":")[1];
-				var filterId = allArr.filter(function(i){
-					return i.address == discript_text
-				});
-				$.each(filterId,function(i){
-					localStorage.setItem("passid",filterId[i].id);
-				})
-				$(this).attr('href','correct.html');
-			});
-		}
-		marker.addEventListener("click", function() {
-			map.openInfoWindow(infoWindow, point); //开启信息窗口
-		});
-		infoWindow.addEventListener("open", function () {
-			$(".one_bus").click(function () {
-				var that = this;
-				busClickEvent(that);
-			});
-			$(".two_car").click(function () {
-				var that = this;
-				drivingClickEvent(that);
-			});
-			$('.correct_html').click(function(){
-				var address_text = $(this).parent(".address_box").find("p:nth-child(1)").text();
-				var discript_text = address_text.split(":")[1];
-				var filterId = allArr.filter(function(i){
-					return i.address == discript_text
-				});
-				$.each(filterId,function(i){
-					localStorage.setItem("passid",filterId[i].id);
-				})
-				$(this).attr('href','correct.html');
-			});
-		});
-	}
-
-	function addMarker2(getIndex, index, point, infoWindow, dep) {
-		var myIcon = new BMap.Icon("./img/location.png", new BMap.Size(40, 40));
-		var marker = new BMap.Marker(point, {
-			icon: myIcon
-		});
-		map.addOverlay(marker);
-		if (getIndex) {
-			marker.openInfoWindow(infoWindow);
-			$(".one_bus").click(function() {
-				var _this = this;
-				busClickEvent(_this);
-			});
-			$(".two_car").click(function() {
-				var _this = this;
-				drivingClickEvent(_this);
-			});
-			$('.correct_html').click(function(){
-				var address_text = $(this).parent(".address_box").find("p:nth-child(1)").text();
-				var discript_text = address_text.split(":")[1];
-				var filterId = allArr.filter(function(i){
-					return i.address == discript_text
-				});
-				$.each(filterId,function(i){
-					localStorage.setItem("passid",filterId[i].id);
-				})
-				$(this).attr('href','correct.html');
-			});
-		}
-		marker.addEventListener("click", function() {
-			map.openInfoWindow(infoWindow, point); //开启信息窗口
-		});
-		infoWindow.addEventListener("open", function () {
-			$(".one_bus").click(function () {
-				var that = this;
-				busClickEvent(that);
-			});
-			$(".two_car").click(function () {
-				var that = this;
-				drivingClickEvent(that);
-			});
-			$('.correct_html').click(function(){
-				var address_text = $(this).parent(".address_box").find("p:nth-child(1)").text();
-				var discript_text = address_text.split(":")[1];
-				var filterId = allArr.filter(function(i){
-					return i.address == discript_text
-				});
-				$.each(filterId,function(i){
-					localStorage.setItem("passid",filterId[i].id);
-				})
-				$(this).attr('href','correct.html');
-			});
-		});
-	}
-
 	// 封装点击公交点击获取的值的部分
 	function busClickEvent(that){
 		var address_text = $(that).parent(".btn_box").siblings(".address_box").find("p:nth-child(1)").text();