<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="getpass.aspx.cs" Inherits="TW.UI.getpass" %>


<!DOCTYPE html>
<html>
<head lang="en">
	
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv=X-UA-Compatible content=IE=EmulateIE9 />
<script type="text/javascript" src="/static/card/js/configweb.js"></script>
	<title>找回密码_<%=config.SiteName %></title>
	<link rel="stylesheet" href="/static/card/css/public.css" />
    <link rel="stylesheet" href="/static/card/css/login.css" />
    <script type="text/javascript" src="/static/card/js/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="/static/card/js/tools.js"></script>
</head>

<body>
<form id="form1" runat=server>
<TW:HeaderSP ID="HeaderSP1" runat="server" />

<style type="text/css">
	.input-code{
		width: 150px !important;
	}
	.get-code{
		display: inline-block;
		_display:inline;
		zoom:1;
		margin-left: 13px;
		width: 160px;
		height: 40px;
		line-height: 40px;
		text-align: center;
	    color: #404040 !important;
	    background-color: #f7f7f7;
	    border: 1px solid #d0d0d0;
	    text-decoration: none !important;
	}
	.btn-disabled {
	    background-color: #ededed;
	    border-color: #ededed;
	    color: #999;
	    cursor: default;	    
	}
	.register-form .tips{
		height: 20px !important;
	}
</style>
<div class="content">
    <div class="container">
    
        <asp:Panel ID="plGetPass" CssClass="register-box clearfix" runat="server">
            <h3 class="title" id="title">找回密码</h3>
           <ul class="register-form pull-right">
                <li>
                    <i class="icon icon-right-circle pull-left"></i>
                    <label>用户名</label>
                    <div class="inp pull-left">
						<input type="text" class="input-text" id="userName" name="userName"/>
					</div>
                    <div class="tip-icon pull-left"></div>
                </li>
                <li class="tips"></li>
                <li>
                    <i class="icon icon-right-circle pull-left"></i>
                    <label>手机号码</label>
                    <div class="inp pull-left">
                    	<input type="text" id="tel" name="tel" class="input-text" />
                    </div>
                    <div class="tip-icon pull-left"></div>
                </li>
                  <li class="tips"></li>
	              <li>
	                <i class="icon icon-right-circle pull-left"></i>
	                <label>验证码</label>
	                <div class="inp pull-left">
	                	<input type="text" id="vcode" name="vcode" class="input-text input-code" />
	                	<input type="hidden" id="md16" name="md16"/>
	                	<a href="javascript:void(0);" class="get-code " title="点击获取验证码">获取手机验证码</a>
	                </div>
	                <div class="tip-icon pull-left"></div>
	            </li>
	              <li class="tips"></li>
                <li>
                    <asp:Button ID="btnNext" runat="server" Text="下一步" 
                        CssClass="default-btn register-btn" style="margin-left: 150px;" 
                        onclick="btnNext_Click"/>
                </li>
                  <li class="tips"></li>
            </ul> 
        </asp:Panel>

        <asp:Panel ID="plResetPass" CssClass="register-box clearfix" runat="server" 
            Visible="False">
            <h3 class="title" id="H1">重置密码</h3>
           <ul class="register-form pull-right">
            <li> <i class="icon icon-right-circle pull-left"></i> <label>新密码</label> <div class="inp pull-left"> <input type="password" class="input-text" id="newPassword" name="newPassword"> </div> <div class="tip-icon pull-left"></div> </li> 
            <li class="tips"></li> <li> <i class="icon icon-right-circle pull-left"></i> <label>确认密码</label> <div class="inp pull-left"> <input type="password" id="reNewPassword" name="reNewPassword" class="input-text"> </div> <div class="tip-icon pull-left"></div> </li> 
            <li> 
                <asp:Button ID="btnResetPass" runat="server" CssClass="default-btn register-btn" Text="确定修改" onclick="btnResetPass_Click" style="margin-left: 150px;"/>
            </li> 
            <li class="tips"></li>
           </ul> 
        </asp:Panel>

    </div>
</div>
<script type="text/javascript">
    $(function () {
        var send = true, tipIconDom = $(".tip-icon"), getCodeDom = $(".get-code");
        function patternCheck(checkValue, checkType) {
            var regExp = [/^(0|86|17951)?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/, /^\S{6,20}$/, /\S{1}/];
            var errMsg = ["手机格式不正确!", "密码在6-20位之间!", "不能为空!"];
            var message = "";
            message = !regExp[checkType].test(checkValue) ? errMsg[checkType] : "";
            return message;
        }
        var formCheck = function (value, checkType, tipIndex) {
            var result = patternCheck(value, checkType);
            if (result != "" || value == "") {
                tipIconDom.eq(tipIndex).html("<i class='icon icon-wrong'></i>&nbsp;&nbsp;" + result);
                throw result;
            } else {
                tipIconDom.eq(tipIndex).html("<i class='icon icon-checked-green'></i>");
            }
        };

        getCodeDom.click(function () {
            debugger;
            var tel = $.trim($("#tel").val()), userName = $.trim($("#userName").val()), time = 60;
            formCheck(tel, 0, 1);
            if (!send) return false;
            send = false;
            $.post("?act=sendmobilecode", {
                loginId: userName,
                mobilephone: tel
            }, function (data) {
                if (!data.state) {
                    alert(data.message);
                } else {
                    $("#md16").val(data.md16);
                }
            }, "json");
            getCodeDom.addClass("btn-disabled").text(time + "秒后重新获取");
            var t = setInterval(function () {
                if (--time > 0) {
                    getCodeDom.text(time + "秒后重新获取");
                } else {
                    send = true;
                    getCodeDom.removeClass("btn-disabled").text("获取手机验证码");
                    clearInterval(t);
                }
            }, 1000);
        });
    });
</script>
<TW:FooterSP ID="FooterSP1" runat="server" />
</form>
</body>
</html>

