<%@ Page Language="C#" MasterPageFile="~/Master/UserPageMaster.master" CodeBehind="Forget.aspx.cs" Inherits="WAP2P.Web.PC.User.Forget" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-container g-zindexmin g-ohide mt20 mb20 m-globalbox m-wholebox">
        <div class="m-title">
            <i class="iconfont fs20">&#xe623;</i> 密码重置
        </div>
        <div class="t-flowsteps js-stepnav">
            <ol class="ui-stepbar step-num3">
                <li class="first current">
                    <span>
                        <i>1</i>
                        <em>输入账号</em>
                    </span>
                </li>
                <li>
                    <span>
                        <i>2</i>
                        <em>验证身份</em>
                    </span>
                </li>
                <li class="last">
                    <span>
                        <i>3</i>
                        <em>重置密码</em>
                    </span>
                </li>
            </ol>
        </div>
        <div class="form-big ml204">
            <form class="js-auto js-vsum js-step" method="post" action="<% =Request.RawUrl.UrlEncodeParam() %>" data-onsuccess="common.pageTip('<% =PageBase.TipType.Success %>', '重置密码成或，请记住新密码。', '/User/Login' + gconfig.pageExt, '帐户登录');">
                <div class="js-step">
                    <div class="input-big js-tip">
                        <label class="leftfont"">找回用户</label>
                        <input type="text" class="text w332" name="user" id="user" placeholder="请输入手机/邮箱" tabindex="1" data-vtype="must|fun" data-vmsg="请输入手机/邮箱|帐号不存在或资料未经过认证" data-vfun="validUser" />
                    </div>
                    <div class="input-big codeinput w400" id="js-codeinput">
                        <a href="javascript:void(0)" onclick="$('img',this).attr('src', 'ValidCode<% =PageExt %>?v=' + (new Date()).getTime())">
                            <img src="ValidCode<% =PageExt %>?v=<% =DateTime.Now.Ticks %>" width="85" height="31" />
                            <span>看不清？<br/>换一张</span>
                        </a>
                        <label class="leftfont">验证码</label>
                        <input type="text" class="text w95" name="vcode" maxlength="6" placeholder="请输入验证码" tabindex="2" data-vtype="must|fun" data-vfun="validVCode" data-vmsg="请输入验证码|验证码错误" />
                    </div>
                    <div class="btn-submits mt20 ml99">
                        <input type="submit" value="下 一 步" class="btn-nobordbig c-normal w172" />
                        <div class="w332"><em class="m-sumtip big-tip js-vsum"></em></div>
                    </div>
                </div>
                <div class="js-step g-hide" id="js-validInfo">
                
                </div>
                <div class="js-step g-hide">
                    <div class="input-big">
                        <label class="leftfont">新密码</label>
                        <input type="password" class="text w332"  name="password" placeholder="请输入新密码" id="password1" maxlength="50" data-vtype="must|length" data-vmin="6" data-vmax="50" data-vmsg="请输入密码|密码长度过短" />
                    </div>
                    <div class="input-big">
                        <label class="leftfont">密码确认</label>
                        <input type="password" class="text w332" id="password1" placeholder="请再次输入新密码" data-vtype="must|same" data-vref="password1" data-vmsg="请输入确认密码|两次密码输入不一致" />
                    </div>
                    <div class="btn-submits mt10 ml99">
                        <input type="submit" value="提 交 并 修 改" class="btn-bbord fs16 c-normal w366" />
                        <div class="w366"><em class="m-sumtip js-vsum"></em></div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/template" id="js-forgetname">
        <div class="js-forgetname">
            <div class="input-big">
                <label class="leftfont">真实姓名</label>
                <input type="text" class="text w332" name="realName" placeholder="请输入真实姓名" data-vtype="must|fun" data-vfun="validRealname" data-vmsg="请输入真实姓名|真实姓名不匹配" />
            </div>
            <div class="input-big">
                <label class="leftfont">身份证号码</label>
                <input type="text" class="text w332" name="cardNo" placeholder="请输入身份证号码" data-vtype="must|fun" data-vfun="validCardno" data-vmsg="请输入身份证号码|身份证号码不匹配" />
            </div>
            <div class="input-big">
                <label class="leftfont">支付密码</label>
                <input type="password" class="text w332" name="payPassword" placeholder="请输入支付密码" data-vtype="must|fun" data-vfun="validPay" data-vmsg="请输入支付密码|支付密码错误或已被锁定" />
                <span class="prompt">连续输入<% =GlobalSetting.Get(GlobalSetting.Keys.Security.PayErrorLockN) %>次以上支付密码将导致账户被锁定，如有疑问请联系客服。</span>
            </div>
            <div class="btn-submits ml99">
                <input type="button" value="上 一 步" class="btn-nobordbig c-normal w172" onclick="commonUi.stepSwitch(0)" /><input type="submit" value="下 一 步" class="btn-nobordbig c-normal w172 ml20" />
                <div class="w332"><em class="m-sumtip big-tip js-vsum"></em></div>
            </div>
        </div>
    </script>
    <script type="text/template" id="js-forgetphone">
        <div class="t-redfont js-tip ">
            点击发送后将发送验证码至：<span class="js-target"></span>
            <input type="hidden" id="userCopy" />
        </div>
        <div class="input-big mt10 js-sendvcode" data-vcode-target="#userCopy">
            <label class="leftfont">验证码</label>
            <input type="text" name="validCode" class="text js-sendvcode-code" size="20" placeholder="请输入接收到的验证码" disabled="disabled" maxlength="6" data-vtype="length|fun" data-vfun="validSendCode" data-vmin="6" data-vmax="6" data-vmsg="请输入正确的验证码。|验证码不正确。" />
            <input type="button" class="btn-nobordbig c-normal js-sendvcode-btn" value="发送验证码" />
            <span class="prompt">如果长时间未能接收到验证码，请电话联系客服。</span>
        </div>
        <div class="btn-submits ml99">
            <input type="button" value="上 一 步" class="btn-nobordbig c-normal w172" onclick="commonUi.stepSwitch(0)" /><input type="submit" value="下 一 步" class="btn-nobordbig c-normal w172 ml20" />
            <div class="w332"><em class="m-sumtip big-tip js-vsum"></em></div>
        </div>
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        function validSendCode(val) {
            return common.sendValidCode.valid($('#user').val(), val);
        };

        function validUser(val) {
            var res = false;
            $.ajax({
                type: 'get',
                dataType: 'json',
                url: '?action=validUser',
                async: false,
                data: { data: val },
                success: function (result) {
                    res = result.Success;
                    if (res) {
                        var dom = $('#js-validInfo');
                        switch (result.Message) {
                            case 'mobile':
                            case 'email':
                                dom.html(document.getElementById('js-forgetphone').innerHTML);
                                dom.find('.js-target').text(val);
                                dom.find('#userCopy').val(val);
                                common.sendValidCode.initInput(dom);
                                break;
                            case 'name':
                                dom.html(document.getElementById('js-forgetname').innerHTML);
                                break;
                        }
                    }
                }
            });
            return res;
        };

        function validVCode(val) {
            return common.imageValidCode.valid(val);
        }

        function validInfo(val, type) {
            var res = false;
            $.ajax({
                type: 'get',
                dataType: 'json',
                url: '?action=validInfo',
                async: false,
                data: { data: val, type: type, user: $('#user').val() },
                success: function (result) {
                    res = result.Success;                    
                }
            });
            return res;
        }

        function validRealname(val) {
            return validInfo(val, 'realname');
        }
        function validCardno(val) {
            return validInfo(val, 'cardno');
        }
        function validPay(val) {
            return validInfo(val, 'pay');
        }

    </script>
</asp:Content>
