Browse Source

默认执业中

song 3 months ago
parent
commit
4140535d28
5 changed files with 145 additions and 2 deletions
  1. 29 1
      approve.html
  2. 28 0
      approveNew.html
  3. 53 1
      login.html
  4. 34 0
      main.html
  5. 1 0
      unpackage/resources/www/approve.html

+ 29 - 1
approve.html

@@ -27,7 +27,7 @@
 				<!-- <script src="js/uploadImgs.js"></script> -->
 				<script src="js/promptAndAlert.js"></script>
 				<script src="js/fileImg.js"></script>
-		<style>
+
 		<script type="text/javascript">
 			mui.init() 
 		</script>
@@ -141,6 +141,7 @@
 				  mui.confirm('是否确认退出登录?', '系统提示', btnArray, function(e) {
 					if (e.index == 1) {
 						window.location="login.html";
+						localStorage.clear();
 					} else {
 					}
 				})
@@ -148,6 +149,33 @@
 			// $(document).on("click", '#back', function() {
 			// 	window.location="main.html";
 			// });
+
+			 var idleTime = 30 * 60 * 1000; // 时间毫秒数
+			 // 最后一次用户交互的时间变量
+			 var lastInteraction = new Date().getTime();
+			 // 设置一个定时器来检查用户是否空闲
+			 setInterval(function() {
+				 var currentTime = new Date().getTime();
+				 var timeSinceLastInteraction = currentTime - lastInteraction;
+				 // 如果用户在指定的空闲时间内没有进行任何操作,清空缓存
+				 if (timeSinceLastInteraction > idleTime) {
+					 localStorage.clear();
+					 // sessionStorage.clear();
+					 console.log('缓存已清空');
+					 //跳转到登录页面
+					 window.location="login.html";
+				 }
+			 }, 1000); // 每隔一秒检查一次
+			 // 监听用户交互事件来更新lastInteraction的时间
+			 window.onload = function() {
+				 var events = ['mousedown', 'mousemove', 'keydown', 'scroll', 'touchstart'];
+				 events.forEach(function(event) {
+					 document.addEventListener(event, function() {
+						 lastInteraction = new Date().getTime();
+					 }, true);
+				 });
+			 };
+
 			var idcard;
 			var caseid;
 			window.onload = function initInfo(){

+ 28 - 0
approveNew.html

@@ -180,6 +180,7 @@
             mui.confirm('是否确认退出登录?', '系统提示', btnArray, function(e) {
                 if (e.index == 1) {
                     window.location="login.html";
+					localStorage.clear();
                 } else {
                 }
             })
@@ -187,6 +188,33 @@
         // $(document).on("click", '#back', function() {
         // 	window.location="main.html";
         // });
+
+		var idleTime = 30 * 60 * 1000; // 时间毫秒数
+		// 最后一次用户交互的时间变量
+		var lastInteraction = new Date().getTime();
+		// 设置一个定时器来检查用户是否空闲
+		setInterval(function() {
+			var currentTime = new Date().getTime();
+			var timeSinceLastInteraction = currentTime - lastInteraction;
+			// 如果用户在指定的空闲时间内没有进行任何操作,清空缓存
+			if (timeSinceLastInteraction > idleTime) {
+				localStorage.clear();
+				// sessionStorage.clear();
+				console.log('缓存已清空');
+				//跳转到登录页面
+				window.location="login.html";
+			}
+		}, 1000); // 每隔一秒检查一次
+		// 监听用户交互事件来更新lastInteraction的时间
+		window.onload = function() {
+			var events = ['mousedown', 'mousemove', 'keydown', 'scroll', 'touchstart'];
+			events.forEach(function(event) {
+				document.addEventListener(event, function() {
+					lastInteraction = new Date().getTime();
+				}, true);
+			});
+		};
+
         var idcard;
         var caseid;
         window.onload = function (){

+ 53 - 1
login.html

@@ -45,6 +45,23 @@
 					width: 100%;
 					height: 100%;
 				}
+			  .loginmainDiv{
+				  margin-top: 6.25rem;
+				  width: 100%;
+				  height: 100%;
+				  text-align: center;
+			  }
+			  .footer {
+				  height: 100px;
+				  position: absolute;
+				  /*bottom: 0;*/
+				  top: 85%;
+			  }
+			  .footer-inner {
+				  margin: 0 auto;
+				  padding: 10px;
+				  text-align: center;
+			  }
 				.loginbtn{
 					margin-top: 3.125rem;
 					width: 95%;
@@ -138,6 +155,23 @@
 					return;
 				}
 
+				//登录失败处理
+				if(is_locked){
+					mui.toast("失败次数过多,账户已被锁定,请稍后再试!");
+					//清除上一个定时器
+					if(timeoutId != null){
+						clearTimeout(timeoutId);
+						timeoutId = null;
+					}
+					//5分钟后重置登录状态
+					timeoutId = setTimeout(function() {
+						login_attempts = 0;
+						is_locked = false;
+						timeoutId = null;
+					}, 5*60*1000);
+					return;
+				}
+
 				var strSql = "select t.*,y.random,case WHEN sysdate BETWEEN time and TIMESTAMPADD(SECOND,+60*3,time)  " +
 					"then '0' else '1' END status from health.系统用户信息表新  t left join health.sendmsg y on t.mobile=y.phone " +
 					" where  t.mobile='"+username+"' and t.password='"+password+"'";
@@ -161,16 +195,27 @@
 				}
 
             }
