<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>{$title}-找回密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
    <link href="/static/hplus/css/bootstrap.min.css?v=3.3.7" rel="stylesheet" />
    <link href="/static/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" />
    <link href="/static/hplus/css/animate.css" rel="stylesheet" />
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet" />
    <link href="/static/admin/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
    <style>

        .verifyimg{
            width:46%;
            height: 40px;
            margin-bottom: 3px;
            border: 1px solid #ccc;
            cursor: pointer;
        }
        .login-title{
            font-size: 18px;
            color: #222;
        }
        .form-control{
        }
        .btn-block{
            margin-top: 10px;
        }
        .login-input-box{
            height: 55px !important;
        }
    </style>

</head>

<body>
<div class="login-logo-top">
    <div class="login-logo-top-div">
        <img class="login-logo-top-img" src="/static/admin/img/logo.png" alt="">
    </div>
</div>

<div class="login-box">
<!--    <div class="login-box-left">-->
<!--        <div class="login-box-banner">-->
<!--            <img src="/static/admin/img/tu.png" alt="">-->
<!--        </div>-->
<!--        <div class="l-title">-->
<!--            <div class="l-title-a">欢迎使用</div>-->
<!--            <div class="l-title-a">{$title}</div>-->
<!--        </div>-->
<!--    </div>-->
    <div class="login-box-right">
        <div class="from-data">
            <div class="form-right">
                <div class="logo-title">
                    找回密码
                </div>
                <form method="post" style="margin: 0 49px;" action="{:url('forget')}">

                    <div class="login-input-box" style="display:flex !important;">
                        <div class="login_input-box" style="width: 160px !important;">
                            <input type="text" name="account" id="phone" class="form-control uname"  placeholder="手机号" />
                        </div>
                        <div class="login_input-box" style="width: 140px !important;">
                            <input type="text" readonly id="yzm" value="获取验证码" style="cursor: pointer" onclick="sendsms(this)" class="form-control uname" />
                        </div>
                    </div>
                    <div class="login-input-box">
                        <div class="login_input-box">
                            <input type="text" name="code" class="form-control uname"  placeholder="验证码" />
                        </div>
                    </div>
                    <div class="login-input-box">
                        <div class="login_input-box">
                            <input type="password" name="password" class="form-control pword m-b" placeholder="新密码" />
                        </div>
                    </div>
                    <a class="forget f-login" href="{$loginurl}">去登陆</a>

                    <!--                    <h5 class="forget"><a href="{:url('login')}">去登陆</a></h5>-->
                    <button class="btn btn-info btn-block" >提 交</button>


                </form>
            </div>
        </div>

        <div class="zi">
            <img src="/static/admin/img/zi.png" alt="">
        </div>
    </div>
</div>


<div class="copyright-text">
    Copyright © 2023 明德智慧医院后勤一站式服务平台 版权所有
</div>
<script src="/static/hplus/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/hplus/js/bootstrap.min.js?v=3.3.7"></script>
<script src="/static/layer/layer.js"></script>
<script>
    $(function(){
        //表单提交
        $(document)
            .ajaxStart(function(){
                $("button:submit").html('登 录 中...').attr("disabled", true);
            })
            .ajaxStop(function(){
                $("button:submit").html('登 录').attr("disabled", false);
            });

        $("form").submit(function(){
            var self = $(this);
            self.find(".check-tips").text('');
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;

            function success(data){
                if(data.code){
                    window.location.href = data.url;
                } else {
                    layer.msg(data.msg)
                    //刷新验证码
                    $(".reloadverify").click();
                }
            }
        });

        //刷新验证码
        var verifyimg = $(".verifyimg").attr("src");
        $(".reloadverify").click(function(){
            if( verifyimg.indexOf('?')>0){
                $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
            }else{
                $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
            }
        });

    });

    function sendsms(_self) {
        var flag = $(_self).attr('data-flag');
        if (flag == 1) {
            return false;
        }
        var mobile = $('#phone').val();
        if (mobile == '') {
            layer.msg('未填写手机号');
            return false;
        }
        $(_self).attr('data-flag', 1);

        $.ajax({
            url: '{:url("sms")}',
            type: "POST",
            data: {'mobile': mobile},
            success: function (res) {
                if (res.code == 1) {
                    var time = 60;
                    $('#yzm').val("(" + time + "s)重新获取");
                    var timer = setInterval(function () {
                        time--;
                        if (time == 0) {
                            $('#yzm').val("获取验证码");
                            $(_self).attr('data-flag', 0);
                            clearInterval(timer);
                        } else {
                            $('#yzm').val("(" + time + "s)重新获取");
                        }
                    }, 1000);
                } else {
                    layer.msg(res.msg);
                    $(_self).attr('data-flag', 0);
                    $('#yzm').val("获取验证码");
                }
            },
            error: function (result) {
                layer.msg('请求失败');
                $(_self).attr('data-flag', 0);
                $('#yzm').val("获取验证码");
            }
        });
    }
</script>
</body>
</html>