Browse Source

登陆注册修改

xuchunyang 8 years ago
parent
commit
6ecbda81fb
6 changed files with 59 additions and 27 deletions
  1. 1 1
      app/html/login.html
  2. 4 2
      app/js/fillinfo.js
  3. 1 1
      app/js/login.js
  4. 10 0
      app/js/loginTelNew.js
  5. 13 3
      app/js/pwdFind.js
  6. 30 20
      app/js/register.js

+ 1 - 1
app/html/login.html

@ -18,7 +18,7 @@
18 18
		<div class="mui-content">
19 19
		    <form class="mui-input-group frmboxNew">
20 20
		        <div class="mui-input-row frm-input">
21
		            <input type="tel" class="mui-input-clear frmtype" placeholder="请输入账号" id="username">
21
		            <input type="tel" class="mui-input-clear frmtype" placeholder="请输入手机或邮箱" id="username">
22 22
		        </div>
23 23
		        <div class="mui-input-row frm-input">
24 24
					<input id='password' type="password" class="frmtype" placeholder="请输入密码">

+ 4 - 2
app/js/fillinfo.js

@ -15,14 +15,16 @@ mui.ready(function() {
15 15

16 16
		/*校验input字数*/
17 17
		mui('.noactiveTab').on('keyup', "#userTitle,#userDepartment,#userPosition", function() {
18
			if(this.value.length > 20){
18
			var inputval = this.value.replace(/[^\u0000-\u00ff]/g, "aa").length;
19
			if(inputval > 40){
19 20
				plus.nativeUI.toast("最多输入20个字", toastStyle);
20 21
			}
21 22
		});
22 23
		
23 24
		/*校验input字数*/
24 25
		mui('.noactiveTab').on('keyup', "#userMechanism", function() {
25
			if(this.value.length > 50){
26
			var inputval = this.value.replace(/[^\u0000-\u00ff]/g, "aa").length;
27
			if(inputval > 100){
26 28
				plus.nativeUI.toast("最多输入50个字", toastStyle);
27 29
			}
28 30
		});

+ 1 - 1
app/js/login.js

@ -89,7 +89,7 @@ mui.ready(function() {
89 89
		/*校验登录密码*/
90 90
		function passwordVal() {
91 91
			if(userPassword.value.length < 6) {
92
				plus.nativeUI.toast("密码不少于6位", toastStyle);
92
				plus.nativeUI.toast("密码由6-24个字符组成,区分大小写", toastStyle);
93 93
				return;
94 94
			} else {
95 95
				loginBut();

+ 10 - 0
app/js/loginTelNew.js

@ -40,6 +40,16 @@ mui.ready(function() {
40 40
		
41 41
		/*登录按钮*/
42 42
		login.addEventListener('tap', function() {
43
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
44
			var oNum=/^\d{4}$/;
45
			if(!hunPhone.test(username.value)) {
46
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
47
				return;
48
			}
49
			if(!oNum.test(setCode.value)) {
50
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
51
				return;
52
			}
43 53
			loginBut();
44 54
		})
45 55
		

+ 13 - 3
app/js/pwdFind.js

@ -20,6 +20,16 @@ mui.ready(function() {
20 20
		
21 21
		/*下一步按钮*/
22 22
		nextPage.addEventListener('tap', function() {
23
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
24
			var oNum=/^\d{4}$/;
25
			if(!hunPhone.test(userPhone.value)) {
26
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
27
				return;
28
			}
29
			if(!oNum.test(userCode.value)) {
30
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
31
				return;
32
			}
23 33
			codeVal();
24 34
		})
25 35
		
@ -86,7 +96,7 @@ mui.ready(function() {
86 96
				type: 'GET', //http请求类型
87 97
				//async: false,
88 98
				success: function(data) {
89
					console.log(data)
99
					console.log(JSON.stringify(data))
90 100
					if(data.success) {
91 101
						state = data.data;
92 102
						doClick();
@ -151,12 +161,12 @@ mui.ready(function() {
151 161
							return;
152 162
						}
153 163
					}else{
154
						console.log(data.msg);
164
						console.log(JSON.stringify(data));
155 165
					    if(data.msg=="验证超时"){
156 166
							plus.nativeUI.toast("验证码已过期,请重新获取", toastStyle);
157 167
							return;
158 168
						}else{
159
							plus.nativeUI.toast("请填写正确的手机号,验证码", toastStyle);
169
							plus.nativeUI.toast("手机号验证码不匹配", toastStyle);
160 170
							return;
161 171
						}
162 172
					}

+ 30 - 20
app/js/register.js

@ -40,7 +40,26 @@ mui.ready(function() {
40 40

41 41
		/*注册按钮*/
42 42
		reg.addEventListener('tap', function() {
43
			codeVal();
43
			var inputval = name.value.replace(/[^\u0000-\u00ff]/g, "aa").length;
44
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
45
			var oNum=/^\d{4}$/;
46
			if(inputval > 20) {
47
				plus.nativeUI.toast("姓名最长为10个汉字或20个英文字符", toastStyle);
48
				return;
49
			} 
50
			if(!hunPhone.test(phoneName.value)) {
51
				plus.nativeUI.toast("请输入正确的手机号码", toastStyle);
52
				return;
53
			}
54
			if(!oNum.test(setCode.value)) {
55
				plus.nativeUI.toast("验证码为4位数字", toastStyle);
56
				return;
57
			}
58
			if(setpassword.value.length < 6){
59
				plus.nativeUI.toast("密码由6-24个字符组成,区分大小写", toastStyle);
60
				return;
61
			}
62
			isReg(1);
44 63
		})
45 64
		
46 65
		/*用户协议*/
@ -54,20 +73,6 @@ mui.ready(function() {
54 73
			});
55 74
		});
56 75
		
57
		/*校验真实姓名和密码*/
58
		function valOld() {
59
			var nameval = /^\w{0,20}$/;
60
			if(nameval.test(name.value)) {
61
				plus.nativeUI.toast("姓名最长为10个汉字或20个英文字符", toastStyle);
62
				return;
63
			} else if(setpassword.value.length < 6){
64
				plus.nativeUI.toast("密码由6-24个字符组成,区分大小写", toastStyle);
65
				return;
66
			}else{
67
				completeReg();
68
			}
69
		}
70
		
71 76
		/*校验手机号*/
72 77
		function phoneVal() {
73 78
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
@ -80,7 +85,8 @@ mui.ready(function() {
80 85
		}
81 86

82 87
		/*校验用户名是否注册*/
83
		function isReg() {
88
		function isReg(arg) {
89
			var oArg=arg;
84 90
			mui.ajax(baseUrl + '/ajax/isReg?key=' + phoneName.value, {
85 91
				dataType: 'json', //数据格式类型
86 92
				type: 'GET', //http请求类型
@ -90,9 +96,13 @@ mui.ready(function() {
90 96
						plus.nativeUI.toast("该账号已存在,请直接登录", toastStyle);
91 97
						return;
92 98
					} else {
93
						phoneCode = true;
94
						if(phoneCode){
95
							sendAuthentication();
99
						if(oArg==1){	
100
							codeVal();
101
						}else{	
102
							phoneCode = true;
103
							if(phoneCode){
104
								sendAuthentication();
105
							}
96 106
						}
97 107
					}
98 108
				},
@ -164,7 +174,7 @@ mui.ready(function() {
164 174
					console.log(data.success);
165 175
					if(data.success) {
166 176
						if(data.data) {
167
							valOld();
177
							completeReg();
168 178
						}else{
169 179
							plus.nativeUI.toast("验证码错误,请检查后重试", toastStyle);
170 180
							return;