From 5b91f290dea4d6b6c1f159e28e0159e32aa5ac53 Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期三, 14 十一月 2018 10:37:03 +0800
Subject: [PATCH] 更改检测服务器状态的函数位置

---
 gx_tieta/WebRoot/Top.jsp |   64 +++++++++++++++++++++++++++----
 1 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/gx_tieta/WebRoot/Top.jsp b/gx_tieta/WebRoot/Top.jsp
index 38a07a1..04816b8 100644
--- a/gx_tieta/WebRoot/Top.jsp
+++ b/gx_tieta/WebRoot/Top.jsp
@@ -64,7 +64,7 @@
 			<div class="batt-state">
 			
 				<div class="list">
-					<div class="list-contain"><s:text name='Computer_room'/><s:text name='Power_cut'/><s:text name='Num'/>:<a href="batt-state-manage.jsp?station_state=2" class="badge default" id="poweroff_num">0</a></div>		<!-- 鏈烘埧鍋滅數鏁� -->
+					<div class="list-contain"><s:text name='Power_cut'/><s:text name='Computer_room'/><s:text name='Num'/>:<a href="batt-state-manage.jsp?station_state=2" class="badge default" id="poweroff_num">0</a></div>		<!-- 鏈烘埧鍋滅數鏁� -->
 				</div>
 				<div class="list">
 					<div class="list-contain"><s:text name="Batt"/><s:text name="Alarm"/><s:text name="Num"/>:<a href="elewarn.jsp" class="badge danger" id="batt_alarm_num">0</a></div>								<!-- 鐢垫睜鍛婅鏁� -->
@@ -84,7 +84,7 @@
 				</c:forEach>
 				<div class="list">
 					<div class="list-contain">
-						鏍稿娴嬭瘯璁惧:<a href="javascript:void(0);" class="badge default" id="nuclear_test">0</a>
+						鏍稿娴嬭瘯璁惧鏁�:<a href="javascript:void(0);" class="badge default" id="nuclear_test">0</a>
 					</div>
 				</div>
 			</div>
@@ -127,9 +127,9 @@
 				<div class="cell-list plan-ele">
 					<img src="image/webStatus/plan_normal.gif" alt="鏀剧數璁″垝鐩戞祴绾跨▼" title="鏀剧數璁″垝鐩戞祴绾跨▼锛氭甯�">
 				</div>
-				<div class="cell-list break-ele">
+				<div class="cell-list break-ele" style="display: none;">
 					<img src="image/webStatus/break_ele_normal.gif" alt="鏈烘埧鍋滅數鐩戞祴绾跨▼" title="鏈烘埧鍋滅數鐩戞祴绾跨▼锛氭甯�">
-				</div>	
+				</div>	 
 				<div class="cell-list control">
 					<img src="image/webStatus/control_normal.gif" alt="绾跨▼鐩戞帶绋嬪簭" title="绾跨▼鐩戞帶绋嬪簭杩愯锛氭甯�">
 				</div>			
@@ -583,7 +583,7 @@
 						window.open("eleHistoryWarn.jsp?home="+obj.stationname+"&battid="+obj.BattGroupId);
 					}
 				}else{
-					alert("璇ュ憡璀﹀凡缁忚鍒犻櫎");
+					alert("璇ュ憡璀﹀凡缁忔仮澶�");
 					//window.open("eleHistoryWarn.jsp?home="+obj.stationname+"&battid="+obj.BattGroupId);
 				}				
 	    	} 				
@@ -615,7 +615,7 @@
 						window.open("equipHistWarn1.jsp?home="+obj.stationName);
 					}
 				}else{
-					alert("璇ュ憡璀﹀凡缁忚鍒犻櫎");
+					alert("璇ュ憡璀﹀凡缁忔仮澶�");
 				}		
 	    	} 				
 		});
