创建了管理后台

This commit is contained in:
Yutousama 2020-06-23 17:33:56 +08:00
parent d2b2e8d262
commit 75c563c714
4 changed files with 237 additions and 0 deletions

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>头部编辑
</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div id="side"></div>
<div class="layui-body" style="left: 250px; top: 100px;">
<button id="button">test</button>
<div id="test1"></div>
</div>
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
var inst1
var tree
var myData = [{
title: 'ROOT' //一级菜单
, id: 1
, checked: false
}]
layui.use(['layer', 'form', 'element', 'tree'], function () {
var layer = layui.layer
, form = layui.form;
var element = layui.element;
tree = layui.tree;
var index=1;
inst1 = tree.render({
elem: '#test1' //绑定元素
, edit: ['add', 'update', 'del']
, data: myData
, id: 'myData'
, showCheckbox: false
, operate: function (obj) {
var type = obj.type; //得到操作类型add、update、del
var data = obj.data; //得到当前节点的数据
var elem = obj.elem; //得到当前节点元素
if(type==='add'){
++index;
return index;
}else if(type==='update'){
console.log(JSON.stringify(data))
console.log(JSON.stringify(elem))
}else{
}
}
});
});
$('#header').load("/admin/html/header.html");
$('#side').load("/admin/html/side.html");
$('#footer').load("/html/footer.html");
$('#button').click(function () {
layer.msg(JSON.stringify(tree.getChecked('myData')))
})
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</body>
</html>

View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="layui-header">
<div class="layui-logo">管理后台</div>
<ul class="layui-nav layui-layout-left" lay-filter="">
<li class="layui-nav-item" >
<a href="javascript:;"><img src="//t.cn/RCzsdCq" class="layui-nav-img"><span
id='login_text'>登录</span></a>
<dl class="layui-nav-child">
<dd><a href="javascript:;" id="logout">退了</a></dd>
</dl>
</li>
</ul>
</div>
</body>
<script>
let loginStatus = false;
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code == 0) {
$('#login_text').text('已登录')
loginStatus = true;
}
})
$('#login').click(function () {
if (loginStatus) {
return;
}
$.post('/login/sendCaptcha.do', function () {
layer.prompt({
title: '安全登录码'
}, function (value, index, elem) {
$.post('/login/login.do', { code: value }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
window.location.reload()
});
layer.close(index);
})
})
})
$('#logout').click(function () {
$.post('/login/logout.do', function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
window.location.href = "/"
})
})
// $(document).ready(function () {
// let mobile = navigator.userAgent.toLowerCase().match(/android/i) == "android" || navigator.userAgent.toLowerCase().match(/iphone os/i) == "iphone os";
// if (mobile) {
// $('.layui-body').css('left', '0')
// $('.layui-body').css('top', '150px')
// $('.layui-body').css('height', '200%')
// $('#icon').css('float', 'none')
// } else {
// $('.layui-body').css('padding-right', '100px')
// $('#icon').css('float', 'none')
// }
// })
</script>
<style>
</style>
</html>

34
web/admin/html/side.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll ">
<!-- 左侧导航区域可配合layui已有的垂直导航 -->
<ul class="layui-nav layui-nav-tree" lay-filter="test">
<li class="layui-nav-item layui-nav-itemed">
<a class="" href="javascript:;">标题栏</a>
<dl class="layui-nav-child">
<dd><a href="/admin/html/body/header_edit.html">编辑</a></dd>
<dd><a href="javascript:;">权限</a></dd>
</dl>
</li>
<li class="layui-nav-item layui-nav-itemed">
<a class="" href="javascript:;">作品管理</a>
<dl class="layui-nav-child">
<dd><a href="javascript:;">编辑/发布</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="">权限管理</a></li>
</ul>
</div>
</div>
</body>
</html>

46
web/admin/index.html Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>控制中心</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div id="side"></div>
<div class="layui-body" style="left: 200px;">
主页暂时还没想好~~~~咕!
</div>
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
layui.use(['layer', 'form', 'element'], function () {
var layer = layui.layer
, form = layui.form;
});
$.ajax({cache: false})
$('#header').load("/admin/html/header.html");
$('#side').load("/admin/html/side.html");
$('#footer').load("/html/footer.html");
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</body>
</html>