<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title th:text="${logoName}">用户登录</title>
    <script th:src="@{/assets/js/jquery-2.1.4.min.js}" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/default.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/index.css}">
</head>
<body class="bg1">
<div class="wraper">
    <div class="logo">
        <p th:text="${logoName}">防空兵实战化训练综合数据管理系统</p>
    </div>
    <div class="ad_img">
        <div class="ad_img_l">
        </div>
        <div class="ad_img_r">
            <form th:action="@{/login}" id="loginForm" method="post" th:method="post" class="mt-1">
                <!--选项卡-->
                <div class="tb_">用户登录</div>
                <div class="ctt">
                    <div class="dis" id="tbc_01">
                        <div class="inp_bg2">
                            <div class="ico_1"></div>
                            <input class="login1" type="text" name="username" id="username" placeholder="请输入用户名"
                                   required
                                   autocomplete="on">
                        </div>
                        <div class="inp_bg2">
                            <div class="ico_2"></div>
                            <input class="login1" type="password" name="password" id="password" placeholder="请输入密码"
                                   required>
                        </div>
                    </div>
                </div>
                <button type="button" id="loginBtn" class="login2">登录</button>
            </form>
            <div class="zhuceq" style="display: none">
                <p class="fl">忘记密码？</p>
                <p class="fr">去注册&gt;&gt;</p>
            </div>
            <div th:if="${param.error != null}">
                <p th:if="${session['SPRING_SECURITY_LAST_EXCEPTION'] != null}"
                   th:text="${session['SPRING_SECURITY_LAST_EXCEPTION'].message}"
                   style="color: red; margin-top: 20px"></p>
            </div>
        </div>
    </div>

    <div class="footer">
        <div class="foot">
            <p></p>
        </div>
    </div>
</div>
</body>
<script>
    $(function () {
        $("#loginBtn").on('click', function () {
            if($("#username").val() == ''){
                alert('请输入用户名');
                return false;
            }
            if ($("#password").val() == '') {
                alert('请输入密码');
                return false;
            }
            $("#loginForm").submit();
            $("#loginBtn").attr('disabled', true).text('登录中...');
        });
    });
    if (!(top == window)) {
        top.location.replace('');
    }
</script>
</html>