<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="/static/css/login.css" />
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
</head>

<body class="login">
    <div class="login_m">
        <div class="login_logo">
            <img src="/static/img/logo.png" width="196" height="46">
        </div>
        <div class="login_boder">
            <div class="login_padding" id="login_model">
                <form id="login_form" method="POST">
                    <div class="username">
                        <h2>USERNAME</h2>
                        <label>
                            <input type="text" id="username" name="username" class="txt_input" placeholder="your username">
                        </label>
                    </div>
                    <div class="password">
                        <h2>PASSWORD</h2>
                        <label>
                            <input type="password" id="userpwd" name="password" class="txt_input" placeholder="the password">
                        </label>
                    </div>
                    <div class="forgot_password">
                        <h2>
                            <a href="javascript:void(0);" onclick="getPwd();">Forgot your password?</a>
                        </h2>
                        <label>
                            <span class="fspan"></span>
                        </label>
                    </div>
                    <div class="button">
                        <label>
                            <a href="javascript:void(0);" id="button" class="sub_button">登&nbsp;陆</a>
                            <!-- <input type="submit" class="sub_button"  id="button" value="登陆" style="opacity: 0.7;"> -->
                        </label>
                    </div>
                </form>
            </div>
            <!--login_padding  Sign up end-->
        </div>
        <!--login_boder end-->
        <div class="copyrights">Collect from
            <a href="#">huwhois@163.com</a>
        </div>
    </div>
    <!--login_m end-->

    <script type="text/javascript">
        $(function () {
            $('#button').css('opacity', 0.7).hover(function () {
                $(this).stop().fadeTo(650, 1);
            }, function () {
                $(this).stop().fadeTo(650, 0.7);
            });

            $("#button").click(function () {
                var uname = $("#username").val();
                var upwd = $("#userpwd").val();

                $.post('/dologin', {
                   'username' :  uname,
                   'password' :  upwd,
                }, function(res){
                    console.log(res);
                    if (res.code == 0) {
                        window.location.href = "/index";
                    } else {
                        alert(res.msg);
                    }
                    return false;
                }, 'json');
            });
        });

        function KeyDown() {
            if (event.keyCode == 13) {
                event.returnValue = false;
                event.cancel = true;
                $("#button").click();
            }
        }

        function getPwd() {
            $('.fspan').html("* 请联系网站管理员");
        }
    </script>

</body>

</html>