<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>用户登录-计量支付</title>
    <link rel="stylesheet" href="public/css/bootstrap/bootstrap.min.css">
    <link rel="stylesheet" href="public/css/main.css">
    <link rel="stylesheet" href="public/css/font-awesome/font-awesome.min.css">
</head>
<body class="login-body">
<div class="container">
    <!--演示版-->
    <form class="form-signin" method="post" action="/login">
        <h1 class="d-flex justify-content-center mb-4">计量支付</h1>
        <nav class="nav nav-tabs nav-justified mb-3" role="tablist" id="login-tab">
            <a class="nav-item nav-link active" data-toggle="tab" data-type="1" href="#preview" role="tab">演示版登录</a>
            <a class="nav-item nav-link" data-toggle="tab" data-type="2" href="#paid" role="tab">项目版登录</a>
        </nav>
        <div class="tab-content">
            <div class="tab-pane active" id="preview" role="tabpanel">
                <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
                    <input id="username" name="username" class="form-control " placeholder="通行账号 邮箱/手机" value="laiku123@qq.com" autofocus="">
                </div>
                <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
                    <input id="password" name="password" class="form-control " placeholder="输入密码" value="19930523" type="password">
                </div>
            </div>
            <div class="tab-pane" id="paid" role="tabpanel">
                <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
                    <input id="project" class="form-control" name="project" placeholder="项目编号" autofocus="" />
                </div>
                <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
                    <input id="account" class="form-control" name="account" placeholder="输入账号" autofocus="" />
                </div>
                <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
                    <input id="project-password" name="project_password" class="form-control" placeholder="输入密码" type="password" />
                </div>
            </div>
            <% if(errorMessage !== undefined && errorMessage !== null) { %>
            <div class="form-group">
                <div class="alert alert-danger" role="alert">
                    <strong>登录失败</strong> <%= errorMessage %>
                </div>
            </div>
            <% } %>
        </div>
        <div class="form-group">
            <button class="btn btn-primary btn-block" type="submit">登录</button>
            <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
            <input type="hidden" name="type" value="1" />
        </div>
        <div class="pt-1 d-flex justify-content-center">
            <a href="http://sso.smartcost.com.cn/getpasswd" target="_blank" class="mr-3">忘记密码</a>
            <a href="http://sso.smartcost.com.cn/reg" target="_blank">免费注册</a>
        </div>
    </form>
    <!--项目版-->
</div>
<!-- JS. -->
<script src="/public/js/jquery/jquery-3.2.1.min.js"></script>
<script src="/public/js/popper/popper.min.js"></script>
<script src="/public/js/bootstrap/bootstrap.min.js"></script>
<script src="/public/js/global.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#login-tab a[data-toggle='tab']").on('shown.bs.tab', function () {
        let type = $(this).data('type');
        type = parseInt(type);
        type = isNaN(type) || type <= 0 ? 1 : type;
        $("input[name='type']:hidden").val(type);
    });
});
</script>
</body>

</html>
