<%--@elvariable id="blogger" type="org.springframework.remoting.jaxws.JaxWsPortClientInterceptor"--%>
<%--@elvariable id="errorInfo" type="cn"--%>
<%--
  Created by IntelliJ IDEA.
  User: njc
  Date: 2022/5/5
  Time: 14:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录界面</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <style>
        body {
            background: #ebebeb;
            font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", "\9ED1\4F53", Arial, sans-serif;
            color: #222;
            font-size: 12px;
        }

        * {
            padding: 0;
            margin: 0;
        }

        .top_div {
            background: #008ead;
            width: 100%;
            height: 400px;
        }

        .ipt {
            border: 1px solid #d3d3d3;
            width: 330px;
            border-radius: 4px;
            padding: 10px 10px 10px 40px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
        }

        .ipt:focus {
            border-color: #66afe9;
            outline: 0;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
        }

        .u_logo {
            background: url("${pageContext.request.contextPath}/static/img/username.png") no-repeat;
            padding: 10px 10px;
            position: absolute;
            top: 43px;
            left: 50px;

        }

        .p_logo {
            background: url("${pageContext.request.contextPath}/static/img/password.png") no-repeat;
            padding: 10px 10px;
            position: absolute;
            top: 12px;
            left: 50px;
        }

        a {
            text-decoration: none;
        }

        .tou {
            background: url("${pageContext.request.contextPath}/static/img/tou.png") no-repeat;
            width: 97px;
            height: 92px;
            position: absolute;
            top: -87px;
            left: 140px;
        }

        .left_hand {
            background: url("${pageContext.request.contextPath}/static/img/left_hand.png") no-repeat;
            width: 32px;
            height: 37px;
            position: absolute;
            top: -38px;
            left: 150px;
        }

        .right_hand {
            background: url("${pageContext.request.contextPath}/static/img/right_hand.png") no-repeat;
            width: 32px;
            height: 37px;
            position: absolute;
            top: -38px;
            right: -64px;
        }

        .initial_left_hand {
            background: url("${pageContext.request.contextPath}/static/img/hand.png") no-repeat;
            width: 30px;
            height: 20px;
            position: absolute;
            top: -12px;
            left: 100px;
        }

        .initial_right_hand {
            background: url("${pageContext.request.contextPath}/static/img/hand.png") no-repeat;
            width: 30px;
            height: 20px;
            position: absolute;
            top: -12px;
            right: -112px;
        }

        .left_handing {
            background: url("${pageContext.request.contextPath}/static/img/left-handing.png") no-repeat;
            width: 30px;
            height: 20px;
            position: absolute;
            top: -24px;
            left: 139px;
        }

        .right_handinging {
            background: url("${pageContext.request.contextPath}/static/img/right_handing.png") no-repeat;
            width: 30px;
            height: 20px;
            position: absolute;
            top: -21px;
            left: 210px;
        }

    </style>
    <script type="text/javascript">
        $(function () {
            //得到焦点
            $("#password").focus(function () {
                $("#left_hand").animate({
                    left: "150",
                    top: " -38"
                }, {
                    step: function () {
                        if (parseInt($("#left_hand").css("left")) > 140) {
                            $("#left_hand").attr("class", "left_hand");
                        }
                    }
                }, 2000);
                $("#right_hand").animate({
                    right: "-64",
                    top: "-38px"
                }, {
                    step: function () {
                        if (parseInt($("#right_hand").css("right")) > -70) {
                            $("#right_hand").attr("class", "right_hand");
                        }
                    }
                }, 2000);
            });
            //失去焦点
            $("#password").blur(function () {
                $("#left_hand").attr("class", "initial_left_hand");
                $("#left_hand").attr("style", "left:100px;top:-12px;");
                $("#right_hand").attr("class", "initial_right_hand");
                $("#right_hand").attr("style", "right:-112px;top:-12px");
            });
        });

        /**
         * 用户密码验证
         */
        function checkForm() {
            var userName = $("#userName").val();
            console.log(userName);
            var password = $("#password").val();
            console.log(password);
            if (userName == null || userName === "") {
                alert("用户名不能为空！");
                return false;
            }
            if (password == null || password === "") {
                alert("密码不能为空！");
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
<div class="top_div"></div>
<form action="${pageContext.request.contextPath}/blogger/login.do" method="post" onsubmit="return checkForm()">
    <div style="width: 400px;height: 200px;background: #ffffff;text-align: center;margin: -100px auto auto;border: 1px solid #e7e7e7">
        <div style="width: 165px;height: 96px;position: absolute">
            <div class="tou"></div>
            <div id="left_hand" class="initial_left_hand"></div>
            <div id="right_hand" class="initial_right_hand"></div>
        </div>

        <p style="padding: 30px 0 10px 0;position: relative;">
            <span class="u_logo"></span>
            <input class="ipt" type="text" name="userName" id="userName" placeholder="请输入用户名或邮箱" value="${blogger.userName}">
        </p>
        <p style="position: relative;">
            <span class="p_logo"></span>
            <input id="password" class="ipt" name="password" type="password" placeholder="请输入密码" value="${blogger.password}">
        </p>

        <div style="height: 50px;line-height: 50px;margin-top: 30px;border-top: 1px solid #e7e7e7;">
            <p style="margin: 0 35px 20px 45px;">
                <span style="float: left"><a href="${pageContext.request.contextPath}/index.jsp" style="color:#ccc;">返回主页</a></span>
                <span><font color="red" id="error">${errorInfo}</font></span>
                <span style="float: right">
                    <a href="#" style="color:#ccc;margin-right:10px;">注册</a>
                    <button type="submit" style="background: #008ead;padding: 7px 10px;border-radius: 4px;border: 1px solid #1a7598;color: #FFF;font-weight: bold;">登录</button>
                </span>
            </p>
        </div>
    </div>
</form>
</body>
</html>
