refactor(plugins): 将导航/友链/关于/统计 4 模块迁出 framework 至 plugins
- 在 applications/config.py 中通过 PLUGIN_ENABLE_FOLDERS 启用 4 个业务插件
- 删除 framework 内 applications/view/system/nav.py 与 templates/system/nav/* 模板
- applications/extensions/init_plugs 移除重复的 broadcast_execute('event_init'/'event_finish')
(由 init_bps / init_script 触发,避免 Blueprint 注册冲突)
- applications/view/system/index.py:未登录访问 / 直接渲染前台公开聚合页
- templates/system/index.html:移动端首屏即折叠侧边栏
- 新增 5 个 model(Nav 字段 status→enable 兼容、NavCategory、About、Friend、VisitLog/PageStat、NavClick)
- 新增 2 个 schema(NavCategorySchema、FriendOutSchema/ManageSchema)
- admin_about/admin_friend/admin_nav_category 在 init.json 中以「网站管理」分组挂载
- .gitignore 补充一次性备份、调试截图、探针截图不入库
This commit is contained in:
@@ -1,177 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>导航管理</title>
|
||||
{% include 'system/common/header.html' %}
|
||||
</head>
|
||||
<body class="layui-layout-body pear-admin">
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
{% include 'system/common/head.html' %}
|
||||
{% include 'system/common/side.html' %}
|
||||
<div class="layui-body">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-icon layui-icon-link"></span> 导航管理
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal" style="float:right;margin-top:-6px;"
|
||||
lay-event="add" id="btn-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i> 新增导航
|
||||
</button>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" lay-filter="search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键词</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="keyword" placeholder="标题/链接/简介" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">分类</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="category" placeholder="按分类过滤" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="search">搜索</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="nav-table" lay-filter="nav-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'system/common/footer.html' %}
|
||||
</div>
|
||||
|
||||
{% raw %}
|
||||
<script type="text/html" id="col-status">
|
||||
{{# if(d.status === 1){ }}
|
||||
<span class="layui-badge layui-bg-green">启用</span>
|
||||
{{# } else { }}
|
||||
<span class="layui-badge layui-bg-gray">禁用</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="col-external">
|
||||
{{# if(d.is_external === 1){ }}
|
||||
<span class="layui-badge layui-bg-blue">外链</span>
|
||||
{{# } else { }}
|
||||
<span class="layui-badge">站内</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="col-op">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{{# if(d.status === 1){ }}
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="disable">禁用</a>
|
||||
{{# } else { }}
|
||||
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="enable">启用</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="remove">删除</a>
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<script>
|
||||
layui.use(['table', 'form', 'layer'], function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.$;
|
||||
|
||||
var renderTable = function(){
|
||||
var keyword = $('input[name="keyword"]').val();
|
||||
var category = $('input[name="category"]').val();
|
||||
table.render({
|
||||
elem: '#nav-table',
|
||||
url: '/system/nav/data',
|
||||
where: { keyword: keyword, category: category },
|
||||
page: true,
|
||||
limit: 20,
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 60},
|
||||
{field: 'category', title: '分类', width: 120},
|
||||
{field: 'title', title: '标题', width: 180},
|
||||
{field: 'url', title: '链接', minWidth: 200},
|
||||
{field: 'icon', title: '图标', width: 100},
|
||||
{field: 'sort', title: '排序', width: 70},
|
||||
{field: 'is_external', title: '类型', width: 80, templet: '#col-external'},
|
||||
{field: 'status', title: '状态', width: 80, templet: '#col-status'},
|
||||
{field: 'create_at', title: '创建时间', width: 170},
|
||||
{fixed: 'right', title: '操作', toolbar: '#col-op', width: 220}
|
||||
]],
|
||||
response: {
|
||||
statusCode: 200
|
||||
},
|
||||
parseData: function(res){
|
||||
return {
|
||||
code: res.success ? 0 : 1,
|
||||
msg: res.msg,
|
||||
count: res.count || 0,
|
||||
data: res.data || []
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
renderTable();
|
||||
|
||||
form.on('submit(search)', function(data){
|
||||
renderTable();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btn-add').on('click', function(){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增导航',
|
||||
area: ['640px', '600px'],
|
||||
content: '/system/nav/add'
|
||||
});
|
||||
});
|
||||
|
||||
table.on('tool(nav-table)', function(obj){
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit'){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑导航',
|
||||
area: ['640px', '600px'],
|
||||
content: '/system/nav/edit?navId=' + data.id
|
||||
});
|
||||
} else if (obj.event === 'remove'){
|
||||
layer.confirm('确定删除该导航吗?', function(idx){
|
||||
$.ajax({
|
||||
url: '/system/nav/remove/' + data.id,
|
||||
type: 'DELETE',
|
||||
success: function(res){
|
||||
if (res.success) { layer.msg(res.msg); obj.del(); }
|
||||
else layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
layer.close(idx);
|
||||
});
|
||||
} else if (obj.event === 'enable'){
|
||||
$.ajax({
|
||||
url: '/system/nav/enable',
|
||||
type: 'PUT',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({navId: data.id}),
|
||||
success: function(res){ layer.msg(res.msg); renderTable(); }
|
||||
});
|
||||
} else if (obj.event === 'disable'){
|
||||
$.ajax({
|
||||
url: '/system/nav/disable',
|
||||
type: 'PUT',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({navId: data.id}),
|
||||
success: function(res){ layer.msg(res.msg); renderTable(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user