<%@ page language="java" pageEncoding="utf-8"%>
<%@ page language="java" import="com.fadu.web.util.Constant" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% 
	String token = (String)session.getAttribute(Constant.Session.TOKEN) ;
	String openid = (String)session.getAttribute(Constant.Session.DWLSD_OPENID);
	String preUrl = (String)session.getAttribute(Constant.Request.PREURL);
%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="wap-font-scale" content="no">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
    <title>多问</title>
    <script type="text/javascript" src="${contextPath}/static/js/flexible.min.js"></script>    
    <link rel="stylesheet" type="text/css" href="${contextPath}/static/weixin/sb/css/sprite.css">
    <link rel="stylesheet" type="text/css" href="${contextPath}/static/weixin/sb/css/common.css">
    <link rel="stylesheet" type="text/css" href="${contextPath}/static/weixin/sb/css/main.css">
</head>
</head>
<body class="bg-white">
	<div class="page">
		<header class="pad-lr-30 ub ub-ac text-center form-header">
			<p class="width100 fc-blue fs-16">设置新密码</p>
			<a href="javascript:history.back(-1);" class="form-back">
				<span class="icon icon-back-blue"></span>
			</a>
		</header>
		<div class="password-center">
			<form class="pad-l-30 login-form">
				<div class="pad-t-25 pad-b-15 pad-r-30 pos-relate br-bottom1 ub ub-ac">
					<label class="fc-dgrey">新密码：</label>
					<input type="password" name="password1" id='newPsd' class="pad-lr-10 ub-f1 form-control">
				</div>
				<div class="pad-t-25 pad-b-15 pad-r-30 pos-relate br-bottom1 ub ub-ac">
					<label class="fc-dgrey">再次输入：</label>
					<input type="password" name="password2" id='newPsdAgin' class="pad-lr-10 ub-f1 form-control">
				</div>
			</form>
			<a href="#" class="mar-lr-30 mar-t-50 btn-blue block fs-20 btn-set-password">确定</a>
		</div>
	</div>

  	<script type="text/javascript" src="${contextPath}/static/js/jquery-1.12.0.min.js"></script>
  	<script type="text/javascript" src="${contextPath}/static/weixin/common/js/toast.js"></script>
  	<script type="text/javascript" src="${contextPath}/static/weixin/sb/js/main.js"></script>
	<script type="text/javascript" src="${contextPath}/static/weixin/cd/js/util.js"></script>
   	<script type="text/javascript">
   	$(function(){
   		//验证码
   		var code="${code}";
   		var mobile="${mobile}";
   		var abasePath="${contextPath}";
   		var bURL=abasePath+"/B/android";
   		//下一步
   		$(".btn-set-password").click(function(){
   			var newPsd=$("#newPsd").val();
   			var newPsdAgin=$("#newPsdAgin").val();
   			var newPsdAgin_tips=$("#newPsdAgin").attr('data-tips');
   			if(newPsd){
   				if(newPsd!==newPsdAgin){
   					toast1.alert("两次密码不一致!");
   					return;
   				}else{
   					if(newPsd.length<6){
   						toast1.alert("密码长度不能小于6位!");
   						return;
   					}
   				}
   			}else{
   				toast1.alert("请输入密码!");
   				return;
   			}   			
   			//验证手机号
	   		var b003={
	   			actionCode:'B003',
		    	mobile:mobile,
		    	newPsd:newPsd,
		    	code:code
   			};
	   	   	postData(bURL, JSON.stringify(b003), b003Succ, findPasswodFail);
   		});
   	});
    function b003Succ(e){
    	if(e.success==true){
    		toast1.alert(e.message);
    		setTimeout(function(){
        		window.location.href="${contextPath}/wx/toLogin";
	        },2000);
    	}else{
    		toast1.alert(e.message);
    	}
    };
    function findPasswodFail(e){
    	console.log(e);
    	toast1.alert("加载失败,稍后重试!");
    }	//toast
	var toast1 = new toast({
        pos:'center'
    });	
   	</script>
</body>
</html>