Quellcode durchsuchen

登陆注册修改

xuchunyang vor 8 Jahren
Ursprung
Commit
6ecbda81fb
6 geänderte Dateien mit 59 neuen und 27 gelöschten Zeilen
  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
		<div class="mui-content">
18
		<div class="mui-content">
19
		    <form class="mui-input-group frmboxNew">
19
		    <form class="mui-input-group frmboxNew">
20
		        <div class="mui-input-row frm-input">
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
		        </div>
22
		        </div>
23
		        <div class="mui-input-row frm-input">
23
		        <div class="mui-input-row frm-input">
24
					<input id='password' type="password" class="frmtype" placeholder="请输入密码">
24
					<input id='password' type="password" class="frmtype" placeholder="请输入密码">

+ 4 - 2
app/js/fillinfo.js

15

15

16
		/*校验input字数*/
16
		/*校验input字数*/
17
		mui('.noactiveTab').on('keyup', "#userTitle,#userDepartment,#userPosition", function() {
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
				plus.nativeUI.toast("最多输入20个字", toastStyle);
20
				plus.nativeUI.toast("最多输入20个字", toastStyle);
20
			}
21
			}
21
		});
22
		});
22
		
23
		
23
		/*校验input字数*/
24
		/*校验input字数*/
24
		mui('.noactiveTab').on('keyup', "#userMechanism", function() {
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
				plus.nativeUI.toast("最多输入50个字", toastStyle);
28
				plus.nativeUI.toast("最多输入50个字", toastStyle);
27
			}
29
			}
28
		});
30
		});

+ 1 - 1
app/js/login.js

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

+ 10 - 0
app/js/loginTelNew.js

40
		
40
		
41
		/*登录按钮*/
41
		/*登录按钮*/
42
		login.addEventListener('tap', function() {
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
			loginBut();
53
			loginBut();
44
		})
54
		})
45
		
55
		

+ 13 - 3
app/js/pwdFind.js

20
		
20
		
21
		/*下一步按钮*/
21
		/*下一步按钮*/
22
		nextPage.addEventListener('tap', function() {
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
			codeVal();
33
			codeVal();
24
		})
34
		})
25
		
35
		
86
				type: 'GET', //http请求类型
96
				type: 'GET', //http请求类型
87
				//async: false,
97
				//async: false,
88
				success: function(data) {
98
				success: function(data) {
89
					console.log(data)
99
					console.log(JSON.stringify(data))
90
					if(data.success) {
100
					if(data.success) {
91
						state = data.data;
101
						state = data.data;
92
						doClick();
102
						doClick();
151
							return;
161
							return;
152
						}
162
						}
153
					}else{
163
					}else{
154
						console.log(data.msg);
164
						console.log(JSON.stringify(data));
155
					    if(data.msg=="验证超时"){
165
					    if(data.msg=="验证超时"){
156
							plus.nativeUI.toast("验证码已过期,请重新获取", toastStyle);
166
							plus.nativeUI.toast("验证码已过期,请重新获取", toastStyle);
157
							return;
167
							return;
158
						}else{
168
						}else{
159
							plus.nativeUI.toast("请填写正确的手机号,验证码", toastStyle);
169
							plus.nativeUI.toast("手机号验证码不匹配", toastStyle);
160
							return;
170
							return;
161
						}
171
						}
162
					}
172
					}

+ 30 - 20
app/js/register.js

40

40

41
		/*注册按钮*/
41
		/*注册按钮*/
42
		reg.addEventListener('tap', function() {
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
			});
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
		function phoneVal() {
77
		function phoneVal() {
73
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
78
			var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
80
		}
85
		}
81

86

82
		/*校验用户名是否注册*/
87
		/*校验用户名是否注册*/
83
		function isReg() {
88
		function isReg(arg) {
89
			var oArg=arg;
84
			mui.ajax(baseUrl + '/ajax/isReg?key=' + phoneName.value, {
90
			mui.ajax(baseUrl + '/ajax/isReg?key=' + phoneName.value, {
85
				dataType: 'json', //数据格式类型
91
				dataType: 'json', //数据格式类型
86
				type: 'GET', //http请求类型
92
				type: 'GET', //http请求类型
90
						plus.nativeUI.toast("该账号已存在,请直接登录", toastStyle);
96
						plus.nativeUI.toast("该账号已存在,请直接登录", toastStyle);
91
						return;
97
						return;
92
					} else {
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
					console.log(data.success);
174
					console.log(data.success);
165
					if(data.success) {
175
					if(data.success) {
166
						if(data.data) {
176
						if(data.data) {
167
							valOld();
177
							completeReg();
168
						}else{
178
						}else{
169
							plus.nativeUI.toast("验证码错误,请检查后重试", toastStyle);
179
							plus.nativeUI.toast("验证码错误,请检查后重试", toastStyle);
170
							return;
180
							return;