Browse Source

账户设置:邮箱绑定功能按描述中的需求修改功能及页面。

xuchunyang 8 years ago
parent
commit
2d74943fed
3 changed files with 66 additions and 19 deletions
  1. 22 4
      account-set.html
  2. 1 0
      css/index.css
  3. 43 15
      js/account-set.js

+ 22 - 4
account-set.html

@ -27,14 +27,32 @@
27 27
		</div>
28 28
        <form class="bdfrm" action="" name="bdemail">
29 29
        	<p>验证您的邮箱地址,完成邮箱账号绑定</p>
30
            <input type="text" placeholder="请输入您的邮箱地址" class="yz" id="email" onBlur="valEmail()" >
30
            <input type="text" placeholder="请输入您的邮箱地址" class="yz" id="email" onblur="valEmail()" >
31 31
            <div class="msg-yz msg11"><span></span></div>
32
            <p>绑定邮箱验证已发送至您的邮箱<br>请您在10分钟内登录邮箱激活链接验证</p>
33
            <input type="button" value="登录邮箱激活" class=" activate act act-color" onClick="bindEmail()" >
34
            <input type="button" value="返回" class="activate back-btn" >
32
            <div style="text-align: center;">
33
            	<input type="button" value="发送验证邮件" class="activate act-color sett" onClick="bindEmail()" >
34
            </div>
35 35
        </form>
36 36
	</div>
37 37
</div>
38

39
<div class="coverblock coverset" id="vovernext">
40
	<div class="floatbox" style="width:460px;">
41
		<div class="float-title">
42
			邮箱绑定
43
			<span class="times"></span>
44
		</div>
45
        <form class="bdfrm" action="" name="bdemail">
46
        	<p>绑定邮箱验证链接已发送至</p>
47
        	<p class="emalvel"></p>
48
            <p style="font-size: 12px;">请您在10分钟内登录邮箱激活链接验证</p>
49
            <div style="text-align: center;">
50
           		 <input type="button" value="登录邮箱完成验证" class="activate act-color" style="width:160px" id="bindgo">
51
            </div>
52
        </form>
53
	</div>
54
</div>
55

38 56
<div class="coverblock cover2">
39 57
	<div class="floatbox" id="bindphone">
40 58
		<div class="float-title">

+ 1 - 0
css/index.css

