
@{
    ViewBag.Title = "Index";
    Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台管理</title>
<meta http-equiv="Pragma" content="no-cache"> 
<meta http-equiv="Cache-Control" content="no-cache"> 
<meta http-equiv="Expires" content="0"> 
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="后台管理">
<meta name="description" content="后台管理">
<link href="~/Content/Admin/css/login.css" rel="stylesheet" type="text/css">
<link href="/Content/fonts/iconfont.css" rel="stylesheet" />
<link href="/Content/css/common.css" rel="stylesheet" />
<link href="/Content/layui/css/layui.css" rel="stylesheet" />
<link href="/Content/css/angeladmin.animate.css" rel="stylesheet" />
<link href="/Content/loading/angelLoading.css" rel="stylesheet" />
<link href="/Content/css/angelsub.css" rel="stylesheet" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
</head>
<body class="page-fill">
<div class="login_box">
      <div class="login_l_img"><img src="~/Content/Admin/images/login-img.png"></div>
      <div class="login">
          <div class="login_logo"><a href="#"><img src="~/Content/Admin/images/login_logo.png"></a></div>
          <div class="login_name">
               <p>后台管理系统</p>
          </div>
          <form class="layui-form">
            <div class="layui-form-item input-item">
                <input type="text" lay-verify="required" name="username" placeholder="请输入账号" autocomplete="off" id="username" class="layui-input">
            </div>
            <div class="layui-form-item input-item">
                <input type="password" lay-verify="required|password" name="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
            </div>
            <div class="layui-form-item input-item captcha-box">
                <div class="imgcode">
                <input type="text" lay-verify="required|captcha" class="captchainput layui-input" name="captcha" placeholder="请输入验证码" autocomplete="off" id="captcha" maxlength="4">
                <div class="img angel-none-select captchaImg" id="captchaImg"></div>
                  </div>
            </div>
            <div class="layui-form-item" style="clear:both;">
                <button class="angelLoginbtn" lay-filter="login" lay-submit="">登录</button>
            </div>
          </form>
            </div>
 </div>
<script src="~/Content/layui/layui.js"></script>
<script type="text/javascript">
  layui.use(["form", "angelGVerify", "angelUtils", "angelLayer"], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var angelGVerify = layui.angelGVerify;
        var angelUtils = layui.angelUtils;
        var angelLayer = layui.angelLayer;

        /**
         * 初始化验证码
         */
        var verifyCode = new angelGVerify("#captchaImg");

        /**
         * 数据校验
         */
        form.verify({
            password: [/^[\S]{6,12}$/, "密码必须6到12位，且不能出现空格"],
            captcha: function (val) {
                if (verifyCode.validate(val) != "true") {
                    return verifyCode.validate(val)
                }
            }
        });

        /**
         * 表单提交
         */
        form.on("submit(login)", function (data) {
            //console.log(data.field);
            //alert(JSON.stringify(data.field));
            angelUtils.ajax("api/aloginapi/post", "post", data.field, true).done(function (response) {
                angelLayer.greenTickMsg(response.msg, function () {
                    window.location = "/Admin/Home/";
                })
            }).fail(function (error) {
                console.log(error)
            });
            return false;
        });

        /**
         * 表单input组件单击时
         */
        $("#login .input-item .layui-input").click(function (e) {
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        });

        /**
         * 表单input组件获取焦点时
         */
        $("#login .layui-form-item .layui-input").focus(function () {
            $(this).parent().addClass("layui-input-focus");
        });

        /**
         * 表单input组件失去焦点时
         */
        $("#login .layui-form-item .layui-input").blur(function () {
            $(this).parent().removeClass("layui-input-focus");
            if ($(this).val() != "") {
                $(this).parent().addClass("layui-input-active");
            } else {
                $(this).parent().removeClass("layui-input-active");
            }
        })
    });
</script>
</body>
</html>

@*<!DOCTYPE html>
<html lang="en" class="page-fill">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="登录">
    <meta name="description" content="登录">
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon"/>
    <link href="~/Content/fonts/iconfont.css" rel="stylesheet" />
    <link href="~/Content/css/common.css" rel="stylesheet" />
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <link href="~/Content/css/angeladmin.animate.css" rel="stylesheet" />
    <link href="~/Content/loading/angelLoading.css" rel="stylesheet" />
    <link href="~/Content/css/angelsub.css" rel="stylesheet" />
</head>
<body class="page-fill">
    <div class="page-fill" id="login">
        <form class="layui-form">
            <div class="login_face"><img src="~/Content/images/logo.png"></div>
            <div class="layui-form-item input-item">
                <label for="username">用户名</label>
                <input type="text" lay-verify="required" name="username" placeholder="请输入账号" autocomplete="off" id="username" class="layui-input">
            </div>
            <div class="layui-form-item input-item">
                <label for="password">密码</label>
                <input type="password" lay-verify="required|password" name="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
            </div>
            <div class="layui-form-item input-item captcha-box">
                <label for="captcha">验证码</label>
                <input type="text" lay-verify="required|captcha" name="captcha" placeholder="请输入验证码" autocomplete="off" id="captcha" maxlength="4" class="layui-input">
                <div class="img angel-none-select" id="captchaImg"></div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-block" lay-filter="login" lay-submit="">登录</button>
            </div>
        </form>
    </div>
    <!--js逻辑-->
    <script src="~/Content/layui/layui.js"></script>
    <script>
        layui.use(["form", "angelGVerify", "angelUtils", "angelLayer"], function () {
            var form = layui.form;
            var $ = layui.jquery;
            var angelGVerify = layui.angelGVerify;
            var angelUtils = layui.angelUtils;
            var angelLayer = layui.angelLayer;

            /**
             * 初始化验证码
             */
            var verifyCode = new angelGVerify("#captchaImg");

            /**
             * 数据校验
             */
            form.verify({
                password: [/^[\S]{6,12}$/, "密码必须6到12位，且不能出现空格"],
                captcha: function (val) {
                    if (verifyCode.validate(val) != "true") {
                        return verifyCode.validate(val)
                    }
                }
            });

            /**
             * 表单提交
             */
            form.on("submit(login)", function (data) {
                console.log(data.field);
                alert(JSON.stringify(data.field));
                angelUtils.ajax("api/aloginapi/post", "post", data.field, true).done(function (response) {
                    angelLayer.greenTickMsg(response.msg, function () {
                        window.location = "/Admin/Home/";
                    })
                }).fail(function (error) {
                    console.log(error)
                });
                return false;
            });

            /**
             * 表单input组件单击时
             */
            $("#login .input-item .layui-input").click(function (e) {
                e.stopPropagation();
                $(this).addClass("layui-input-focus").find(".layui-input").focus();
            });

            /**
             * 表单input组件获取焦点时
             */
            $("#login .layui-form-item .layui-input").focus(function () {
                $(this).parent().addClass("layui-input-focus");
            });

            /**
             * 表单input组件失去焦点时
             */
            $("#login .layui-form-item .layui-input").blur(function () {
                $(this).parent().removeClass("layui-input-focus");
                if ($(this).val() != "") {
                    $(this).parent().addClass("layui-input-active");
                } else {
                    $(this).parent().removeClass("layui-input-active");
                }
            })
        });
    </script>
</body>
</html>*@



