<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">

    <title>后台管理系统</title>
    <!-- <link rel="shortcut icon" href="img/favicon.ico"> -->

    <!-- global stylesheets -->
    {{--<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">--}}
    <link rel="stylesheet" href="{{ asset('xadmin/css/bootstrap.min.css')}}">
{{--    <link rel="stylesheet" href="{{ asset('xadmin/font-awesome-4.7.0/css/font-awesome.min.css')}}">--}}
    {{--<link rel="stylesheet" href="{{ asset('xadmin/css/font-icon-style.css')}}">--}}
    <link rel="stylesheet" href="{{ asset('xadmin/css/style.default.css')}}" id="theme-stylesheet">
{{--    <link rel="stylesheet" href="{{ asset('xadmin/extra/bootstrapvalidator-master/dist/css/bootstrapValidator.css')}}">--}}


    <!-- Core stylesheets -->
    <link rel="stylesheet" href="{{ asset('xadmin/css/pages/login.css')}}">
    <style>
        form.cmxform label.error, label.error {
            /* remove the next line when you have trouble in IE6 with labels in list */
            color: red;
            font-style: italic;
            margin-top: 11px;
        }
    </style>
</head>

<body>
<script type="application/javascript" >
    var str = window.location.host;
    str = str .toLowerCase ();
    if(str.indexOf("dimpt") != -1 || str.indexOf("114")!= -1)
    {
        window.location = "/home";
    }

</script>
<!--====================================================
                        PAGE CONTENT
======================================================-->
<section class="hero-area">
    <div class="overlay"></div>
    <div class="container">
        <div class="row">
            <div class="col-md-12 ">
                <div class="contact-h-cont">
                    <form id="defaultForm" autocomplete="off">
                        <input type="hidden" name="_token" value="{{csrf_token()}}">
                        <div class="form-group">
                            <label for="username">用户名</label>
                            <input type="text" class="form-control" id="username" name="username" value=""
                                   placeholder="用户名" autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">密码</label>
                            <input class="form-control" type="password" id="password" name="password" value=""
                                   id="example-password-input" placeholder="密码" autocomplete="off">
                        </div>
                        <button class="btn btn-general btn-blue" type="submit" onclick="login();">
                            <i fa fa-right-arrow></i>登录
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
<div class="footer">
    <!-- <div class="copyright">京ICP备10218183号 京ICP证161188号   京公网安备 11010802020593号</div> -->
    <p class="copyright">
        <a target="_blank" href="https://beian.miit.gov.cn/" rel="nofollow">京ICP备10218183号-106</a>
        <img src="{{ asset('images/gongbei.png')}}" style="vertical-align:-5px;">
        京ICP证161188号
        <a style="padding-left: 8px;" target="_blank" href="https://zzlz.gsxt.gov.cn/businessCheck/verifKey.do?showType=p&amp;serial=91110108551426892J-SAIC_SHOW_10000091110108551426892J1597816757943&amp;signData=MEYCIQC/42StZW2bD8m5uoQqcZLKqORskB7sTTjUa10R/GZdNgIhAJ0BOPBSmJPKn7/0pIvBKWNxZ2XIn0l5XVNsHFmqCMmS" rel="nofollow">
            <img src="https://s.eoffcn.com//zytg/202008/175c14f5-3bf5-63cd-0c61-12627f47775e.png" width="20" height="20" style="vertical-align:-5px;">
        </a>
    </p>
</div>
<style type="text/css">
    .footer .copyright{
        text-align: center;
    }
</style>
<!--Global Javascript -->
<script src="{{ asset('xadmin/js/jquery.min.js')}}"></script>
<script src="{{ asset('xadmin/js/jquery.cookie.js')}}"></script>
<script src="{{ asset('xadmin/js/jquery.validate.js')}}"></script>
<script src="{{ asset('xadmin/js/common.js')}}"></script>
<script src="{{ asset('xadmin/extra/toast/js/toast.js')}}"></script>

<script>
    function login() {

        $("#defaultForm").validate({
            rules: {
                username: {
                    required: true,
                    // minlength: 2
                },
                password: {
                    required: true,
                    // minlength: 5
                },

            },
            messages: {
                username: {
                    required: "用户名不能为空",
                    // minlength: "Your username must consist of at least 2 characters"
                },
                password: {
                    required: "密码不能为空",
                    // minlength: "Your password must be at least 5 characters long"
                },

            },
            submitHandler: function (form) {
                var form = document.querySelector("#defaultForm");
                var formdata = new FormData(form);

                fetch_response('POST', '/web/login', formdata).then(function (res) {
                    if (res.code == 200) {
                        $('body').toast({
                            position: 'fixed',
                            content: res.msg,
                            duration: 1000,
                            top: '50%'
                        });

                        setTimeout(function () {

                            window.location.href = '/web/admin';
                        }, 2000)

                    } else {
                        $('body').toast({
                            position: 'fixed',
                            content: res.msg,
                            duration: 1000,
                            top: '50%'
                        });
                    }
                });
            }
        });

    }



    // Validate the form manually
    // $('#validateBtn').click(function () {
    //     $('#defaultForm').bootstrapValidator('validate');
    //
    //     $.ajax({
    //         url: '/web/login',
    //         data: {
    //             name: $('#username').val(),
    //             password: $('#password').val()
    //         },
    //         type: 'post',
    //         dataType: 'json',
    //         success: function (res) {
    //             // console.log('res',res)
    //             if (res.code == 200) {
    //                 window.location.href = '/web/admin';
    //             } else {
    //                 verifyCode.refresh();
    //                 layer.msg(res.msg, {icon: 5});
    //             }
    //
    //
    //         }
    //     })
    //
    //
    // });

</script>
</body>

</html>