@ -199,6 +199,7 @@ input[type='radio'].radio:checked + .radio {background:url(../images/redio.png)
199 199
.yz{ width:350px; height:44px; border-radius:6px; border:1px #bdbdbd solid; box-shadow:0px 0px 2px #bdbdbd inset; padding-left:20px; margin:10px;}
200 200

201 201
.cover p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:20px 0;}
202
.coverset p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:10px 0;}
202 203
.cover2 p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:20px 0;}
203 204
.activate{ width:140px; height:38px; background:#fff;font-size:16px;line-height:35px; color:#333; cursor:pointer; border:none; border-radius:6px; margin:auto; margin-top:30px;  }
204 205
.act{margin-left:40px;}

+ 43 - 15
js/account-set.js

@ -42,8 +42,7 @@ $(function(){
42 42
		});
43 43
		//邮箱绑定,手机绑定,点击关闭隐藏这两个部分
44 44
		$(".times").click(function(){
45
			$(".cover").hide();	
46
			$(".cover2").hide();	
45
			$(".cover,.coverset,.cover2").hide();	
47 46
		});
48 47
		//邮箱绑定,手机绑定,点击返回,隐藏这两个部分
49 48
		$(".back-btn").click(function(){
@ -162,6 +161,8 @@ $(function(){
162 161
		}
163 162
	}
164 163
	
164
	
165
	
165 166
	//重新绑定邮箱
166 167
	var emailPass = false;
167 168
	//页面需要验证展示的位置,先用alert替代
@ -170,12 +171,12 @@ $(function(){
170 171
		//var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
171 172
		var gunf= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 
172 173
        if(gunf.test(email.trim())){
173
           $(".msg11 span").text("");
174
           userRegisterOk();
174 175
           emailPass = true;
175 176
           emailSuccess();
176 177
        }else{
177 178
        	/*alert("请输入正确是邮箱地址");*/
178
        	$(".msg11 span").text("请输入正确邮箱地址");
179
        	$(".msg11 span").text("请输入正确邮箱地址");
179 180
        	emailPass = false;
180 181
        }
181 182
	}
@ -183,7 +184,7 @@ $(function(){
183 184
	function emailSuccess()
184 185
	{
185 186
		var mailVal =$('#email').val();
186
		$(".act-color").each(function() {  
187
		$(".sett").each(function() {  
187 188
	        var url = mailVal.split('@')[1];
188 189
	        for (var j in hash){  
189 190
	            $(this).attr("href", hash[url]);  
@ -191,11 +192,33 @@ $(function(){
191 192
	     });
192 193
	}
193 194
	
195
	//判断账号是否注册
196
	function userRegisterOk(){
197
		var email = $("#email").val();
198
		console.log(email);
199
		$.ajax("/ajax/isReg?key="+email,{
200
			type:"GET",
201
			async: false,
202
			success:function($data){ 
203
				console.log($data);
204
			    if($data.data==true){
205
			    	 $(".msg11").text("");
206
			    }else{
207
			    	 $(".msg11").text("该邮箱已绑定账号,请使用其他邮箱地址。");
208
			    }
209
			}, 
210
			error:function(){
211
				$.MsgBox.Alert('消息','服务器请求失败')},
212
			}
213
		);
214
	}	
215
	
216
	
194 217
	 var mailCode = GetQueryString('sc');
195 218
	//获取邮箱验证码传值注册
196 219
	if(mailCode!=''){
197
		$(".account-set a").eq(2).addClass("bgcolor").siblings().removeClass("bgcolor");
198
		$(".contentbox .content-set").eq(2).show().siblings().hide();
220
		$(".account-set a").eq(1).addClass("bgcolor").siblings().removeClass("bgcolor");
221
		$(".contentbox .content-set").eq(1).show().siblings().hide();
199 222
	    $.ajax("/ajax/bindMail/"+mailCode,{
200 223
				type:"get",
201 224
				async: true,
@ -219,20 +242,19 @@ $(function(){
219 242
					type:"GET",
220 243
					async: false,
221 244
					success:function(data){ 
222
						//console.log(data);
245
						console.log(data);
223 246
						if(data.success){
247
							console.log(data);
224 248
							if(data.data == true){
225
							//	$.MsgBox.Alert("消息提醒","请检查邮件,设置成功后请重新登录!");
226 249
								$.cookie('userEmail',email); 
227
								var mailVal =$('.act-color').attr("href");  
228
								location.href=mailVal;
250
								$(".cover").hide();
251
								$("#vovernext").show();
252
								$(".emalvel").text(email);
229 253
							}else{
230
								/*alert("邮箱设置失败");*/
231
								$.MsgBox.Alert("消息提醒","邮箱已经绑定!");
254
								$.MsgBox.Alert("消息提醒","邮箱发布失败!");
232 255
							}
233 256
						}else{
234
							$.MsgBox.Alert("消息提醒","系统异常!");
235
							// alert("系统异常!");
257
							$.MsgBox.Alert("消息提醒","服务器链接超时!");
236 258
						}
237 259
					},
238 260
					error:function(){$.MsgBox.Alert('message','fail')},
@ -243,6 +265,12 @@ $(function(){
243 265
			/*alert("请输入正确是邮箱地址");*/
244 266
		}
245 267
	}
268
	
269
	$("#bindgo").on("click",function(){
270
		var mailVal =$('.sett').attr("href");  
271
		location.href=mailVal;
272
	})
273
	
246 274
	//验证手机号是否合法
247 275
	var phonePass = false;
248 276
	function valPhone(){