<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
<title>注册</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="${contextPath}/static/weixin/ssdb/css/weui.min.css">
<link rel="stylesheet" href="${contextPath}/static/weixin/ssdb/css/jquery-weui.css">
<link rel="stylesheet" href="${contextPath}/static/weixin/ssdb/css/ssdb.css">
<link rel="stylesheet" href="${contextPath}/static/weixin/ssdb/css/common.css">
 	</head>
	 	<body>
	 	  	<!--顶角按钮-->
  	<section>
  		<img  id="toSearchID" style="top: 1rem;margin-left: 1rem;width: 2%;height: 2%;position: relative;" src="${contextPath}/static/weixin/ssdb/images/user_login_close.png" />
  	</section>
<%-- 	  		<!--顶角按钮-->
	  		<section>
	  			<img class="" style="top: 1.3rem;margin-left: 1.3rem;width: 2%;height: 2.5%;position: relative;display: " src="${contextPath}/static/weixin/ssdb/images/user_login_close.png" />
	  			<span class=" color53a2 fs-16" style="top:1rem;right: 1rem;position: relative;" id="toLogin">登录</span>
	  		</section>
 --%>	  		<section>
	  			<form>
	  				<div style="margin-left: 1rem;margin-right: 1rem;margin-top: 4rem;">
			  			<div class="weui_cell">
			        		<div class="weui_cell_hd"><label class="weui_label">手机号:</label></div>
			        		<input class="weui_input" id="phone" type="text" >
			        		<span class="color53a2 display-block position-fixd"  style="height: 1rem;width: 4rem;right: 0.1rem;" id="getValidCode">获取验证码</span>
				      		<span class="color53a2 display-block position-fixd hide"  style="height: 1rem;width: 4rem;right: 0.1rem;" id="djs">重获(60秒)</span>
				      		
				      	</div>
				    <div class="retinabt"></div>
				   	<div class="weui_cell">
				        <div class="weui_cell_hd"><label class="weui_label">验证码:</label></div>
				        <input class="weui_input" id="verCode" type="text">
				    </div>
				    <div class="retinabt"></div>
				    <div class="weui_cell">
				        <div class="weui_cell_hd"><label class="weui_label">密码:</label></div>
				        <input class="weui_input" id="passwd" type="password">
				    </div>
				    <div class="retinabt"></div>
				    <div class="weui_cell">
				        <div class="weui_cell_hd"><label for="name" class="weui_label">身份</label></div>
				        <div class="weui_cell_bd weui_cell_primary">
				          	<input class="weui_input online-letter-step" attr-val="" id=""  type="text" value=""  readonly="readonly" >
				          	<span class="icon icon-list-dropdown"></span>
				        </div>
				    </div>
				    <div class="retinabt"></div>
				    <div class="weui_cell">
				        <div class="weui_cell_hd"><label class="weui_label">姓名:</label></div>
				        <input class="weui_input" id="realName" type="text">
				    </div>
				    <div class="retinabt"></div>
				    <div class="weui_cell">
				        <div class="weui_cell_hd"><label class="weui_label">律所:</label></div>
				        <input class="weui_input" id="office" type="text">
				    </div>
				    <div class="retinabt"></div>
				        <div class="weui_cell">
				        <div class="weui_cell_hd"><label class="weui_label">职业证号:</label></div>
				        <input class="weui_input" id="certNum" type="text">
				    </div>
				    <div class="retinabt"></div>
				    <!--记住密码-->
				    <div class="weui_cell">
				        <div class="weui_cell_hd"><img src="${contextPath}/static/weixin/ssdb/images/passwd_checked.png" style="width: 45%;height: 60%;"/></div>
				        <span class="color9b9b">已阅读并同意<a href="#" class="fc-blue">《协议与帮助》</a></span>
				    </div>
				 	<a href="javascript:;" id="registID" class="weui_btn weui_btn_primary bc53a2" style="margin-top: 2rem;">注册</a>
				</div>
	  		</form>
	  	</section>
	  	<!--通知-->
	  	<section>
	  		<div class="color9b9b position-fixd" style="bottom: 5px;margin-left: 2rem;margin-right: 2rem;">
				<p>提示:无法注册请致电多问客服 <span><a href="tel:020-29030607" >020-29030607</a></span></p>
	  		</div>
	  	</section>
	  	<div class="modal-layout1 hide" data-target="online-letter-step">
		<div class="pad-lr-20 modal-wrapper1">
			<div class="pad-tb-15 fs-12 fc-lgrey modal-header1">
			选择律师身份
			</div>
			<div class="fs-14 modal-content">
				<ul class="modal-radio-list">
					<li class="pad-lr-30 fs-16" attr-val="0">正式律师</li>
					<li class="pad-lr-30 fs-16" attr-val="1">实习律师</li>
				</ul>
			</div>
		</div>
	</div>
  	</body>
  	<script type="text/javascript" src="${contextPath}/static/js/jquery-1.12.0.min.js"></script>
   	<script type="text/javascript" src="${contextPath}/static/js/layer/layer.js"></script>
   	<script type="text/javascript" src="${contextPath}/static/js/requestutil.js"></script>
   	<script type="text/javascript" src="${contextPath}/static/js/ssdbUtil.js"></script>
   	<script type="text/javascript" src="${contextPath}/static/weixin/cd/js/util.js"></script>
   	
  	<script type="text/javascript">
	 	$(document).ready(function() {
	 		// 选择诉讼阶段
			$('.online-letter-step').click(function(event) {
				var $layout = $('.modal-layout1[data-target=online-letter-step]'); 
				var $item = $layout.find('.modal-radio-list li');
				$layout.removeClass('hide').find('.modal-wrapper1').addClass('animated');
				$item.on('click',function(){
					var _this = $(this);
					var txt = _this.text();
					var val_Type=_this.attr("attr-val");
					$layout.addClass('hide');
					$layout.find('.modal-wrapper1').removeClass('animated');
					$('.online-letter-step').val(txt);
					$('.online-letter-step').attr("attr-val",val_Type);
					$item.off('click');
				});
			});
			$('.modal-layout1').click(function(event) {
				var _this = $(this);
				_this.addClass('hide');
				_this.find('.modal-wrapper1').removeClass('animated')
				_this.find('.guarantee-modal-list').slideToggle('600');
			});
	 	
	  		$("#registID").click(function(){
			  	var phone=$("#phone").val();
			  	var verCode=$("#verCode").val();
			  	var certNum=$("#certNum").val();
			  	var realName=$("#realName").val();
			  	var passwd=$("#passwd").val();
			  	var office=$("#office").val();
			  	var lawyerType=$('.online-letter-step').attr("attr-val");
			  	if(!lawyerType){
					showMsg('请选择身份!');
					return;
				}
				if(!checkPhone(phone)){
					return;
				}
				if(!verCode){
					showMsg('验证码不能为空!');
					return;
				}
				if(!passwd){
					showMsg('密码不能为空!');
					return;
				}
				if(!realName){
					showMsg('姓名不能为空!');
					return;
				}
				if(!office){
					showMsg('律所不能为空!');
					return;
				}
				if(!certNum){
					showMsg('执业证号不能为空!');
					return;
				}
				
				var jsonReq={
			  		mobile:phone,
			  		password:passwd,
			  		code:verCode,
			  		lawyerType : lawyerType,
			  		office : office,
			  		certNum : certNum,
			  		realName : realName,
			  		actionCode:"B002"
				};
		  		var url="${contextPath}/B/android/";
		  		requestData(url,jsonReq,success,fail);
	  		});
	  		
	  		$("#toLogin").click(function(){
				window.location.href="${contextPath}/web/ssdb/toLogin";
	  		});
	  		$("#getValidCode").click(function(){
			  	var phone=$("#phone").val();
				if(!checkPhone(phone)){
					return;
				}
	  			var b007 = {
					actionCode:"B007",
					mobile:phone,
					type:21				
	  			}
		  		requestData("${contextPath}/B/android/", b007, getValidCodeSucc, fail);
	  		});
	   	});
	 	
		/*获取验证码按钮*/
		function codeTimer(obj,str){
			var time = obj.text().slice(3,-2);
			time = parseInt(time);
			time-=1;
			if(time<10){
				time = "0" + time;
			}
			obj.text("重获("+time+"秒)");
			if(time == 0){
 				$("#getValidCode").removeClass("hide").show();
	  			$("#djs").addClass('hide').html("重获("+60+"秒)");
				return;
			}
			setTimeout(function(){
				codeTimer(obj,obj.text());
			},1000);
		}
	 	
	 	function getValidCodeSucc(data){
	 		if(data){
	 			if(data.success){
	 				$("#djs").removeClass('hide').show();
	 				$("#getValidCode").addClass('hide');
	 				codeTimer($("#djs"));
	 				showMsg('验证码发送成功！');
	 			}else{
	 				showMsg(data.message);
	 			}			
	 		}else{
 				showMsg('网络异常！');
	 		}
	 	}
	 	
	 	function success(json){
			console.log(json);
			if(json){
				if(json.success){
	 				showMsg('注册成功!');		
	 				window.location.href="${contextPath}/web/ssdb/toLogin";
				}else{
	 				showMsg(json.message);	
				}
			}else{
 				showMsg('网络异常！');
			}
		}
		function fail(resp){
			console.log(resp);
		}
	</script>
</html>
