<{import file="common.html" title="会员登陆"}>
<{if $smarty.get.alias ==''}>
<script type="text/javascript">location.href="wap.php?m=member&a=login";</script>
<{/if}>
<link rel="stylesheet" type="text/css" href="<{$__APP__}>public/css/login.css?<{$smarty.now|date_format:"%Y%m%d%H%M%S"}>"/>
<div class="cnav"><a class="back">&nbsp;</a>账号绑定<a href="javascript:;" class="thome">主页</a></div> 
<style type="text/css">
.connlogin{ width:90%; padding:15px 5% 10px; background:#FFFFFF; float:left; }
.connlogin .avatar{ width:100%; text-align:center; float:left; } 
.connlogin .avatar img{ max-width:60px; border-radius:60px; }
.connlogin .nick{ width:100%; text-align:center; font-size:14px; padding:3px 0 0 0; float:left; } 
.login_enter{ width:100%; margin-top:5px; float:left; }
.login_enter a{ width:90%; margin:0 5%; text-align:center; font-size:14px; padding:11px 0 10px; color:#fff; border-radius:3px; background:#44B549;  float:left; }

.bdwx{ width:90%; margin:0 5%; border-bottom:1px solid #eee; padding:0 0 10px 0; float:left; }
.bdwx h3{ width:100%; font-weight:bold; font-size:14px; color:#333; padding:10px 0 6px 0; float:left; }
.bdwx h4{ font-size:12px; color:#999999; float:left; }
.bdwx h4 a{ color:#005AA0; font-size:12px; } 
</style> 
<{uqcms m="user" v="conn_row" c="conn_info:alias=smarty.get.alias"}>
<div class="connlogin">
	<div class="avatar"><img src="<{$conn_row.avatar}>"></div>
	<div class="nick"><{$conn_row.nick}></div> 
</div> 
<{if $conn_row.bd_status}>
	<div class="login_enter"><a href="javascript:;">登陆账户</a></div>
	<script type="text/javascript">
	$(function(){
		//$(".login_enter a").click(function(){ 
			$.post('member.php?m=index&a=login_enter',{alias:'<{$conn_row.alias}>'},function(result){  
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					window.location.href="wap.php?m=member"; 
				}else{ 
					$.alert(data.msg);
				}
			}); 
			return false;
		//}); 
	}); 
	</script>
<{else}>
	<div class="main"> 
		<div class="bdwx">
			<h3>绑定账号</h3>
			<h4>马上绑定帐号，下次登录更便捷哦！</h4>
		</div>
		<div class="loginBox"> 
			<form method="post">
				<div id="error_msg" style="display:none;"></div>
				<div class="tbtr"><i>手机号码</i><p><input type="text" name="username" class="input_text" placeholder="请输入手机号码"/></p></div>
				<div class="tbtr">
					<i>验证码</i>
					<p><input type="text" name="vcode" class="input_vcode" placeholder="请输入验证码"/>
					<a href="javascript:;"><img id="vcode" src="index.php?m=ajax&a=vcode"></a>
				</div>
				<div class="tbtr">
					<i>手机验证码</i><p><input type="text" name="smscode" class="input_vcode" id="smscode" placeholder="手机验证码"/>
					<input id="zphone" type="button" value="获取手机验证码"></p> 
				</div>
				<div class="tbtr" style=" border-bottom:none; padding:10px 0 0 0;">
					<input type="submit" name="vcode" class="login_submit" value="绑定"/>
				</div>
			</form>
			<div class="find_pass">
				<a href="?m=member&a=login" class="l">账号登陆</a>
				<a href="?m=member&a=register" class="r">立即注册</a>
			</div> 
		</div>
	</div>
<{/if}>  
<{include file="default/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('绑定成功，正在跳转。');
					window.location.href="wap.php?m=member"; 
				}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');
	});
});
</script>
