<%@ 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>
		<form id="form" method="post">
			<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" type="text" name="mobile" id='phone'> <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" id>验证码:</label>
					</div>
					<input class="weui_input" type="text" name="code" id="code">
				</div>
				<div class="retinabt"></div>
				<a href="javascript:void(0);" class="weui_btn weui_btn_primary bc53a2" style="margin-top: 2rem;" id="submit">提交处理</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>
</body>
<script type="text/javascript" src="${contextPath}/static/js/jquery-1.12.0.min.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() {
 		$("#getValidCode").click(function(){
		  	var phone=$("#phone").val();
			if(!checkPhone(phone)){
				return;
			}
  			var b007 = {
				actionCode:"B007",
				mobile:phone,
				type:22				
  			}
	  		requestData("${contextPath}/B/android/", b007, getValidCodeSucc, fail);
  		}); 		
 		$("#submit").click(function(){
 			var phone=$("#phone").val();
			if(!checkPhone(phone)){
				return;
			}
			var code = $("#code").val();
			if(code==null||code==""){
				showMsg("请输入验证码！");
				return;
			}
  			var b008 = {
				actionCode:"B008",
				mobile:phone,
				type:22,
				code:code
  			}
	  		requestData("${contextPath}/B/android/", b008, b008Succ, fail);
 		});
   	});
 	
 	function b008Succ(data){
 		if(data){
 			if(data.success){
   				$("#form").attr("action", "${contextPath}/web/ssdb/toChangePasswd").submit();
 			}else{
 				showMsg(data.message);
 			}
 		}else{
			showMsg('网络异常！');
 		}
 	}
 	
 	/*获取验证码按钮*/
	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 fail(resp){
		console.log(resp);
	}
  </script>
</html>
