@page
@model Waste.Web.Entry.Pages.Login.IndexModel
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>登录</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="~/css/login.min.css" />
    <script src="~/js/login.min.js" asp-append-version="true"></script>
    <!-- Ionicons -->
    @*<link rel="stylesheet" href="../../bower_components/Ionicons/css/ionicons.min.css">*@
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <div>
                    <img src="@Furion.App.Configuration["CustomSetting:Logo"]" style="height:50px;max-width:136px;"/>
                </div>
                <h2>@Furion.App.Configuration["CustomSetting:SoftName"]</h2>
                <p>@Furion.App.Configuration["CustomSetting:SoftDesc"]</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" for="LAY-user-login-username"></label>
                    <input type="text" name="username" id="username" lay-verify="required" placeholder="用户名" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                    <input type="password" name="pwd" id="pwd" lay-verify="required" placeholder="密码" class="layui-input">
                </div>
                @*<div class="layui-form-item">
                        <div class="layui-row">
                            <div class="layui-col-xs7">
                                <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                                <input type="text" name="code" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
                            </div>
                            <div class="layui-col-xs5">
                                <div style="margin-left: 10px;">
                                    <img src="/Login/GetAuthCode" class="layadmin-user-login-codeimg js-switch" id="LAY-user-get-vercode">
                                </div>
                            </div>
                        </div>
                    </div>*@
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid layui-btn-radius js-login" lay-submit lay-filter="LAY-user-login-submit">登 录</button>
                </div>
            </div>
        </div>

        <div class="layui-trans layadmin-user-login-footer">

            <p>© 2021 <a href="javascript:void(0)">@Furion.App.Configuration["CustomSetting:copyright"]</a><span>版本号:@Furion.App.Configuration["CustomSetting:Version"]</span></p>
        </div>
    </div>
    <script type="text/javascript">
        layui.config({
            base: '/js/'
        }).extend({
            index: 'lib/index'
        }).use(['index', 'form', 'common'], function () {
            var form = layui.form
                , common = layui.common;
            form.render();
            form.on('submit(LAY-user-login-submit)', function (obj) {
                common.ajax({
                    url: "/api/account/login",
                    data: obj.field,
                    type: "post",
                    success: function (res) {
                        if (res.succeeded) {
                            var newres = res.data;
                            if (newres.code === 0) {
                                common.msg(newres.message);
                                setTimeout(function () {
                                    location.href = "/";
                                }, 1000);
                            } else {
                                common.alert(newres.message);
                            }
                        } else {
                            var msg = "状态码:" + res.statuscode + ",时间戳:" + res.timestamp + ",描述:" + res.errors;
                            common.alert(msg);
                        }
                    }
                });

            });
            $(".js-switch").on("click", function () {
                $(this).attr("src", "/Login/GetAuthCode?time=" + Math.random());
            });
            document.onkeydown = function (e) {
                if (!e) e = window.event;
                if ((e.keyCode || e.which) == 13) {
                    $(".js-login").click();
                }
            }
        });
    </script>
</body>
</html>