Browse Source

邀请码登录后,设置密码页面改版

xuchunyang 8 years ago
parent
commit
3b38de652a
8 changed files with 99 additions and 302 deletions
  1. 1 1
      js/common.js
  2. 0 89
      js/login-first.js
  3. 0 86
      js/login-invite-code.js
  4. 89 0
      js/loginInviteFirst.js
  5. 2 1
      js/loginNew.js
  6. 0 58
      login-first.html
  7. 0 56
      login-invite-code.html
  8. 7 11
      loginInviteFirst.html

+ 1 - 1
js/common.js

@ -145,7 +145,7 @@ function loginStatus(){
145 145
		$(".unlogin").show();
146 146
		$(".onlogin").hide();
147 147
	}else if(userid != null && userAuth == "false" && userName != null){
148
		location.href="login-first.html";
148
		location.href="loginInviteFirst.html";
149 149
	}else if(userid != null && userAuth == "true" && userName == ""){
150 150
		location.href="fillinfo-select.html";
151 151
	}else{

+ 0 - 89
js/login-first.js

@ -1,89 +0,0 @@
1

2
	//var _widht = document.documentElement.clientWidth;  //屏幕宽
3
	var _height = document.documentElement.clientHeight; //屏幕高
4
	//var boxWidth = $(".login-first").width();
5
	var boxHeight = $(".login-first").height();
6
	$(".login-first").css({ top: (_height - boxHeight) / 2 +"px" });
7

8
//检查用户是否登陆
9
	$(function(){  
10
	    if($.cookie("userAuth") == true){
11
	    	
12
	    	location.href="index.html";
13
	    }else{
14
	    	var userid=$.cookie("userid");
15
	    	$.ajax({
16
	    		
17
	    		"url":"/ajax/professor/info/" + userid,
18
	    		"data":{"id":userid},
19
	    		"beforeSend":function(response){
20
	    			//alert("110");
21
	    			//console.log(response);
22
	    		},
23
	    		"success":function(response){
24
	    			
25
	    			$("#name").text(response.data.name);
26
	    			//console.log(response.data.name);
27
	    		},
28
	    		"error":function(error){
29
	    			$.MsgBox.Alert('message','fail');
30
	    		}
31
	    	})
32

33
	    }
34
	}); 
35
	var isPass = false;
36
	var isPass1=false;
37
	function valPassword(){
38
		var password = $("#password").val();
39
		if(password.length==0){
40
			 $(".msg1").text("密码不能为空");
41
		}else if(password.length<6){
42
			$(".msg1").text("密码长度过短,至少六位");
43
		}else{
44
			$(".msg1").text("");
45
			isPass1=true;
46
		}
47
	}
48

49
	function valPassword2(){
50
		var password = $("#password").val();
51
		var password2 = $("#password2").val();
52
		if(password2.length==0){
53
			 $(".msg2").text("密码不能为空");
54
		}else if(password2 != password){
55
			$(".msg2").text("两次输入密码不一致");
56
		}else{
57
			isPass = true;
58
			$(".msg2").text("");
59
		}
60
	}
61
	function savePassword(){
62
		valPassword();
63
		valPassword2();
64
		if(isPass&&isPass1){
65
			location.href = "index.html";
66
			$.ajax("/ajax/cp",{
67
					type:"POST",
68
					 async: false,
69
					success:function(data){  
70

71
						if(data.success){
72
							if(data.data == true){								
73
								$.cookie("userAuth","true");
74
//								location.href = "index.html";
75
							}else{
76
								$(".msg3").text("设置错误!");
77
							}
78
						}else{
79
							$(".msg3").text("系统异常!");
80
							// alert("系统异常!");
81
						}
82
					},
83
					error:function(){$.MsgBox.Alert('message','fail')},
84
					data:{"id":$.cookie("userid"),"npw":$("#password").val() ,"onw":""},
85
				 	dataType: 'json'
86
				});
87
		}
88

89
	}

+ 0 - 86
js/login-invite-code.js

@ -1,86 +0,0 @@
1
	loginStatus();//判断个人是否登录
2
	var _height = document.documentElement.clientHeight; //屏幕高
3
	var boxHeight = $(".loginbox-invite").height();
4
	$(".loginbox-invite").css({ top: (_height - boxHeight) / 2 +"px" });
5

6
	//验证手机号
7
	var phonePass = false;
8
	
9
	function phoneVal(){
10
		var phone= $("#phone").val();
11
		if(phone.length==0){
12
	        $(".msg1").text("请输入您的手机号码或邮箱地址");
13
	    }else{
14
	    	
15
    	    var hun=/\s+/;
16
	        if(hun.test(phone.trim()))
17
	        {
18
	            $(".msg1").text("请输入");
19
	            phonePass = false;
20
	        }else{
21
	            //var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
22
	            var gunf= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 
23
	            if(gunf.test(phone.trim()))
24
	            { 
25
	               $(".msg1").text("");
26
	               phonePass = true;
27
	            }else{
28
	            	var hunPhone=/^1[3|4|5|7|8]\d{9}$/;
29
	    			if(hunPhone.test(phone.trim())){
30
	    				$(".msg1").text("");
31
	    				phonePass = true;
32
	    			}else{
33
	    				phonePass = false;
34
	    				$(".msg1").text("格式不对,请输入正确的格式");
35
	    			}
36
	            }
37
	        }
38
	    }
39
	    
40
	}
41
	//验证验证邀请码
42
	var codePass = false;
43
	function codeVal(){
44
		var code = $("#code").val();
45
		if(code.length==0){
46
			$(".msg2").text("请输入正确的邀请码");
47
			codePass = false;
48
		}else{
49
			$(".msg2").text("");
50
			codePass = true;
51
		}
52
	}	
53
	function loginSub(){
54
		phoneVal();
55
		codeVal();
56
		if(phonePass && codePass){
57
			$.ajax("/ajax/invitelogin",{
58
					type:"POST",
59
					 async: false,
60
					success:function(data){  
61
						//console.log(data)
62
						if(data.success){
63
							if(data.data != "null" && data.data != null){
64
								if(data.data.auth == true){
65
									location.href="index.html";
66
								}else{
67
									location.href="login-first.html";
68
								}
69
							}else{
70
								$(".msg3").text("手机或邮箱和邀请码不匹配,请确认后登录!");
71
							}
72
						}else{
73
							$(".msg3").text("系统异常!");
74
							// alert("系统异常!");
75
						}
76
					},
77
					error:function(){$.MsgBox.Alert('message','fail')},
78
					data:{"code":$("#code").val(),"key":$("#phone").val()},
79
				 	dataType: 'json'
80
				});
81
			}
82

83
	}
84
	function restSub(data) {  
85
         $(".msg3").text("");
86
     } 

+ 89 - 0
js/loginInviteFirst.js

@ -0,0 +1,89 @@
1
//邀请码登录设置密码页面
2
$(function(){  
3
	$(".serviceBox").hover(function(){
4
		$(".serviceTel").fadeToggle();
5
	})
6
	var userid=$.cookie("userid");
7
	$.ajax({
8
		"url":"/ajax/professor/info/" + userid,
9
		"data":{"id":userid},
10
		"success":function(response){
11
			$("#name").text(response.data.name);
12
		},
13
		"error":function(error){
14
			$.MsgBox.Alert('消息', '服务器请求失败');
15
		}
16
	})
17
}); 
18

19
/*校验登录按钮显示状态*/
20
function checkLoginButtn(_this) {
21
	var passwordVal = $(_this).parents(".waysBlock").find("#password").val();
22
	var passwordokVal = $(_this).parents(".waysBlock").find("#passwordok").val();
23
	if(passwordVal == "" || passwordokVal == "") {
24
		$(_this).parents(".waysBlock").find("#ButSubmit").attr("disabled", true);
25
	} else {
26
		$(_this).parents(".waysBlock").find("#ButSubmit").attr("disabled", false);
27
	}
28
}
29
/*获取焦点*/
30
function getFocus(_this) {
31
	$(_this).next().find("span").text("");
32
	$(_this).removeClass("frmmsg-warning");
33
}
34

35
var isPass = false;
36
var isPass1=false;
37
function valPassword(_this){
38
	if($(_this).val().length==0){
39
		 $(_this).next().find("span").text("请设置您的登录密码");
40
		 $(_this).addClass("frmmsg-warning");
41
	}else if($(_this).val().length<6){
42
		 $(_this).next().find("span").text("密码由6-24个字符组成,区分大小写");
43
		 $(_this).addClass("frmmsg-warning");
44
	}else{
45
		$(_this).next().find("span").text("");
46
		$(_this).removeClass("frmmsg-warning");
47
		isPass1=true;
48
	}
49
}
50

51
function valPassword2(_this){
52
	var passwordval = $("#password").val();
53
	var password2 = $("#password2").val();
54
	if($(_this).val().length==0){
55
		 $(_this).next().find("span").text("请设置您的登录密码");
56
		 $(_this).addClass("frmmsg-warning");
57
	}else if($(_this).val().length<6){
58
		 $(_this).next().find("span").text("密码由6-24个字符组成,区分大小写");
59
		 $(_this).addClass("frmmsg-warning");
60
	}else if($(_this).val() != passwordval){
61
		 $(_this).next().find("span").text("两次输入不一致,请重新输入");
62
		 $(_this).addClass("frmmsg-warning");
63
	}else{
64
		isPass = true;
65
		 $(_this).next().find("span").text("");
66
		 $(_this).removeClass("frmmsg-warning");
67
	}
68
}
69
function savePassword(){
70
	if(isPass&&isPass1){
71
		$.ajax("/ajax/cp",{
72
			type:"POST",
73
			async: false,
74
			success:function(data){
75
				console.log(data)
76
				if(data.success){
77
					if(data.data == true){	
78
						$.cookie("userAuth","true");
79
						location.href = "index.html";
80
					}
81
				}
82
			},
83
			error:function(){$.MsgBox.Alert('消息', '服务器请求失败');},
84
			data:{"id":$.cookie("userid"),"npw":$("#passwordok").val() },
85
		 	dataType: 'json'
86
		});
87
	}
88

89
}

+ 2 - 1
js/loginNew.js

@ -292,12 +292,13 @@ function InvitationLogin(_this) {
292 292
			},
293 293
			async: false,
294 294
			success: function(data) {
295
				 console.log(data)
295 296
				if(data.success) {
296 297
					if(data.data != "null" && data.data != null) {
297 298
						if(data.data.auth == true) {
298 299
							location.href = "index.html";
299 300
						} else {
300
							location.href = "login-first.html";
301
							location.href = "loginInviteFirst.html";
301 302
						}
302 303
					} else {
303 304
						$(_this).parents(".cmpCoverUl").find(".msgLog2 span").text("邀请码错误,请检查后重试");

+ 0 - 58
login-first.html

@ -1,58 +0,0 @@
1
 <!DOCTYPE html>
2
<html>
3
<head>
4
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0">
5
-->
6
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
8

9
<meta http-equiv="X-UA-Compatible" content="IE=edge">
10
<title>科袖网-搭建企业与专家的桥梁</title>
11
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png" media="screen" />
12
<link rel="stylesheet" href="css/reset.css" />
13
<link type="text/css" href="css/login.css" rel="stylesheet">
14
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
15
<style type="text/css">
16
#header{ width:100%; height:50%; background:#E28D30; }
17
#footer{ width:100%; height:50%; background:#E8E8E8;}
18
</style>
19
</head>
20
<body>
21

22
<div class="coverbox">
23
		<!--首次登录!-->
24
		<div class="login-first" id="Suspensionbox">
25
				<div class="login-title">
26
				 
27
				</div>
28
				<div class="logos">
29
					<a href="index.html"><img src="images/logo.png"></a>
30
				</div>
31
				
32
				<div class="welcome">欢迎<span class="professor" id="name">XXX教授</span>登入科袖网!<br>请您设置密码,方便以后登录。</div>
33
				<div class="password-input">
34
				<form  name="f1" action="information-browse.html" method="post">
35
                    <div class="frmbox">	
36
                        <div class="password"><span class="lable">设置密码</span><input type="password" style="width:80%;" class="inputtxt psd" id="password" onBlur="valPassword()"></div>
37
                        <div class="msg msg-left msg1" ><span></span></div>
38
                        <div class="password"><span class="lable">确认密码</span><input type="password" style="width:80%;" class="inputtxt psd" id="password2" onBlur="valPassword2()"></div>
39
                        <div class="msg msg-left msg2" ><span></span></div>
40
                        <input type="button" value="保存并登录" class="inputtxt submitBtn" style="width: 95%;" onClick="savePassword()">
41
                        <div class="msg msg3" ><span></span></div>
42
                        <!-- <div class="forget">不是本人?<div class="prompt"><span class="triangleR"></span><span class="prompt-con">请拨打免费电话<br><span class="tel">400-xxx-xxxx</span><br>重新获取邀请码</span></div></div>	 -->
43
                    </div>
44
				</form>
45
				</div>    
46
		</div>
47
</div>			
48
	
49
<div id="header"></div>
50
<div id="footer"></div>
51

52
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
53
<script type="text/javascript" src="js/common.js"></script>
54
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
55
<script type="text/javascript"src="js/login-first.js"></script>
56

57
</body>
58
</html>

+ 0 - 56
login-invite-code.html

@ -1,56 +0,0 @@
1
 <!DOCTYPE html>
2
<html>
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7
<title>特邀专家登录-科袖网</title>
8
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png" media="screen" />
9
<link rel="stylesheet" href="css/reset.css" />
10
<link type="text/css" href="css/login.css" rel="stylesheet">
11
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
12
<style type="text/css">
13
#header{ width:100%; height:50%; background:#E28D30; }
14
#footer{ width:100%; height:50%; background:#E8E8E8;}
15
</style>
16
</head>
17
<body>
18

19
<div class="coverbox">
20
		<!--登录邀请码!-->
21
		<div class="loginbox loginbox-invite" id="Suspensionbox">
22
			<div class="login-title">
23
			 <a href="login.html">通过手机或邮箱登录<span class="back"></span></a>
24
			</div>
25
			<div class="logo">
26
			<a href="index.html"><img src="images/logo.png"></a>
27
			</div>
28
			<div class="login-input">
29
                <form  name="f1" action="login-first.html" method="post">	
30
                    <div class="frmbox">
31
                        <input class="inputtxt" type="text" placeholder="请输入您的手机或邮箱"  id="phone" value="" onKeyDown="restSub()"  onblur="phoneVal()" >
32
                        <div class="msg msg1" ><span></span></div>
33
                        <input class="inputtxt" type="text" placeholder="请输入您的邀请码" id="code" value="" onKeyDown="restSub()" onBlur="codeVal()" >
34
                        <div class="msg msg2" ><span></span></div>
35
                        <!--<div class="codebox">
36
                        <input type="text" placeholder="验证码" class="code">
37
                        <div class="code-pic"></div><span class="note">看不清?换一换</span></div>
38
                        <div class="msg" ><span></span></div>-->
39
                        <input type="button" value="登录" class="inputtxt submitBtn" id="login" onClick="loginSub()">
40
                        <div class="msg msg3" ><span></span></div>
41
                        <!-- <div class="forget">忘记邀请码?<div class="prompt"><span class="triangleR"></span><span class="prompt-con">请拨打免费电话<br><span class="tel">400-xxx-xxxx</span><br>重新获取邀请码</span></div></div> -->
42
                    </div>
43
                </form>	
44
			</div>
45
		</div>
46
</div>		
47
<div id="header"></div>
48
<div id="footer"></div>
49

50
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
51
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
52
<script type="text/javascript" src="js/common.js"></script>
53
<script type="text/javascript"src="js/login-invite-code.js"></script>
54

55
</body>
56
</html>

+ 7 - 11
loginInviteFirst.html

@ -20,22 +20,22 @@
20 20
	<div class="containerCon contConP">
21 21
		<div class="covFrmblock">
22 22
			<form class="cmpAllFrm">
23
				<p class="h1Font alignCenter mainColor">欢迎 <span>用户姓名</span> 登录科袖</p>
23
				<p class="h1Font alignCenter mainColor">欢迎 <span id="name"></span> 登录科袖</p>
24 24
				<p class="smallTip alignCenter" style="margin:-10px auto 20px;">请设置您的登录密码,让您的账号更安全</p>
25 25
				<div class="waysBlock">
26 26
					<div class="loginWays">
27 27
						<!--邀请码登录-->
28 28
						<ul class="cmpAllUl cmpCoverUl">
29 29
							<li>
30
								<input type="password" class="frmtype frmtypeW" placeholder="请输入设置您的登录密码"/>
30
								<input type="password" class="frmtype frmtypeW" id="password" placeholder="请输入设置您的登录密码" onBlur="valPassword(this)" onfocus="getFocus(this)" onkeyup="checkLoginButtn(this)"/>
31 31
			    				<div class="frmmsg msgLog1"><span></span></div>
32 32
							</li>
33 33
							<li>
34
								<input type="password" class="frmtype frmtypeW" placeholder="请再次输入密码确认"/>
34
								<input type="password" class="frmtype frmtypeW" id="passwordok" placeholder="请再次输入密码确认" onBlur="valPassword2(this)" onfocus="getFocus(this)" onkeyup="checkLoginButtn(this)"/>
35 35
							    <div class="frmmsg msgLog2"><span></span></div>
36 36
							</li>
37 37
							<li>
38
								<button type="button" disabled class="frmtype frmtypeW btnModel save-block headRadius">确认</button>
38
								<button type="button" disabled class="frmtype frmtypeW btnModel save-block headRadius" id="ButSubmit" onclick="savePassword()">确认</button>
39 39
							</li>
40 40
						</ul>
41 41
					</div>
@ -54,13 +54,9 @@
54 54
		</div>
55 55
	</div>
56 56
</div>
57
<script type="text/javascript"src="js/jquery.cookie.js"></script>
58
<script type="text/javascript"src="js/jquery.similar.msgbox.js"></script>
57
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
59 58
<script type="text/javascript" src="js/common.js"></script>
60
<script type="text/javascript">
61
	$(".serviceBox").hover(function(){
62
		$(".serviceTel").fadeToggle();
63
	})
64
</script>
59
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
60
<script type="text/javascript"src="js/loginInviteFirst.js"></script>
65 61
</body>
66 62
</html>