<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>米菇菜果后台管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/js/layui/css/admin.css}" media="all">
    <link rel="stylesheet" th:href="@{/js/layui/css/login.css}" media="all">
    <script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
</head>
<body>

<div class="outer">
    <div class="layadmin-user-login layadmin-user-display-show">

        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h1>米菇菜果后台管理系统</h1>
                <!--<p></p>-->
            </div>
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username"></label>
                    <input type="text" name="username" id="account" placeholder="账号"  class="layui-input" >
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password"></label>
                    <input class="layui-input" id="password" name="password" placeholder="密码" type="password"
                    >
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" onclick="dologin()">登 入</button>
                </div>

            </div>
            <div class="layui-panel">
                <a href="https://beian.miit.gov.cn" style="padding: 80px; font-size: 14px; color: #21874d"
                   target="_blank">备案号：沪ICP备2023006275号-1</a>
            </div>
            <div class="layui-panel">
                <a style="padding: 51px; font-size: 14px; color: #21874d"
                   target="_blank">公司地址：上海市青浦区华科路68弄3号202</a>
            </div>
            <div class="layui-panel">
                <a style="padding: 107px; font-size: 14px; color: #21874d"
                   target="_blank">联系电话：021-69216508</a>
            </div>
        </div>
    </div>
</div>
<script>

    if (window != top) {
        top.location.href = location.href;
    }

    layui.use('layer', function () {
        var layer = layui.layer;
    });


    $("body").keydown(function () {
        if (event.keyCode == "13") {//keyCode=13是回车键
            dologin();
        }
    });

    function dologin() {
        var account = $("#account").val();
        var password = $("#password").val();
        if (account == '') {
            layer.msg("账号不能为空!", {
                time: 1000
            });
            return false;
        }
        if (password == '') {
            layer.msg("密码不能为空!", {
                time: 1000
            });
            return false;
        }
        $.ajax({
            url: "confirmUser",
            data: {
                "account": $("#account").val(),
                "password": $("#password").val()
            },
            type: "POST",
            dataType: 'json',
            success: function (result) {
                if (result.success) {
                    location.href = 'index';
                } else {
                    layer.msg(result.msg);
                }
            }
        });
    }

</script>

</body>
</html>
