jack 7 years ago
parent
commit
f813e233b9
2 changed files with 36 additions and 15 deletions
  1. 6 0
      ekexiu/Invitation.html
  2. 30 15
      js/invite-friends.js

+ 6 - 0
ekexiu/Invitation.html

@ -10,6 +10,7 @@
10 10
<link rel="stylesheet" href="../css/share.css">
11 11
<style type="text/css">
12 12
	html,body{min-height: auto;background: url(../images/wechat_bg_img_nor@3x.png) no-repeat;background-size:cover;background-attachment: fixed;}
13
		.inviteImgCode{height: 42px;position: absolute;top: 0px; right: 0px;border-radius: 6px;width:128px;}
13 14
</style>
14 15
</head>
15 16
<body class="invitebody">
@ -32,6 +33,11 @@
32 33
			    </div>
33 34
				<div class="input-group">
34 35
			    	<input type="tel" class="form-control input_phone" placeholder="请输入您的手机号码" id="userphone" autocomplete="off">
36
			    </div>
37
			     <div class="input-group">
38
			      <input class="form-control input_code" type="text" placeholder="请输入图形验证码" id="imgCode" autocomplete="off">
39
			      <img src="/ajax/PictureVC" alt="" class="inviteImgCode" id="changImage">
40
			      <!--<button type="button" class="btn input-group-addon canPoint" id="obtain-code">获取验证码</button>-->
35 41
			    </div>
36 42
			    <div class="input-group">
37 43
			      <input class="form-control input_code" type="number" placeholder="请输入验证码" id="code" autocomplete="off">

+ 30 - 15
js/invite-friends.js

@ -21,9 +21,11 @@ $(function(){
21 21
			$(".bomb-box").fadeOut("slow");
22 22
		},4000);
23 23
	}
24
	
24
	$("#changImage").on("click",function(){
25
		$(this).attr("src","/ajax/PictureVC?"+new Date().getTime());
26
	})
25 27
	/*校验提交按钮显示状态*/
26
	$('.form-group').on('keyup', "#userphone,#code,#password,#username", function() {
28
	$('.form-group').on('keyup', "#userphone,#code,#password,#username,#imgCode", function() {
27 29
		if($("#userphone").val() == "" || $("#code").val() == "" || $("#password").val() == "" || $("#username").val() == "") {
28 30
			$("#regbtn").attr("disabled",true);
29 31
		} else {
@ -38,7 +40,17 @@ $(function(){
38 40
			bombox("请输入您的真实姓名");
39 41
			return;
40 42
		}
41
		codeVal();
43
		var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
44
		if(!hunPhone.test($("#userphone").val())) {
45
			bombox("请输入正确的手机号码");
46
			return;
47
		} 
48
		if($("#code").val().length==4) {
49
			ifCode=true;
50
		}else{
51
			bombox("短信验证码4位");
52
		}
53
		passwordVal();
42 54
		if(ifpassword && ifCode){
43 55
			completeReg();
44 56
		}
@ -88,8 +100,9 @@ $(function(){
88 100
	/*手机发送验证码*/
89 101
	function sendAuthentication() {
90 102
		$.ajax({
91
			url:"/ajax/regmobilephone_onlyphone",
103
			url:"/ajax/regmobilephone",
92 104
			data: {
105
				vcode:$("#imgCode").val(), 
93 106
				mobilePhone: $("#userphone").val()
94 107
			},
95 108
			dataType: 'json', //数据格式类型
@ -101,6 +114,9 @@ $(function(){
101 114
				if(data.success) {
102 115
					state = data.data;
103 116
					doClick();
117
				}else{
118
					bombox("验证码不正确");
119
					$("#changImage").attr("src","/ajax/PictureVC?"+new Date().getTime());
104 120
				}
105 121
			},
106 122
			error: function() {
@ -113,11 +129,11 @@ $(function(){
113 129
	/*30s后重新获取验证码*/
114 130
	function doClick() {
115 131
		$("#obtain-code").attr("disabled",true);
116
		$("#obtain-code").text("30s后重新获取");
132
		$("#obtain-code").text("60s后重新获取");
117 133
		var clickTime = new Date().getTime();
118 134
		var Timer = setInterval(function() {
119 135
			var nowTime = new Date().getTime();
120
			var second = Math.ceil(30 - (nowTime - clickTime) / 1000);
136
			var second = Math.ceil(60 - (nowTime - clickTime) / 1000);
121 137
			if(second > 0) {
122 138
				$("#obtain-code").text(second + "s后重新获取");
123 139
			} else {
@ -145,7 +161,8 @@ $(function(){
145 161
				//console.log(data.success);
146 162
				if(data.success) {
147 163
					if(data.data==false) {
148
						bombox("验证码不正确");
164
						bombox("验证码不正确");		
165
					
149 166
						return;
150 167
					}else{
151 168
						passwordVal();
@ -153,14 +170,10 @@ $(function(){
153 170
						return;
154 171
					}
155 172
				}else{
156
					//console.log(data.msg);
157
					if(data.msg=="验证超时"){
158
						bombox("验证码超时");
159
						return;
160
					}else{
161
						bombox("请填写正确的手机号,验证码");
162
						return;
163
					}
173
					
174
					
175
						bombox("验证码错误");
176
					
164 177
					
165 178
				}
166 179
			},
@ -203,6 +216,8 @@ $(function(){
203 216
					bombox("注册成功");
204 217
					$(".formblock").hide();
205 218
					$(".inviteSucceed").show();
219
				}else{
220
					bombox("验证码错误");
206 221
				}
207 222
			},
208 223
			error: function() {