<?php /*a:1:{s:85:"F:\wpf\WpfApp1\WpfApp1\bin\x64\Debug\web\im\application\index\view\user\register.html";i:1594601128;}*/ ?>

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>新用户注册</title>
	<link href="/im/public/index/css/user.css" rel="stylesheet" type="text/css"/>  
	
   	<script type="text/javascript" src="/im/public/index/js/jquery-1.7.2.min.js"></script>
	
</head>

<body>
	<!--logo start-->
	<div class="logo w100 register_logo">
		<div class="logo_in in_width">
				<h1 class="logo_pic fl"><a href="<?php echo url('index/index'); ?>"><img title="YERSHOP" src="<?php echo api("logo"); ?>" width="201" height="59" />YERSHOP</a></h1>			
			<div class="home fr"><a href="<?php echo url('user/login'); ?>"  class="red">返回登录</a></div>
			
		</div>
	</div>
	<!--/logo end--> 
	<!--main start-->
	<div class="main w100 register_main"  style="background: url(<?php echo api('dl'); ?>) no-repeat center center;background-color: #9876d7;">
		<div class="main_in in_width register_main_in">
			<div class="con">
				<div class="reg_div fr">
					<ul class="reg_tab f18">
						<li class="current">用户名注册</li>
						<li>手机号注册</li>
					</ul>
					<div class="warn f14" style="display:none">
						<div >
							<span class="icon"></span>
							注册账号失败，请重新注册
						</div>						
					</div>
					<div class="tab_con">
						<div class="tab_div f14 current">							
							<div class="info">
								<form id="register_form" action="<?php echo url('register'); ?>" >             
									<dl class="yx">
										<dt></dt>
										<dd>
											<input type="text" name="username"  placeholder="请输入正确用户名" >
										</dd>
									</dl>
									<dl class="yxm email">
										<dt><div></div></dt>
										<dd>
											<input type="text" name="email" placeholder="请输入邮箱"  >
											
										</dd>
									</dl>
									<dl class="pss">
										<dt></dt>
										<dd>
											<input type="text"  name="password"  placeholder="设置密码"  >
										</dd>
									</dl>
									<dl class="qr">
										<dt></dt>
										<dd>
											<input type="text" name="repassword"  placeholder="确认密码"  >
										</dd>
									</dl>
								 </form>
								
							</div>
							<div class="agree f12" id="state">
							
							</div>
							<button id="register_btn" class="reg_btn f18" type="button">注&nbsp;&nbsp;册</button>
							
						</div>
						<div class="tab_div f14 ">							
							<div class="info">
								<form id="reg_form" action="<?php echo url('reg'); ?>">             
									<dl class="phone">
										<dt></dt>
										<dd>											
											<input type="text" name="mobile" id="phone" class="ind_cont_input ind_cont_inputioce2 ind_cont_inputboder1" placeholder="请输入手机号"  >  
										</dd>
									</dl>
									<dl class="yxm">
										<dt><div></div></dt>
										<dd>
											<div><input type="text"  name="mobile_code"id="verify" placeholder="短信验证码"  ></div>
											<a id="getCode"  onclick="sendsms(this)" class="btn_code f12 fr" type="button">发送验证码</a>
										</dd>
									</dl>
									<dl class="pss">
										<dt></dt>
										<dd>
											<input type="text"  name="password" placeholder="设置密码" >
										</dd>
									</dl>
									<dl class="qr">
										<dt></dt>
										<dd>
											<input type="text"  name="repassword"  placeholder="确认密码">
										</dd>
									</dl>
								 </form>
								
							</div>
							<div class="agree f12" id="status">
							
							</div>
							<button id="reg_btn" class="reg_btn f18" onclick="http()" type="button">注&nbsp;&nbsp;册</button>
							
						</div>
						
					</div>
				</div>
			</div>
			
		</div>
	</div>
	<!--/main end-->	
		<!--copy  start-->
	<div class="copy w100 register_copy">
		<div class="copy_in in_width">
		
			<div class="info  f12">
				<p class="list">
					<a href="<?php echo url('help/index?id=6'); ?>">关于我们</a>|
					 <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo1): $mod = ($i % 2 );++$i;?> 
					 <a href="<?php echo url('help/index?id='.$vo1['id']); ?>"><?php echo htmlentities($vo1['title']); ?></a>|
					<?php endforeach; endif; else: echo "" ;endif; ?>
					<a href="<?php echo url('help/index?id=16'); ?>">退换货政策</a>
				</p>
				<p class="p_01"><?php echo api('copyright'); ?></p>
				<div class="pic_03"></div>
			</div>
		</div>
	</div>
	<!--/copy  end-->
	
	<script type="text/javascript">
	 // 手机号验证
