瀏覽代碼

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

xuchunyang 8 年之前
父節點
當前提交
2d74943fed
共有 3 個文件被更改,包括 66 次插入19 次删除
  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
		</div>
27
		</div>
28
        <form class="bdfrm" action="" name="bdemail">
28
        <form class="bdfrm" action="" name="bdemail">
29
        	<p>验证您的邮箱地址,完成邮箱账号绑定</p>
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
            <div class="msg-yz msg11"><span></span></div>
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
        </form>
35
        </form>
36
	</div>
36
	</div>
37
</div>
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
<div class="coverblock cover2">
56
<div class="coverblock cover2">
39
	<div class="floatbox" id="bindphone">
57
	<div class="floatbox" id="bindphone">
40
		<div class="float-title">
58
		<div class="float-title">

+ 1 - 0
css/index.css

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;}
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
.cover p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:20px 0;}
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
.cover2 p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:20px 0;}
203
.cover2 p{ clear:both;font-size:16px;line-height:26px; color:#818181; text-align:center; margin:20px 0;}
203
.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
.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
.act{margin-left:40px;}
205
.act{margin-left:40px;}

+ 43 - 15
js/account-set.js

42
		});
42
		});
43
		//邮箱绑定,手机绑定,点击关闭隐藏这两个部分
43
		//邮箱绑定,手机绑定,点击关闭隐藏这两个部分
44
		$(".times").click(function(){
44
		$(".times").click(function(){
45
			$(".cover").hide();	
46
			$(".cover2").hide();	
45
			$(".cover,.coverset,.cover2").hide();	
47
		});
46
		});
48
		//邮箱绑定,手机绑定,点击返回,隐藏这两个部分
47
		//邮箱绑定,手机绑定,点击返回,隐藏这两个部分
49
		$(".back-btn").click(function(){
48
		$(".back-btn").click(function(){
162
		}
161
		}
163
	}
162
	}
164
	
163
	
164
	
165
	
165
	//重新绑定邮箱
166
	//重新绑定邮箱
166
	var emailPass = false;
167
	var emailPass = false;
167
	//页面需要验证展示的位置,先用alert替代
168
	//页面需要验证展示的位置,先用alert替代
170
		//var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
171
		//var gunf=/^\w+@\w+\.((cn)|(com)|(com\.cn))$/;
171
		var gunf= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 
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
        if(gunf.test(email.trim())){
173
        if(gunf.test(email.trim())){
173
           $(".msg11 span").text("");
174
           userRegisterOk();
174
           emailPass = true;
175
           emailPass = true;
175
           emailSuccess();
176
           emailSuccess();
176
        }else{
177
        }else{
177
        	/*alert("请输入正确是邮箱地址");*/
178
        	/*alert("请输入正确是邮箱地址");*/
178
        	$(".msg11 span").text("请输入正确邮箱地址");
179
        	$(".msg11 span").text("请输入正确邮箱地址");
179
        	emailPass = false;
180
        	emailPass = false;
180
        }
181
        }
181
	}
182
	}
183
	function emailSuccess()
184
	function emailSuccess()
184
	{
185
	{
185
		var mailVal =$('#email').val();
186
		var mailVal =$('#email').val();
186
		$(".act-color").each(function() {  
187
		$(".sett").each(function() {  
187
	        var url = mailVal.split('@')[1];
188
	        var url = mailVal.split('@')[1];
188
	        for (var j in hash){  
189
	        for (var j in hash){  
189
	            $(this).attr("href", hash[url]);  
190
	            $(this).attr("href", hash[url]);  
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
	 var mailCode = GetQueryString('sc');
217
	 var mailCode = GetQueryString('sc');
195
	//获取邮箱验证码传值注册
218
	//获取邮箱验证码传值注册
196
	if(mailCode!=''){
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
	    $.ajax("/ajax/bindMail/"+mailCode,{
222
	    $.ajax("/ajax/bindMail/"+mailCode,{
200
				type:"get",
223
				type:"get",
201
				async: true,
224
				async: true,
219
					type:"GET",
242
					type:"GET",
220
					async: false,
243
					async: false,
221
					success:function(data){ 
244
					success:function(data){ 
222
						//console.log(data);
245
						console.log(data);
223
						if(data.success){
246
						if(data.success){
247
							console.log(data);
224
							if(data.data == true){
248
							if(data.data == true){
225
							//	$.MsgBox.Alert("消息提醒","请检查邮件,设置成功后请重新登录!");
226
								$.cookie('userEmail',email); 
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
							}else{
253
							}else{
230
								/*alert("邮箱设置失败");*/
231
								$.MsgBox.Alert("消息提醒","邮箱已经绑定!");
254
								$.MsgBox.Alert("消息提醒","邮箱发布失败!");
232
							}
255
							}
233
						}else{
256
						}else{
234
							$.MsgBox.Alert("消息提醒","系统异常!");
235
							// alert("系统异常!");
257
							$.MsgBox.Alert("消息提醒","服务器链接超时!");
236
						}
258
						}
237
					},
259
					},
238
					error:function(){$.MsgBox.Alert('message','fail')},
260
					error:function(){$.MsgBox.Alert('message','fail')},
243
			/*alert("请输入正确是邮箱地址");*/
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
	var phonePass = false;
275
	var phonePass = false;
248
	function valPhone(){
276
	function valPhone(){