Browse Source

登录,注册,找回密码修改

xuchunyang 8 years ago
parent
commit
50fe1ca7f6
5 changed files with 41 additions and 40 deletions
  1. 9 8
      js/loginNew.js
  2. 28 28
      js/pwdFindNew.js
  3. 1 1
      js/register.js
  4. 2 2
      login.html
  5. 1 1
      pwdFindNew.html

+ 9 - 8
js/loginNew.js

4
		$(this).parents("#container").find(".frmmsg span").text("");
4
		$(this).parents("#container").find(".frmmsg span").text("");
5
		$(this).parents("#container").find("input").removeClass("frmmsg-warning");
5
		$(this).parents("#container").find("input").removeClass("frmmsg-warning");
6
		$(this).parents("#container").find(".loginSubmit").attr("disabled", true);
6
		$(this).parents("#container").find(".loginSubmit").attr("disabled", true);
7
		$("#getcode").attr("disabled", true);
8
		$(this).addClass("liactive").siblings().removeClass("liactive");
7
		$(this).addClass("liactive").siblings().removeClass("liactive");
9
		$(".loginWays ul").eq($(this).index()).removeClass("displayNone").siblings().addClass("displayNone");
8
		$(".loginWays ul").eq($(this).index()).removeClass("displayNone").siblings().addClass("displayNone");
10
	})
9
	})
13
var passwordPass = false;
12
var passwordPass = false;
14
var codePass = false;
13
var codePass = false;
15
var verification = false;
14
var verification = false;
15
var namePasstt = false;
16
/*校验登录按钮显示状态*/
16
/*校验登录按钮显示状态*/
17
function checkLoginButtn(_this) {
17
function checkLoginButtn(_this) {
18
	var username = $(_this).parents(".cmpCoverUl").find(".username").val();
18
	var username = $(_this).parents(".cmpCoverUl").find(".username").val();
55
}
55
}
56

56

57
//校验登录手机账户
57
//校验登录手机账户
58
function phoneVal(_this) {
58
function phoneVal(_this,org) {
59
	var loginName = $(_this).val();
59
	var loginName = $(_this).val();
60
	var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
60
	var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
61
	if(loginName.length == "") {
61
	if(loginName.length == "") {
62
		$(_this).next().find("span").text("请输入您的手机号码");
62
		$(_this).next().find("span").text("请输入您的手机号码");
63
		$(_this).addClass("frmmsg-warning");
63
		$(_this).addClass("frmmsg-warning");
64
	} else if(hunPhone.test(loginName.trim())) {
64
	} else if(hunPhone.test(loginName.trim())) {
65
		userRegisterOk(_this);
65
		userRegisterOk(_this,org);
66
		$(_this).next().find("span").text("");
66
		$(_this).next().find("span").text("");
67
		$(_this).removeClass("frmmsg-warning");
67
		$(_this).removeClass("frmmsg-warning");
68
		namePass = true;
68
		namePass = true;
69
	} else {
69
	} else {
70
		$(_this).next().find("span").text("请输入正确的手机号码");
70
		$(_this).next().find("span").text("请输入正确的手机号码");
71
		$(_this).addClass("frmmsg-warning");
71
		$(_this).addClass("frmmsg-warning");
72
		$("#getcode").attr("disabled", true);
73
	}
72
	}
74
}
73
}
75

74

76
//判断账号是否注册
75
//判断账号是否注册
77
function userRegisterOk(_this) {
76
function userRegisterOk(_this,org) {
78
	var loginName = $(_this).val();
77
	var loginName = $(_this).val();
79
	$.ajax("/ajax/isReg?key=" + loginName, {
78
	$.ajax("/ajax/isReg?key=" + loginName, {
80
		type: "GET",
79
		type: "GET",
86
			} else {
85
			} else {
87
				$(_this).next().find("span").text("");
86
				$(_this).next().find("span").text("");
88
				$(_this).removeClass("frmmsg-warning");
87
				$(_this).removeClass("frmmsg-warning");
89
				$("#getcode").attr("disabled", false);
88
				if(org==1){
89
					doClick("#getcode");
90
					phoneVerificationCode("#getcode");
91
				}
90
			}
92
			}
91
		},
93
		},
92
		error: function() {
94
		error: function() {
130

132

131
//手机发送验证码
133
//手机发送验证码
132
function phoneSend(_this) {
134
function phoneSend(_this) {
133
	doClick(_this);
134
	phoneVerificationCode(_this);
135
	phoneVal(".phoneuser",1)
135
}
136
}
136

137

137
function doClick(_this) {
138
function doClick(_this) {

+ 28 - 28
js/pwdFindNew.js

11
		$(this).parents("#container").find(".frmmsg span").text("");
11
		$(this).parents("#container").find(".frmmsg span").text("");
12
		$(this).parents("#container").find("input").removeClass("frmmsg-warning");
12
		$(this).parents("#container").find("input").removeClass("frmmsg-warning");
13
		$(this).parents("#container").find(".loginSubmit").attr("disabled", true);
13
		$(this).parents("#container").find(".loginSubmit").attr("disabled", true);
14
		$("#getcode").attr("disabled", true);
15
		$(this).addClass("liactive").siblings().removeClass("liactive");
14
		$(this).addClass("liactive").siblings().removeClass("liactive");
16
		$(".loginWays .waysThis").eq($(this).index()).removeClass("displayNone").siblings().addClass("displayNone");
15
		$(".loginWays .waysThis").eq($(this).index()).removeClass("displayNone").siblings().addClass("displayNone");
17
	})
16
	})
50
}
49
}
51

