|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>后台管理-登陆</title>
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
<meta name="format-detection" content="telephone=no">
|
|
|
<link rel="stylesheet" href="static/lib/layui-v2.6.3/css/layui.css" media="all">
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
<![endif]-->
|
|
|
<style>
|
|
|
body {background-image:url("static/images/bg.jpg");height:100%;width:100%;}/* 设置整个页面的背景图片 */
|
|
|
#container{height:100%;width:100%;}
|
|
|
input:-webkit-autofill {-webkit-box-shadow:inset 0 0 0 1000px #fff;background-color:transparent;}/* 将背景颜色设置为透明 */
|
|
|
.admin-login-background {width:300px;height:300px;position:absolute;left:50%;top:40%;margin-left:-150px;margin-top:-100px;}/* 设置登录背景*/
|
|
|
.admin-header {text-align:center;margin-bottom:20px;color:#ffffff;font-weight:bold;font-size:40px}/* 文本设置 */
|
|
|
.admin-input {border-top-style:none;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;height:50px;width:300px;padding-bottom:0px;} /* 边框设置 */
|
|
|
.admin-input::-webkit-input-placeholder {color:#a78369}/* 设置输入字段占位符的颜色 */
|
|
|
.layui-icon-username {color:#a78369 !important;} /* 强制设置用户名图标的颜色 */
|
|
|
.layui-icon-username:hover {color:#9dadce !important;}/* 鼠标悬停时强制设置用户名图标的颜色 */
|
|
|
.layui-icon-password {color:#a78369 !important;}/* 强制设置密码图标的颜色 */
|
|
|
.layui-icon-password:hover {color:#9dadce !important;}/* 鼠标悬停时强制设置密码图标的颜色 */
|
|
|
.admin-input-username {border-top-style:solid;border-radius:10px 10px 0 0;}
|
|
|
.admin-input-verify {border-radius:0 0 10px 10px;}/* 设置圆角:左上和右上0,左下和右下10px */
|
|
|
.admin-button {margin-top:20px;font-weight:bold;font-size:18px;width:300px;height:50px;border-radius:5px;background-color:#a78369;border:1px solid #d8b29f}
|
|
|
.admin-icon {margin-left:260px;margin-top:10px;font-size:30px;}
|
|
|
i {position:absolute;}
|
|
|
.admin-captcha {position:absolute;margin-left:205px;margin-top:-40px;}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="container">
|
|
|
<div></div>
|
|
|
<div class="admin-login-background">
|
|
|
<div class="admin-header">
|
|
|
<span>运维系统登录</span>
|
|
|
</div>
|
|
|
<form class="layui-form" action="">
|
|
|
<div>
|
|
|
<i class="layui-icon layui-icon-username admin-icon"></i>
|
|
|
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input admin-input admin-input-username" value="admin">
|
|
|
</div>
|
|
|
<div>
|
|
|
<i class="layui-icon layui-icon-password admin-icon"></i>
|
|
|
<input type="password" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input admin-input" value="123456">
|
|
|
</div>
|
|
|
|
|
|
<button class="layui-btn admin-button" lay-submit="" lay-filter="login">登 陆</button>
|
|
|
<button class="layui-btn admin-button" lay-submit="" lay-filter="register">注册</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script src="../static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
|
|
<script>
|
|
|
layui.use(['form'], function () {
|
|
|
var form = layui.form,
|
|
|
layer = layui.layer;
|
|
|
|
|
|
// 登录过期的时候,跳出ifram框架
|
|
|
if (top.location != self.location) top.location = self.location;
|
|
|
|
|
|
// 进行注册操作
|
|
|
form.on('submit(register)', function (data) {
|
|
|
window.location = '../register';
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
// 进行登录操作
|
|
|
form.on('submit(login)', function (data) {
|
|
|
data = data.field;
|
|
|
if (data.username == '') {
|
|
|
layer.msg('用户名不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
if (data.password == '') {
|
|
|
layer.msg('密码不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/api_login', // 请求的URL
|
|
|
type: 'GET', // 请求类型(GET, POST等)
|
|
|
data:{'username':data.username ,'password':data.password },
|
|
|
dataType: 'json', // 预期服务器返回的数据类型(json, xml, html等)
|
|
|
success: function(data, textStatus, jqXHR) {
|
|
|
if(data.code==0)
|
|
|
{
|
|
|
window.location = '../admin';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
layer.msg('登录失败!青检查账号密码')
|
|
|
}
|
|
|
|
|
|
},
|
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
|
// 请求失败时执行的回调函数
|
|
|
console.error('Error: ' + textStatus, errorThrown);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |