From 75f8d8615b1d994b9a49db7ec154abb8466bb690 Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期一, 26 十一月 2018 12:23:59 +0800
Subject: [PATCH] 添加图片拖动验证

---
 gx_tieta/WebRoot/login.jsp |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 106 insertions(+), 8 deletions(-)

diff --git a/gx_tieta/WebRoot/login.jsp b/gx_tieta/WebRoot/login.jsp
index 3b9c2f1..71f49f7 100644
--- a/gx_tieta/WebRoot/login.jsp
+++ b/gx_tieta/WebRoot/login.jsp
@@ -46,6 +46,7 @@
     <link rel="stylesheet" href="jqueryui/jquery-ui.css">
     <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css">
     <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome-animation.min.css">
+    <link rel="stylesheet" type="text/css" href="js/verify/css/verify.css">
     <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
     <script type="text/javascript" src="jqueryui/jquery-ui.js"></script>
     <script type="text/javascript" src="js/qrcode.js"></script>
@@ -98,8 +99,20 @@
                 <img src="image/loading-open.gif" alt="">
             </div>
         </div>
+        <!-- 楠岃瘉鐮佺櫥闄嗛潰鏉� -->
+        <div class="hdw-dialog hdw-dialog-hide" id="lVerify-dialog">
+        	<div class="hdw-dialog-container">
+        		<div class="hdw-dialog-bg"></div>
+        		<div class="hdw-dialog-content hdw-dialog-width500-300">
+        			<div class="hdw-dialog-content-container">
+        				<div id="lVerify" ></div>
+        			</div>
+        		</div>
+        	</div>
+        </div>
     </div>
     <script type="text/javascript" src="js/nocontent.js"></script>
+    <script type="text/javascript" src="js/verify/js/verify.min.js"></script>
     <script type="text/javascript">
     	var entername="<s:text name='Enter_username'/>";
 		var enterpass="<s:text name='Enter_password'/>";
@@ -124,7 +137,73 @@
             }, 1200);
             
             initDBpool();
+            
+            // 閰嶇疆鎷栧姩楠岃瘉鍥惧儚
+            $('#lVerify').slideVerify({
+				type : 2,   //绫诲瀷
+				vOffset : 5,  //璇樊閲忥紝鏍规嵁闇�姹傝嚜琛岃皟鏁�
+				vSpace : 5, //闂撮殧
+				imgName : ['1.jpg', '2.jpg'],
+				imgSize : {
+					width: '498px',
+					height: '250px',
+				},
+				blockSize : {
+					width: '40px',
+					height: '40px',
+				},
+				barSize : {
+					width : '498px',
+					height : '40px',
+				},
+    			ready : function() {
+    				
+    			},
+				success : function() {
+					$('#lVerify-dialog').addClass('hdw-dialog-hide');	// 闅愯棌楠岃瘉
+					checkuser();	// 楠岃瘉鐢ㄦ埛
+				},
+				error : function() {
+					// alert('楠岃瘉澶辫触锛�');
+				}
+			});
         });
+        
+        // 鍒濆鍖杤erify鎷栧姩楠岃瘉
+        function initVerify() {
+        	// 娓呯┖鍐呭
+        	$('#lVerify').text('');
+        	// 閰嶇疆鎷栧姩楠岃瘉鍥惧儚
+            $('#lVerify').slideVerify({
+				type : 2,   //绫诲瀷
+				vOffset : 5,  //璇樊閲忥紝鏍规嵁闇�姹傝嚜琛岃皟鏁�
+				vSpace : 5, //闂撮殧
+				imgName : ['1.jpg', '2.jpg'],
+				imgSize : {
+					width: '498px',
+					height: '250px',
+				},
+				blockSize : {
+					width: '40px',
+					height: '40px',
+				},
+				barSize : {
+					width : '498px',
+					height : '40px',
+				},
+    			ready : function() {
+    				
+    			},
+				success : function() {
+					$('#lVerify-dialog').addClass('hdw-dialog-hide');	// 闅愯棌楠岃瘉
+					checkuser();	// 楠岃瘉鐢ㄦ埛
+				},
+				error : function() {
+					// alert('楠岃瘉澶辫触锛�');
+				}
+			});
+        }
+        
         
         //鍒濆鍖栬繛鎺ユ睜
         function initDBpool(){
@@ -167,7 +246,8 @@
 				$('#sub').children('.faa-spin').css('visibility', 'hidden');
 				$('#sub').removeClass('page-loading');
 			} else {
-				checkuser();
+				$('#lVerify-dialog').removeClass('hdw-dialog-hide');	// 鏄剧ず鎷栧姩楠岃瘉鏁版嵁
+				initVerify();
 			}
 		}
 
@@ -191,7 +271,7 @@
 						$('#sub').children('.faa-spin').css('visibility', 'hidden');
 						$('#sub').removeClass('page-loading');
 					} else {
-						window.location.href = data.msg;						
+						setNavSession(data.msg);
 					}
 				}).error(function(){
 					noContent.showNoContent("鐧诲綍澶辫触璇锋鏌ョ綉缁滆繛鎺�!");
@@ -237,18 +317,36 @@
 			}
 		});
 		
-		checkNavSession();
+		// 璁剧疆瀵艰埅鏁版嵁
+		function setNavSession(link) {
+			$.ajax({
+				url:'CustompageAction!searchAll',
+				data: null,
+				asnyc: true,
+				dataType: 'json',
+				success:function(res) {
+					console.log(res);
+					var rs = JSON.parse(res.result);
+					if(rs.code == 1) {
+						window.location.href = link;
+					}else {
+						
+					}
+					
+				}
+			});
+		}
+		
+		//checkNavSession();
 		// 鐩戞祴瀵艰埅鏁版嵁鐨剆ession
-		function checkNavSession() {
+		function checkNavSession(link) {
 			$.ajax({
 				url:'LoginAction!getSessionByString',
 				data: 'json=custompages_json',
 				asnyc: true,
 				success:function(rs) {
-					if(rs.result == "") {
-						location.reload();
-					}
-					setTimeout(checkNavSession, 1500);
+					console.log(rs);
+					//window.location.href = link;
 				}
 			});
 		}

--
Gitblit v1.9.1