50

52
//校验邮箱账户
51
//校验邮箱账户
53
function emailVal(_this) {
52
function emailVal(_this,org) {
54
	var loginName = $(_this).val();
53
	var loginName = $(_this).val();
55
	var gunf = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
54
	var gunf = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
56
	if(loginName.length == "") {
55
	if(loginName.length == "") {
57
		$(_this).next().find("span").text("请输入您的邮箱地址");
56
		$(_this).next().find("span").text("请输入您的邮箱地址");
58
		$(_this).addClass("frmmsg-warning");
57
		$(_this).addClass("frmmsg-warning");
59
	} else if(gunf.test(loginName.trim())) {
58
	} else if(gunf.test(loginName.trim())) {
60
		userRegisterOk(_this);
59
		userRegisterOk(_this,org);
61
		$(_this).next().find("span").text("");
60
		$(_this).next().find("span").text("");
62
		$(_this).removeClass("frmmsg-warning");
61
		$(_this).removeClass("frmmsg-warning");
63
		isEmail = true;
62
		isEmail = true;
68
}
67
}
69

68

70
//校验登录手机账户
69
//校验登录手机账户
71
function phoneVal(_this) {
70
function phoneVal(_this,org) {
72
	var loginName = $(_this).val();
71
	var loginName = $(_this).val();
73
	var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
72
	var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
74
	if(loginName.length == "") {
73
	if(loginName.length == "") {
75
		$(_this).next().find("span").text("请输入您的手机号码");
74
		$(_this).next().find("span").text("请输入您的手机号码");
76
		$(_this).addClass("frmmsg-warning");
75
		$(_this).addClass("frmmsg-warning");
77
	} else if(hunPhone.test(loginName.trim())) {
76
	} else if(hunPhone.test(loginName.trim())) {
78
		userRegisterOk(_this);
77
		userRegisterOk(_this,org);
79
		$(_this).next().find("span").text("");
78
		$(_this).next().find("span").text("");
80
		$(_this).removeClass("frmmsg-warning");
79
		$(_this).removeClass("frmmsg-warning");
81
		namePass = true;
80
		namePass = true;
82
	} else {
81
	} else {
83
		$(_this).next().find("span").text("请输入正确的手机号码");
82
		$(_this).next().find("span").text("请输入正确的手机号码");
84
		$(_this).addClass("frmmsg-warning");
83
		$(_this).addClass("frmmsg-warning");
85
		$("#getcode").attr("disabled", true);
86
	}
84
	}
87
}
85
}
88

86

89
//判断账号是否注册
87
//判断账号是否注册
90
function userRegisterOk(_this) {
88
function userRegisterOk(_this,org) {
91
	var loginName = $(_this).val();
89
	var loginName = $(_this).val();
92
	$.ajax("/ajax/isReg?key=" + loginName, {
90
	$.ajax("/ajax/isReg?key=" + loginName, {
93
		type: "GET",
91
		type: "GET",
99
			} else {
97
			} else {
100
				$(_this).next().find("span").text("");
98
				$(_this).next().find("span").text("");
101
				$(_this).removeClass("frmmsg-warning");
99
				$(_this).removeClass("frmmsg-warning");
102
				$("#getcode").attr("disabled", false);
100
				if(org==1){
101
					doClick("#getcode");
102
					phoneVerificationCode("#getcode");
103
				}
104
				if(org==2){
105
					findBack();
106
				}
103
			}
107
			}
104
		},
108
		},
105
		error: function() {
109
		error: function() {
147

151

148
//手机发送验证码
152
//手机发送验证码
149
function phoneSend(_this) {
153
function phoneSend(_this) {
150
	doClick(_this);
151
	phoneVerificationCode(_this);
154
	phoneVal(".username",1)
152
}
155
}
153

156

154
function doClick(_this) {
157
function doClick(_this) {
296

299

297
//邮箱发送
300
//邮箱发送
298
function findBack(){
301
function findBack(){
299
	if(isEmail){
300
		$.ajax("/ajax/reqRpWithEmail",{
301
			type:"GET",
302
			async: false,
303
			success:function(data){  
304
				if(data.success){
305
					$(".emailOne").addClass("displayNone");
306
					$(".emailTow").removeClass("displayNone");
307
					$("#emailShow").text($("#email").val());
308
				}
309
			},
310
			error:function(){$.MsgBox.Alert('消息', '服务器请求失败')},
311
			data:{"mail":$("#email").val()},
312
			dataType: 'json'
313
		});
314
	}
302
	$.ajax("/ajax/reqRpWithEmail",{
303
		type:"GET",
304
		async: false,
305
		success:function(data){  
306
			if(data.success){
307
				$(".emailOne").addClass("displayNone");
308
				$(".emailTow").removeClass("displayNone");
309
				$("#emailShow").text($("#email").val());
310
			}
311
		},
312
		error:function(){$.MsgBox.Alert('消息', '服务器请求失败')},
313
		data:{"mail":$("#email").val()},
314
		dataType: 'json'
315
	});
315
}
316
}
316

317

317
function findphone(_this){
318
function findphone(_this){
329
						}
330
						}
330
					}else{
331
					}else{
331
						$(_this).parents(".cmpCoverUl").find(".msgCmp4 span").text("验证超时");
332
						$(_this).parents(".cmpCoverUl").find(".msgCmp4 span").text("验证超时");
332
						al
333
					}
333
					}
334
				},
334
				},
335
				error:function(){$.MsgBox.Alert('消息', '服务器请求失败')},
335
				error:function(){$.MsgBox.Alert('消息', '服务器请求失败')},
342
//提交登录
342
//提交登录
343
function backPassword(_this, num) {
343
function backPassword(_this, num) {
344
	if(num == 1) {
344
	if(num == 1) {
345
		findBack()
345
		emailVal("#email",2)
346
	} else if(num == 2) {
346
	} else if(num == 2) {
347
		var url = $("#emailShow").text().split('@')[1];
347
		var url = $("#emailShow").text().split('@')[1];
348
        for (var j in hash){  
348
        for (var j in hash){  

+ 1 - 1
js/register.js

323
	function oEmail(){
323
	function oEmail(){
324
		var email = $("#mailAddress").val();
324
		var email = $("#mailAddress").val();
325
		
325
		
326
		var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
326
		var gunf = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
327
		if(email.length==0) {
327
		if(email.length==0) {
328
			$(".msgLog1").find("span").text("请输入您的邮箱地址");
328
			$(".msgLog1").find("span").text("请输入您的邮箱地址");
329
			$("#mailAddress").addClass("frmmsg-warning");
329
			$("#mailAddress").addClass("frmmsg-warning");

+ 2 - 2
login.html

46
						<!--短信登录-->
46
						<!--短信登录-->
47
						<ul class="cmpAllUl cmpCoverUl displayNone">
47
						<ul class="cmpAllUl cmpCoverUl displayNone">
48
							<li>
48
							<li>
49
								<input type="phone" class="frmtype frmtypeW username" placeholder="请输入手机号码" onBlur="phoneVal(this)" onfocus="getFocus(this)" onkeyup="checkLoginButtn(this)" />
49
								<input type="phone" class="frmtype frmtypeW username phoneuser" placeholder="请输入手机号码" onBlur="phoneVal(this)" onfocus="getFocus(this)" onkeyup="checkLoginButtn(this)" />
50
			    				<div class="frmmsg msgLog1"><span></span></div>
50
			    				<div class="frmmsg msgLog1"><span></span></div>
51
							</li>
51
							</li>
52
							<li>
52
							<li>
55
								    <div class="frmmsg msgCmp03"><span></span></div>
55
								    <div class="frmmsg msgCmp03"><span></span></div>
56
							    </div>
56
							    </div>
57
							    <div class="col-w-4">
57
							    <div class="col-w-4">
58
							    	<button type="button" disabled class="frmtype frmtypeW btnModel" id="getcode" disabled  onclick="phoneSend(this)">获取验证码</button>
58
							    	<button type="button"  class="frmtype frmtypeW btnModel" id="getcode"   onclick="phoneSend(this)">获取验证码</button>
59
							    </div>
59
							    </div>
60
							</li>
60
							</li>
61
							<li>
61
							<li>

+ 1 - 1
pwdFindNew.html

118
									    <div class="frmmsg msgCmp03"><span></span></div>
118
									    <div class="frmmsg msgCmp03"><span></span></div>
119
								    </div>
119
								    </div>
120
								    <div class="col-w-4">
120
								    <div class="col-w-4">
121
								    	<button type="button" disabled class="frmtype frmtypeW btnModel headRadius" id="getcode" onclick="phoneSend(this)">获取验证码</button>
121
								    	<button type="button"  class="frmtype frmtypeW btnModel headRadius" id="getcode" onclick="phoneSend(this)">获取验证码</button>
122
								    </div>
122
								    </div>
123
								</li>
123
								</li>
124
								<li>
124
								<li>