94 lines
4.1 KiB
HTML
94 lines
4.1 KiB
HTML
|
|
<div class="layui-card" style="margin:20px;">
|
|
<div class="layui-card-header">插件审核(开发者上架申请)</div>
|
|
<div class="layui-card-body">
|
|
<div class="layui-form layui-row" style="margin-bottom:12px;">
|
|
<div class="layui-inline">
|
|
<select id="statusFilter">
|
|
<option value="">全部状态</option>
|
|
<option value="0">待审核</option>
|
|
<option value="1">已发布</option>
|
|
<option value="2">已驳回</option>
|
|
</select>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="layui-btn" id="searchBtn">搜索</button>
|
|
</div>
|
|
</div>
|
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/html" id="toolTpl">
|
|
{{# if(d.status == 0){ }}
|
|
<a class="layui-btn layui-btn-xs" lay-event="audit">通过</a>
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="reject">驳回</a>
|
|
{{# } else { }}
|
|
<span class="layui-badge {{ d.status == 1 ? 'layui-bg-green' : '' }}">
|
|
{{ d.status == 1 ? '已发布' : '已驳回' }}
|
|
</span>
|
|
{{# } }}
|
|
</script>
|
|
|
|
<script>
|
|
layui.use(['table', 'jquery', 'layer'], function () {
|
|
var table = layui.table, $ = layui.jquery, layer = layui.layer;
|
|
table.render({
|
|
elem: '#dataTable',
|
|
url: '{:url("/appmall/backend/addonreview/index")}',
|
|
page: true,
|
|
response: { statusName: 'code', msgName: 'message', countName: 'count', dataName: 'data' },
|
|
parseData: function (res) {
|
|
return {
|
|
code: res.code,
|
|
msg: res.message,
|
|
count: res.count || 0,
|
|
data: res.data || []
|
|
};
|
|
},
|
|
where: { status: $('#statusFilter').val() },
|
|
cols: [[
|
|
{field: 'id', title: 'ID', width: 70},
|
|
{field: 'title', title: '插件名称', width: 160},
|
|
{field: 'name', title: '标识', width: 140},
|
|
{field: 'version', title: '版本', width: 90},
|
|
{field: 'developer_id', title: '开发者ID', width: 100},
|
|
{field: 'price', title: '价格', width: 90, templet: function(d){return d.price ? d.price : '免费';}},
|
|
{field: 'status', title: '状态', width: 90, templet: function(d){
|
|
if(d.status==0) return '<span class="layui-badge">待审核</span>';
|
|
if(d.status==1) return '<span class="layui-badge layui-bg-green">已发布</span>';
|
|
return '<span class="layui-badge layui-bg-red">已驳回</span>';
|
|
}},
|
|
{field: 'reject_reason', title: '驳回原因', width: 160},
|
|
{field: 'create_at', title: '提交时间', width: 170, templet: function(d){return layui.util.toDateString(d.create_at*1000);}},
|
|
{title: '操作', width: 160, templet: '#toolTpl', fixed: 'right'}
|
|
]]
|
|
});
|
|
|
|
$('#searchBtn').on('click', function () {
|
|
table.reload('dataTable', { where: { status: $('#statusFilter').val() }, page: { curr: 1 } });
|
|
});
|
|
|
|
table.on('tool(dataTable)', function (obj) {
|
|
var d = obj.data;
|
|
if (obj.event === 'audit') {
|
|
layer.confirm('确认通过该插件上架申请?', function (index) {
|
|
$.post('{:url("/appmall/backend/addonreview/audit")}', { id: d.id }, function (r) {
|
|
layer.msg(r.msg || '操作完成');
|
|
if (r.code === 0) { table.reload('dataTable'); }
|
|
layer.close(index);
|
|
}, 'json');
|
|
});
|
|
} else if (obj.event === 'reject') {
|
|
layer.prompt({ title: '填写驳回原因', formType: 2 }, function (val, index) {
|
|
$.post('{:url("/appmall/backend/addonreview/reject")}', { id: d.id, reason: val }, function (r) {
|
|
layer.msg(r.msg || '操作完成');
|
|
if (r.code === 0) { table.reload('dataTable'); }
|
|
layer.close(index);
|
|
}, 'json');
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|