function checkPhone(phone) {
            var res = !!phone.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
            return res;
 }
var wait=60;
function RemainTime(obj) {
        if (wait == 0) {     
            obj.innerHTML="发送验证码";
            wait = 60; 
			$(this).removeClass('current');	
            $(obj).attr('onclick','sendSms(this);return false;');
        } else {  
			$(obj).attr('onclick','');$(obj).addClass('active');	
					 obj.innerHTML= wait +"秒" ;
					 wait--;
					 setTimeout(function() {
						RemainTime(obj)
					 },
					 1000)
		   	
        }
    }


function http(){
	
	 var self =$('#reg_form');
			var url="<?php echo url('user/reg'); ?>"
	 $.post(url, self.serialize(),function(data){
					 if(data.code){
    				     window.location.href = data.url;
    			         }
					 else{
					      $("#status").html(data.msg)
				  document.getElementById("status").style.visibility="visible";
					 }
              });
	  
	}
	function sendsms(obj) {
	   
								
		
	 var s="<?php echo htmlentities($code); ?>";
   if(checkPhone($('#phone').val())){
               $("#status").html("");
				document.getElementById("status").style.visibility="hidden";
			$.post('<?php echo U("User/sendSms"); ?>',{mobile:$('#phone').val(),send_code:s,verify:$('#verify').val()},function(data){
				  if (data.code) {
					  alert(data.msg); 
					  $("#status").html("");
				      document.getElementById("status").style.visibility="hidden";
					  RemainTime(obj);           
				  }
                  else{
					  $("#status").html(data.msg);
				      document.getElementById("status").style.visibility="visible";
					            
				  }
				 
            });
    }
    else{ 
	    $("#status").html("手机号码格式不正确"); 
		document.getElementById("status").style.visibility="visible";
      return false;
    }
}
		$(function(){
			$("#register_btn").click(function(){
    		var self =$('#register_form');
			var url="<?php echo url('user/register'); ?>"
    		$.post(url, self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.code){
    				window.location.href = data.url;
    			} else {
    			  $("#state").html(data.msg)
				  document.getElementById("state").style.visibility="visible";
    				//刷新验证码
    				//$(".reloadverify").click();
    			}
    		}
    	});	

   
function update(){	
	 var self=$("#form"); var url="<?php echo U('user/findpassword'); ?>";
	 $.post(url,self.serialize(),function(data){
  
					 if(data.code){  
					    $(".wjmm_div_02").show();
					 }
					 else{
					      openerror(data);
					 }
              });
	  
	}
		
		
			//tab
			$('.register_main .register_main_in .con .reg_div .reg_tab li').click(function(e) {
				$(this).addClass('current').siblings().removeClass('current');
				var this_index = $(this).index();
				$(this).closest('.reg_tab').siblings('.tab_con').children('.tab_div').eq(this_index).addClass('current');
				$(this).closest('.reg_tab').siblings('.tab_con').children('.tab_div').eq(this_index).siblings('.tab_div').removeClass('current');
			});
			$('.tab_div .info dl dd input').focus(function(){
				$(".tab_div .info dl").removeClass('current');
				if(!$(this).parents("dl").hasClass('current')){										
				
					$(this).parents("dl").addClass('current');		
				}
			});
			$('.login_main .login_main_in .con .login_div input').blur(function(){
				$(".login_main .login_main_in .con .login_div dl").removeClass('current');
				
			});
			//tip
			$('.register_main .register_main_in .con .reg_div .tab_con .tab_div .agree span').click(function(){
				if($(this).hasClass('current')){
					$(this).removeClass('current');					
				}else{
					$(this).addClass('current');		
				}
			});
			//input
		})
	</script>
</body>
</html>