@@ -652,7 +652,7 @@
 	
 	// 鏍稿娴嬭瘯妯″潡
 	$(function() {
-		var arrTh = ['鏈烘埧鍚嶇О', '璁惧ID', '璁惧鍚嶇О','璁惧鐘舵��', '鍦ㄧ嚎鐢靛帇锛圴锛�', '缁勭鐢靛帇锛圴锛�', '缁勭鐢垫祦锛坢A锛�','璁惧娓╁害锛堚剝锛�', '宸叉祴瀹归噺锛圓H锛�', '璁惧鍛婅', '宸叉祴鏃堕棿'];
+		var arrTh = ['鏈烘埧鍚嶇О', '璁惧ID', '璁惧鍚嶇О','璁惧鐘舵��', '鍦ㄧ嚎鐢靛帇锛圴锛�', '缁勭鐢靛帇锛圴锛�', '缁勭鐢垫祦锛圓锛�','璁惧娓╁害锛堚剝锛�', '宸叉祴瀹归噺锛圓H锛�', '璁惧鍛婅', '宸叉祴鏃堕棿'];
 		var arrTd = [];
 		var eleTh = $('#navNuclearTest-data .nuclearTest-tbl-header');
 		var eleTd = $('#navNuclearTest-data .nuclearTest-tbl-body');
@@ -724,7 +724,7 @@
 	    
 	    // 鏍规嵁鏁版嵁鐢熸垚琛ㄦ牸
 	    function createTblByModel(model) {
-	    	//console.log(model);
+	    	console.log(model);
 	    	arrTd = [];
 			for(var i=0; i<model.data.length; i++) {
 				var data = model.data[i];
@@ -738,7 +738,7 @@
 				arrTd.push(data.dev_temp);											// 璁惧娓╁害
 				arrTd.push(data.dev_captest_cap);									// 宸叉祴瀹归噺
 				arrTd.push(getStateByArray(data.dev_alarmstate,BTS_alarmstates));	// 璁惧鍛婅
-				arrTd.push(formatSeconds(data.num));								// 宸叉祴鏃堕棿
+				arrTd.push(formatSeconds(data.dev_captest_timelong));				// 宸叉祴鏃堕棿
 			}
 			createFullTbl(eleTh, eleTd, arrTh, arrTd);
 			
@@ -778,5 +778,51 @@
 	    	return str;
 	    }
 	});
+	
+	/**
+	  妫�娴嬫湇鍔″櫒杩炴帴鏄惁姝e父
+	  绋嬪簭鍔熻兘: 閫氳繃璇锋眰鍚庡彴绋嬪簭濡傛灉涓夋閮借姹傚け璐ヨ涓烘湇鍔″櫒鎸傛帀,璺宠浆鍒扮櫥闄嗛〉闈�
+	*/
+	;(function ($) {
+		var url = window.location.href;
+		var loginPatt = /\/login.jsp/;
+		
+		// 鍒ゆ柇褰撳墠椤甸潰涓嶆槸鐧婚檰椤甸潰寮�濮嬫墽琛屾娴嬫湇鍔″櫒鐘舵��
+		if(!loginPatt.test(url)) {
+			checkServer();
+		}
+		
+		var linkNum = 0;    // 娴嬭瘯鏈嶅姟鍣ㄨ繛鎺ヨ鏁� =3 璺宠浆鍒扮櫥闄嗛〉闈�
+		function checkServer() {
+		    $.ajax({
+		        url:'User_infAction!checkService',
+		        type: 'post',
+		        async: true,
+		        success: function(rs) {
+		            linkNum = 0;    // 鍒濆鍖栨祴璇曡繛鎺�
+		            setTimeout(checkServer, 200);
+		        },
+		        error:function() {
+		             // 缃戠粶杩炴帴涓嶆甯�
+		            if(!navigator.onLine) {
+		                 linkNum = 0;
+		                 setTimeout(checkServer, 200);
+		            }else{
+		            	 linkNum++;
+		                 // 鏈嶅姟鍣ㄨ繛鎺ヤ笉姝e父
+		                 if(linkNum == 3) {
+		                	 console.info('鍑虹幇绗�'+linkNum+"娆℃祴璇曟湇鍔″櫒杩炴帴澶辫触锛佽烦杞埌鐧婚檰");
+		                	 // 缃戠粶姝e父浣嗘湇鍔″櫒杩炵画澶氭妫�娴嬩笉姝e父璺宠浆鍒扮櫥闄嗛〉闈�
+			            	 alert('缃戠粶杩炴帴寮傚父锛岃妫�鏌ョ綉缁滆繛鎺ユ槸鍚︽甯革紒');
+			                 window.location.replace("login.jsp");
+		                 }else {
+		                	 console.info('鍑虹幇绗�'+linkNum+"娆℃祴璇曟湇鍔″櫒杩炴帴澶辫触锛�");
+		                	 checkServer();
+		                 }
+		            }
+		        }
+		    });
+		}
+	})(jQuery);
   </script>
 </html>

--
Gitblit v1.9.1