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/js/base.js | 46 ----------------------- gx_tieta/WebRoot/control.jsp | 1 gx_tieta/WebRoot/Top.jsp | 46 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 47 deletions(-) diff --git a/gx_tieta/WebRoot/Top.jsp b/gx_tieta/WebRoot/Top.jsp index f2b9f04..04816b8 100644 --- a/gx_tieta/WebRoot/Top.jsp +++ b/gx_tieta/WebRoot/Top.jsp @@ -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> diff --git a/gx_tieta/WebRoot/control.jsp b/gx_tieta/WebRoot/control.jsp index cfc8d57..038a294 100644 --- a/gx_tieta/WebRoot/control.jsp +++ b/gx_tieta/WebRoot/control.jsp @@ -28,7 +28,6 @@ <!-- <link rel="stylesheet" type="text/css" href="pages/css/mylayui.css"> --> <script type="text/javascript" src="js/echarts.js"></script> <script type="text/javascript" src="js/jquery-1.8.3.js"></script> - <script type="text/javascript" src="js/base.js"></script> <script type="text/javascript" src="js/right-menu.js"></script> <style> body { diff --git a/gx_tieta/WebRoot/js/base.js b/gx_tieta/WebRoot/js/base.js index 99c3c01..3a8d23d 100644 --- a/gx_tieta/WebRoot/js/base.js +++ b/gx_tieta/WebRoot/js/base.js @@ -1150,52 +1150,6 @@ } } -/** - 妫�娴嬫湇鍔″櫒杩炴帴鏄惁姝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); - /*****************甯哥敤鍒ゆ柇鏁版嵁绫诲瀷*****************/ //鏄惁涓烘暟瀛� -- Gitblit v1.9.1