<{import file="index/reg_header.html" title="账户绑定"}>
<style type="text/css">  
.main_bar{ padding:38px 0 150px 0; } 
.main{ width:380px; }
.reg_left{ width:380px; padding:0; margin:0 0 30px 0; float:left;}
/* 顶部 */
.bname{ width:380px; float: left; }
.bname span{ width:100%; font-size:20px; text-align:center; color:#666666; padding:0 0 20px 0; float:left; }

/*第三方登录*/
.conn_box{ width:380px; margin-bottom:20px; border-radius:3px; background:#f8f8f8; border:1px solid #efefef; padding:10px 0 10px; float:left; }
.conn_box .avatar{ width:80px; height:80px; padding:2px; background:#fff; margin-left:15px; text-align:center; border:1px solid #efefef; border-radius:100px; float:left; } 
.conn_box .avatar img{ max-width:80px; border-radius:80px; }
.conn_box .lft{ width:230px; padding:0 0 0 20px; float:left; }
.conn_box .lft .nick{ width:100%; font-size:18px; padding:15px 0 8px 0; float:left; }
.conn_box .lft .remk{ width:100%; color:#999999; font-size:12px; }

</style> 
<div class="main_bar">
	<div class="main"> 
		<div class="bname"><span>绑定账号</span></div>
		<{uqcms m="user" v="conn_row" c="conn_info:alias=smarty.get.alias"}>
		<div class="connlogin">
			<div class="conn_box">
				<div class="avatar"><img src="<{$conn_row.avatar}>"></div>
				<div class="lft">
					<div class="nick"><{$conn_row.nick}></div>
					<div class="remk">当前的第三方账号已经登陆</div>	
				</div> 
			</div>
			<{if $conn_row.open_status == '1'}>
			<form method="post" action="#">
				<div class="rbox"> 
					<div class="rbox_input">
						<span>手机号</span>
						<input type="text" name="username" class="input1" id="username" placeholder="绑定的电话号码"/> 
					</div> 
					<div class="rbox_input">
						<span>验证码</span>
						<input type="text" name="vcode" id="vcode" size="10"  class="input2" maxlength="6"/> 
						<a href="javascript:;"><img id="vcode" src="index.php?m=ajax&a=vcode"/></a>  
					</div> 
					<div class="rbox_input" id="mobile_check">
						<span>短信校验码</span>
						<input type="text" name="smscode" id="smscode" class="reg_input2" size="10" /> 
						<input id="zphone" type="button" value=" 获取手机验证码 " onClick="get_mobile_code();"> 
					</div> 
					<div class="rbox_sub"><input type="submit" name="submit" class="submit_reg" value="绑定账户"/></div>	
				</div>
			</form> 
			<{else}>
				<script type="text/javascript"> 
				location.href="member.php?m=index&a=login";
				</script>
			<{/if}>
		</div>	
	</div>
</div>  
<{include file="index/footer.html"}>
<script type="text/javascript">
$(function(){ 
	$('form').submit(function(){
		var username = $('input[name=username]').val();
		if(username == ''){  $.alert('用户名不能为空'); return false; } 
		var smscode = $('input[name=smscode]').val();
		if(smscode == ''){  $.alert('手机验证码不能为空');  return false; } 
		$.ajax({
			type:'POST',
			url:'member.php?m=index&a=login_bind',
			data:{username:username, smscode:smscode, bind_type:'<{$smarty.get.alias}>'},
			success:function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){ 
					$.alert('绑定成功，正在跳转。', function(){
						window.location.href="member.php";  
					}); 
				}else{ 
					$.alert(data.msg);
					freshVcode(); 
				}
			},error:function(){
				$.alert('错误');
			}
		});
		return false; 
	});  
	// 获得验证码 
	$("#zphone").click(function(){
		var mobile = $('input[name=username]').val();  
		var vcode = $('input[name=vcode]').val(); 
		send_sms(mobile, vcode, '#zphone', '2');
	});   
});
</script>
