<!DOCTYPE html>
<html lang="zh">
<head>
    <@seoMeta/>
    <@title/>

    <link href="<@contextPath/>/static/common/hplus/css/bootstrap.min.css" rel="stylesheet">
    <link href="<@contextPath/>/static/common/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="<@contextPath/>/static/common/hplus/css/animate.min.css" rel="stylesheet">
    <link href="<@contextPath/>/static/common/hplus/css/style.min.css" rel="stylesheet">
    <link href="<@contextPath/>/static/common/plugins/sweetalert2/sweetalert2.min.css" rel="stylesheet">

    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>
<body class="gray-bg">
    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <h1>
                <#if app.logo == "true">
                    <h1 class="logo-name"><img alt="logo" src="<@contextPath/>/static/img/logo.png"/></h1>
                <#else>
                    <h1 class="logo-name" style="font-size: 80px;padding-bottom: 50px;">登 录</h1>
                </#if>
            </div>
<#--            <h3>欢迎使用 ${app.title!""}</h3>-->
            <form id="LoginForm" method="post" class="m-t" role="form" action="<@contextPath/>/auth/loginCheck" onsubmit="return false;">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="登录账号" id="username" name="username">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="登录密码" id="password" name="password">
                </div>
                <label for="online" style="padding-bottom: 5px;"><input type="checkbox" name="online" id="rememberme" checked="checked"> 记住登录</label>
                <button class="btn btn-primary block full-width m-b" onclick="loginVerify();">登录</button>
                <p class="text-muted text-center"> <!--<a href="javascript:;"><small>忘记密码了？</small></a> | <a href="javascript:;">注册一个新账号</a>--></p>
            </form>
        </div>
    </div>
    <div class="text-center" style="width: 100%;height: 36px;position: fixed;bottom: 0;">
        © 2023 All Rights Reserved. <#if icp??><a href="https://beian.miit.gov.cn/" target="_blank">${icp}</a></#if>
    </div>

    <script src="<@contextPath/>/static/common/hplus/js/jquery.min.js?v=2.1.4"></script>
    <script src="<@contextPath/>/static/common/plugins/sweetalert2/sweetalert2.min.js"></script>
    <script src="<@contextPath/>/static/common/js/ui/common-base-min.js"></script>
    <script src="<@contextPath/>/static/common/js/lib/md5.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function(){
            var username = App.Cookie.read("WebLoginUser");
            document.getElementById('username').value = username || '';
        };

        function loginVerify(){
            var username = document.getElementById('username').value;
            var password = document.getElementById('password');
            if(!username){
                MsgBox.warn('登录账号不能为空');
                return;
            }else if(!password.value){
                MsgBox.warn('登录密码不能为空');
                return;
            }
            var rememberme = document.getElementById('rememberme').checked;
            password.value = hex_md5(password.value);
            App.Ajax.submit({
                form	: 'LoginForm',
                isAutoTip: false,
                success	: function(resp){
                    if(rememberme){//保存用户名至Cookie
                        App.Cookie.create("WebLoginUser", username, 365);
                    }
                    if(window.parent){
                        window.parent.location = '<@contextPath/>/index';
                    }else
                        window.location = '<@contextPath/>/index';
                },
                failure	: function(resp){
                    password.value = '';
                    MsgBox.error(resp.msg || '登录失败！');
                }
            });
        }
    </script>
</body>
</html>