+            var is_locked = false;
+            var login_attempts = 0;
+            var timeoutId = null;
 			function querySuccess(evt,KeyValue){
 				
 				if(evt.IsSuc=="Fault"){
-					 mui.toast('用户名或密码错误!\n请输入正确的用户名密码!',{ duration:'long', type:'div' }) 
+					 mui.toast('用户名或密码错误!\n请输入正确的用户名密码!',{ duration:'long', type:'div' })
+					login_attempts++;
+					 if(login_attempts>=5){
+						 is_locked = true;
+					 }
 					return;
 				}
 				var jsonData = evt.data;
 				if(jsonData.length == 0){
 					//mui.alert('用户名或密码错误!\n请输入正确的用户名密码!', '系统提示', function() {});
 					 mui.toast('用户名或密码错误!\n请输入正确的用户名密码!',{ duration:'long', type:'div' })
+					login_attempts++;
+					if(login_attempts>=5){
+						is_locked = true;
+					}
 					return;
 				}
 				if(jsonData != null){
@@ -271,6 +316,13 @@
 				<button type="button" class="mui-btn mui-btn-primary loginbtn"  onclick="userLogin()" >登录 </button>
 			</div>
 		</div>
+		<footer class="footer">
+			<div class="footer-inner">
+				<label style="color: white;">ICP备案主体信息:沪ICP备10043767号</label>
+				<br/><br/>
+				<label style="color: white;">ICP备案服务信息:沪ICP备10043767号-5A</label>
+			</div>
+		</footer>
 	</body>
 	<script>
         var i=180;

+ 34 - 0
main.html

@@ -94,11 +94,38 @@
 				 mui.confirm('是否确认退出登录?', '系统提示', btnArray, function(e) {
 					if (e.index == 1) {
 						window.location="login.html";
+						localStorage.clear();
 					} else {
 					}
 				})
 			});
 
+			var idleTime = 30 * 60 * 1000; // 时间毫秒数
+			// 最后一次用户交互的时间变量
+			var lastInteraction = new Date().getTime();
+			// 设置一个定时器来检查用户是否空闲
+			setInterval(function() {
+				var currentTime = new Date().getTime();
+				var timeSinceLastInteraction = currentTime - lastInteraction;
+				// 如果用户在指定的空闲时间内没有进行任何操作,清空缓存
+				if (timeSinceLastInteraction > idleTime) {
+					localStorage.clear();
+					// sessionStorage.clear();
+					console.log('缓存已清空');
+					//跳转到登录页面
+					window.location="login.html";
+				}
+			}, 1000); // 每隔一秒检查一次
+			// 监听用户交互事件来更新lastInteraction的时间
+			window.onload = function() {
+				var events = ['mousedown', 'mousemove', 'keydown', 'scroll', 'touchstart'];
+				events.forEach(function(event) {
+					document.addEventListener(event, function() {
+						lastInteraction = new Date().getTime();
+					}, true);
+				});
+			};
+
 			mui.init({
 				//swipeBack: true //启用右滑关闭功能
 			});
@@ -318,6 +345,13 @@
 			var role;
             var town;
 			window.onload = function load(){
+				//判断用户是否登录
+				if(localStorage.getItem("username") == null){
+					console.log('用户未登录');
+					//跳转到登录页面
+					window.location="login.html";
+					return;
+				}
                 var district = localStorage.getItem("district");
 				districtcode = localStorage.getItem("districtcode");
 				town = localStorage.getItem("town");

+ 1 - 0
unpackage/resources/www/approve.html

@@ -116,6 +116,7 @@
 				  mui.confirm('是否确认退出登录?', '系统提示', btnArray, function(e) {
 					if (e.index == 1) {
 						window.location="login.html";
+						localStorage.clear();
 					} else {
 					}
 				})