<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link href="/login/Public/css/bootstrap.min.css" rel="stylesheet">

<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->

</head>

<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">某管理系统</a>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">首页</a></li>
<li><a href="#">帮助</a></li>
</ul>
<form name="form" class="navbar-form navbar-right" role="from" action="<?php echo U('checkLogin');?>" autocomplete="off">
<div class="form-group">
<input type="text" name="username" class="form-control" placeholder="用户名...">
<input type="text" name="password" class="form-control" placeholder="密码...">
</div>
<button type="submit" class="btn btn-default">登录</button>
</form>
</div>
</div>
</nav>
<script src="/login/Public/js/jquery-2.1.1.min.js"></script>
<script src="/login/Public/static/layer/layer.js"></script>
<script src="/login/Public/js/bootstrap.min.js"></script>
<!--ajax异步提交-->
<!--ajax异步提交-->
<script>
    $('form').submit(function(){
        var username  = $("input[name='username']").val();
        var password  = $("input[name='password']").val();
        var url  = $(this).attr('action');
        if(!username){
            layer.msg('用户名不能为空！',{time:2000});
            return false;
        }
        if(!password){
            layer.msg('url',{time:2000});
            return false;
        }

        $.ajax({
            type:"post",
            url :checkLog,
            data:{username:username,password:password},
            success: function(res){
                if(res.status){
                    layer.msg(res.message,{time:1000},function(){
                        window.location.href = "<?php echo U('Index/index');?>";
                    });
                }else{
                    //刷新验证码
                    $(".reloadverify").click();
                    layer.msg(res.message,{time:2000});
                }
            }
        });
        return false;
    });
</script>

</body>
</html>