码农笔录博客源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 rivejä
2.4 KiB

6 vuotta sitten
{{template "header"}}
<title>登录 - 个人随笔</title>
<link type="text/css" rel="styleSheet" href="/static/css/login.css"/>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
<div class="login-root">
<div class="input-container">
<div class="input-root">
<p>登录</p>
6 vuotta sitten
<div class="inputs-class">
<div class="input-group input-group-lg input-class">
<span class="input-group-addon" id="sizing-addon1">用户</span>
<input type="text" class="form-control" placeholder="请输入用户名" aria-describedby="sizing-addon1"
id="username">
</div>
<div class="input-group input-group-lg input-class">
<span class="input-group-addon" id="sizing-addon1">密码</span>
<input type="password" class="form-control" placeholder="请输入密码" aria-describedby="sizing-addon1"
id="userpwd">
</div>
<button type="button" class="btn btn-primary btn-lg btn-bordered btn-block" id="loginBtn">登录
</button>
</div>
6 vuotta sitten
</div>
</div>
<div class="login-footer">
{{template "footer"}}
</div>
6 vuotta sitten
</div>
</div>
</body>
6 vuotta sitten
<script>
$(function () {
$("#loginBtn").click(function () {
var username = $("#username").val()
var userpwd = $("#userpwd").val()
if (username.trim().length < 4) {
layer.msg('用户名最低4位', function () {
});
return
}
if (userpwd.trim().length < 6) {
layer.msg('密码最低6位', function () {
});
return
}
$.post('/login', {
username: username,
userpwd: userpwd
},
function (data) {
console.log(data)
if (data.Status == 1) {
layer.msg(data.Msg, {icon: 5});
}else{
layer.msg("登录成功", {icon: 6});
window.location.href = "/"
6 vuotta sitten
}
}, 'json')
})
})
</script>
6 vuotta sitten
</html>