更新若干代码
This commit is contained in:
@@ -132,7 +132,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="">请选择分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@@ -166,7 +166,7 @@
|
||||
data.field.content = content;
|
||||
|
||||
$.ajax({
|
||||
url: '{:url("article/add")}',
|
||||
url: '{:url("articles/add")}',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
@@ -174,7 +174,7 @@
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
@@ -269,6 +269,6 @@
|
||||
<script>
|
||||
//返回文章列表
|
||||
function goBack() {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}
|
||||
</script>
|
||||
@@ -44,7 +44,7 @@
|
||||
var cid = urlParams.get('cid');
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
$.post('{:url("article/cateadd")}', data.field, function (res) {
|
||||
$.post('{:url("articles/cateadd")}', data.field, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
@@ -115,7 +115,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
$.post('{:url("article/cateedit")}', data.field, function (res) {
|
||||
$.post('{:url("articles/cateedit")}', data.field, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
@@ -135,7 +135,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="">请选择分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@@ -171,7 +171,7 @@
|
||||
data.field.content = content;
|
||||
|
||||
$.ajax({
|
||||
url: '{:url("article/edit")}?id={$info.id}',
|
||||
url: '{:url("articles/edit")}?id={$info.id}',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
@@ -179,7 +179,7 @@
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
@@ -280,6 +280,6 @@
|
||||
<script>
|
||||
//返回文章列表
|
||||
function goBack() {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}
|
||||
</script>
|
||||
@@ -99,10 +99,10 @@
|
||||
<!-- 侧边菜单 -->
|
||||
<div class="layui-side layui-side-menu">
|
||||
<div class="layui-side-scroll">
|
||||
<div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<!-- <div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<img src="/static/images/logo-l-w.png" alt="{$config['admin_name']}"
|
||||
style="max-width: 100%; max-height: 100%;">
|
||||
</div>
|
||||
</div> -->
|
||||
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
||||
lay-filter="layadmin-system-side-menu">
|
||||
<!-- 固定的工作台菜单项 -->
|
||||
|
||||
@@ -316,7 +316,7 @@ function updateTime() {
|
||||
|
||||
// 获取文章统计数据
|
||||
function getArticleCounts() {
|
||||
fetch('{:url("article/counts")}')
|
||||
fetch('{:url("articles/counts")}')
|
||||
.then(response => response.json())
|
||||
.then(res => {
|
||||
console.log('文章统计接口返回数据:', res);
|
||||
|
||||
@@ -47,18 +47,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tableToolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
|
||||
<i class="layui-icon layui-icon-delete"></i> 清空日志
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tableBar">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
||||
</script>
|
||||
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'laydate'], function(){
|
||||
@@ -78,7 +66,6 @@
|
||||
elem: '#loginLogTable',
|
||||
url: '{:url("log/login")}',
|
||||
method: 'post',
|
||||
toolbar: '#tableToolbar',
|
||||
defaultToolbar: ['filter', 'exports', 'print'],
|
||||
parseData: function(res) {
|
||||
return {
|
||||
@@ -89,20 +76,19 @@
|
||||
};
|
||||
},
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 80, sort: true},
|
||||
{field: 'username', title: '用户名', width: 120},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130},
|
||||
{field: 'location', title: '登录地点', width: 120},
|
||||
{field: 'device_type', title: '设备类型', width: 100},
|
||||
{field: 'user_agent', title: '浏览器', width: 200},
|
||||
{field: 'login_status', title: '状态', width: 100, templet: function(d){
|
||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
||||
{field: 'username', title: '用户名', align: 'center'},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130, align: 'center'},
|
||||
{field: 'location', title: '登录地点', width: 120, align: 'center'},
|
||||
{field: 'device_type', title: '设备类型', width: 100, align: 'center'},
|
||||
{field: 'user_agent', title: '浏览器', width: 200, align: 'center'},
|
||||
{field: 'login_status', title: '状态', width: 100, align: 'center', templet: function(d){
|
||||
return d.login_status == 1 ?
|
||||
'<span class="layui-badge layui-bg-green">成功</span>' :
|
||||
'<span class="layui-badge layui-bg-red">失败</span>';
|
||||
}},
|
||||
{field: 'failure_reason', title: '失败原因', width: 150},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true},
|
||||
{title: '操作', toolbar: '#tableBar', width: 80, fixed: 'right'}
|
||||
{field: 'failure_reason', title: '失败原因', width: 150, align: 'center'},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true, align: 'center'}
|
||||
]],
|
||||
page: true,
|
||||
limit: 10,
|
||||
@@ -125,41 +111,6 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 监听工具条
|
||||
table.on('tool(loginLogTable)', function(obj){
|
||||
var data = obj.data;
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定删除这条日志吗?', function(index){
|
||||
$.post('{:url("log/deleteLogin")}', {id: data.id}, function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
obj.del();
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 监听头工具栏事件
|
||||
table.on('toolbar(loginLogTable)', function(obj){
|
||||
if(obj.event === 'clearAll'){
|
||||
layer.confirm('确定要清空所有登录日志吗?', function(index){
|
||||
$.post('{:url("log/clearLogin")}', function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
table.reload('loginLogTable');
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user