chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">评论管理</div>
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" lay-filter="search">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<select name="status">
|
||||
<option value="all">全部</option>
|
||||
<option value="1">已审核</option>
|
||||
<option value="0">待审核</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" placeholder="评论内容" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="layui-table" id="table" lay-filter="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="audit">审核</a>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['table', 'form'], function () {
|
||||
var table = layui.table, form = layui.form;
|
||||
var tableIns = table.render({
|
||||
elem: '#table',
|
||||
url: "{:url('articles/backend.comment/index')}",
|
||||
method: 'post',
|
||||
where: { status: 'all' },
|
||||
page: true,
|
||||
cols: [[
|
||||
{ field: 'id', title: 'ID', width: 70 },
|
||||
{ field: 'nickname', title: '用户', width: 120 },
|
||||
{ field: 'article', title: '文章', minWidth: 160 },
|
||||
{ field: 'content', title: '内容', minWidth: 200 },
|
||||
{ field: 'status', title: '状态', width: 90, templet: function (d) { return d.status ? '已审核' : '待审'; } },
|
||||
{ field: 'create_at', title: '时间', width: 170 },
|
||||
{ title: '操作', width: 140, toolbar: '#toolbar' }
|
||||
]]
|
||||
});
|
||||
form.on('submit(search)', function (data) {
|
||||
tableIns.reload({ where: data.field, page: { curr: 1 } });
|
||||
return false;
|
||||
});
|
||||
table.on('tool(table)', function (obj) {
|
||||
if (obj.event === 'audit') {
|
||||
$.post("{:url('articles/backend.comment/audit')}", { id: obj.data.id }, function (r) { layer.msg(r.msg); if (r.code) { obj.update({ status: '已审核' }); } });
|
||||
} else if (obj.event === 'del') {
|
||||
layer.confirm('确认删除该评论?', function () {
|
||||
$.post("{:url('articles/backend.comment/delete')}", { id: obj.data.id }, function (r) { layer.msg(r.msg); if (r.code) obj.del(); });
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user