<!DOCTYPE html>
<html lang=zh-cn> 
<head>
	<meta charset=utf-8> 
	<title>找回密码-纵横通行帐号</title> 
	<meta name=description content=一个帐号通用纵横旗下所有网络产品。> 
	<meta name=copyright content=smartcost.com.cn> 
	<link rel=stylesheet href=<?php echo $data['rootUrl_CSS']; ?>global.css> 
	<script src=<?php echo $data['rootUrl_JS']; ?>jquery-1.7.1.min.js></script> 
	<script src=<?php echo $data['rootUrl_JS']; ?>global.js></script>
    <script src=<?php echo $data['rootUrl_JS']; ?>smartcost.js></script>
    <script src="<?php echo $data['rootUrl_JS']; ?>jquery.validate.min.js"></script>
    <script type="text/javascript">
        $(function(){
            jQuery.validator.addMethod("isMobile", function(value, element) {
                var length = value.length;
                var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(14[0-9]{1}))+\d{8})$/;
                return this.optional(element) || (length == 11 && mobile.test(value));
            }, "请正确填写您的手机号码");

            $("#getpasswd").validate({
                rules: {
                    email: {
                        required: true
                    }
                },
                messages: {
                    email:{
                        required:"请输入您的注册账户"
                    }
                },
                errorElement: "span",// 错误信息容器标签
                errorClass: "erroT",
                validClass: "inputSus",
                onkeyup: false
            });

            $("#getpasswdbyphone").validate({
                rules: {
                    zhmobile:{
                        required: true,
                        isMobile: true,
                        remote: {
                            url: '<?php echo $data['rootUrl']; ?>checkphone',
                            type: 'POST',
                            dateType: 'json',
                            data: {
                                zhmobile: function () {
                                    return $('#zhmobile').val();
                                }
                            }
                        }
                    },
                    zhsmscode: {
                        required: true,
                        isCode: true,
                        remote: {
                            url: '<?php echo $data['rootUrl']; ?>check',
                            type: 'POST',
                            dateType: 'json',
                            data: {
                                zhsmscode: function () {
                                    return $('#zhsmscode').val();
                                },
                                zhmobile: function () {
                                    return $('#zhmobile').val();
                                }
                            }
                        }
                    },
                    password: {
                        required: true,
                        minlength: 6,
                        maxlength: 16
                    }
                },
                messages: {
                    zhmobile:{
                        required: "请输入手机号",
                        remote: "该手机号码未在纵横通行账号注册！"
                    },
                    zhsmscode: {
                        required: "请输入验证码",
                        remote: "验证码过期或不一致，请重新获取"
                    },
                    password:{
                        required:"请输入密码",
                        minlength: "密码长度不能小于6",
                        maxlength: "密码长度不能大于16"
                    }
                },
                errorElement: "span",// 错误信息容器标签
                errorClass: "erroT",
                validClass: "inputSus",
                onkeyup: false
            })
        });
    </script>
</head>
<body>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_header.php"; ?>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_body_top.php"; ?>
<div class="globalContent width950">
	<div class="formItem">
		<h2>找回密码</h2>
        <div class="trainForm">
            <div class="trainFormTab clearfix">
                <a class="now">使用注册邮箱</a>
                <a>使用手机号</a>
            </div>
        </div>
        <div class="trainFormItem">
            <div class="formEntry clearfix">
                <dl class="regForm">
                    <dt>注册邮箱</dt>
                    <form method="post" name="getpasswd" id="getpasswd" >
                        <dd><input id="email"  name="email" class="inputText" style="width:420px"><p class="tips">系统将会发送一份邮件至该账户注册时所填写的邮箱，请注意查收！</p><span class="erroT"><?php echo $data['messages']; ?></span></dd>
                        <dd class="clearfix"><br><input type="submit" name="emailsubmit" class="button btn-blue " value="发送找回密码邮件">
                    </form>
                </dl>
            </div>
            <div class="formEntry reportContent" style="display:none">
                <form method="post" name="getpasswdbyphone" id="getpasswdbyphone" >
                <dl class="regForm">
                    <dt>注册手机</dt>
                    <dd><input type="text" id="zhmobile" name="zhmobile" class="inputText" style="width:350px"><p class="tips">请输入注册手机号</p><a href="<?php echo $data['rootUrl']; ?>reg" class="return">返回注册</a></dd>
                    <dt>短信校验码</dt>
                    <dd><input type="text" class="inputText" name="zhsmscode" id="zhsmscode" style="width:177px;"><p class="tips">验证码是6位数字</p><input type="button" class="btnTextOne" id="codebtn" name="codebtn" value="获取验证码" onclick="checkAndSend(this)" ></dd>
                    <dt>新密码</dt>
                    <dd><input class="inputText" type="password" id="password" name="password" style="width:350px"><p class="tips">密码长度为6～16位，建议使用数字与英文混合</p><span class="erroT"><?php echo $data['messages2']; ?></span></dd>
                    <dd class="clearfix"><br><input type="submit" name="mobilesubmit" class="button btn-blue " value="确认修改"></dd>
                </dl>
                </form>
            </div>
        </div>
	</div>
</div>
<?php include Doo::conf()->SITE_PATH .  Doo::conf()->PROTECTED_FOLDER . "viewc/v2/_footer.php"; ?>
<script type="text/javascript">
    var clock = '';
    var nums = 60;
    var btn;
    function checkAndSend(thisbtn){
        $('#zhmobile').removeClass('erroT');
        if($('#zhmobile').siblings().hasClass('erroT')){
            $('#zhmobile').siblings('.erroT').remove();
        }
        var mobile = $('#zhmobile').val();
        if(mobile == ''){
            $('#zhmobile').addClass('erroT');
            var span = '<span class="erroT">请输入手机号</span>';
            $('#zhmobile').parent().append(span);
            return false;
        }else if(!mobile.match(/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(14[0-9]{1}))+\d{8})$/)){
            $('#zhmobile').addClass('erroT');
            var span = '<span class="erroT">请正确填写您的手机号码</span>';
            $('#zhmobile').parent().append(span);
            return false;
        }
        var flag = true;
        $.ajax({
            url: '<?php echo $data['rootUrl']; ?>checkgetpwdsms',
            type: 'POST',
            dateType: 'json',
            async: false,
            data: {zhmobile:mobile},
            success: function (result) {
                var data = eval('('+result+')');
                if(data.code == -1){
                    $('#zhmobile').addClass('erroT');
                    var span = '<span class="erroT">'+data.msg+'</span>';
                    $('#zhmobile').parent().append(span);
                    flag = false;
                }else if(data.code == 1){
                    flag = true;
                }
            }
        });
        if(!flag){
            return false;
        }
        $('#zhmobile').addClass('inputSus');
        sendCode(thisbtn);
    }

    function sendCode(thisBtn)
    {
        btn = thisBtn;
        btn.disabled = true; //将按钮置为不可点击
        btn.value = nums+'秒后可重新获取';
        $('#codebtn').removeClass('btnTextOne').addClass('btnText');
        btn.style.cursor = 'no-drop';
        clock = setInterval(doLoop, 1000); //一秒执行一次
    }
    function doLoop()
    {
        nums--;
        if(nums > 0){
            btn.value = nums+'秒后可重新获取';
        }else{
            clearInterval(clock); //清除js定时器
            btn.disabled = false;
            btn.value = '点击发送验证码';
            $('#codebtn').removeClass('btnText').addClass('btnTextOne');
            btn.style.cursor = 'pointer';
            nums = 60; //重置时间
        }
    }
</script>
</body>
</html>