135 lines
4.7 KiB
HTML
135 lines
4.7 KiB
HTML
{include file="public/header" /}
|
|
<body>
|
|
<div class="x-nav">
|
|
<span class="layui-breadcrumb">
|
|
<a href="">首页</a>
|
|
<a><cite>快捷回复管理</cite></a>
|
|
</span>
|
|
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
|
|
<i class="layui-icon" style="line-height:30px">ဂ</i></a>
|
|
</div>
|
|
<div class="x-body">
|
|
<div class="layui-row">
|
|
<form class="layui-form layui-col-md12 x-so" method="get">
|
|
<div class="layui-input-inline">
|
|
<select name="category">
|
|
<option value="">全部分类</option>
|
|
{volist name="categories" id="cat"}
|
|
<option value="{$cat}" {if condition="isset($get['category']) && $get['category'] == $cat"}selected{/if}>{$cat}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
<div class="layui-input-inline">
|
|
<select name="status">
|
|
<option value="">全部状态</option>
|
|
<option value="1" {if condition="isset($get['status']) && $get['status'] == '1'"}selected{/if}>启用</option>
|
|
<option value="0" {if condition="isset($get['status']) && $get['status'] == '0'"}selected{/if}>禁用</option>
|
|
</select>
|
|
</div>
|
|
<button class="layui-btn" type="submit"><i class="layui-icon"></i></button>
|
|
</form>
|
|
</div>
|
|
<xblock>
|
|
<button class="layui-btn" onclick="x_admin_show('添加快捷回复','/chat_quick_reply/add',600,400)">
|
|
<i class="layui-icon"></i>添加
|
|
</button>
|
|
</xblock>
|
|
<table class="layui-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>分类</th>
|
|
<th>标题</th>
|
|
<th>内容</th>
|
|
<th>排序</th>
|
|
<th>状态</th>
|
|
<th>创建时间</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{volist name="list" id="vo"}
|
|
<tr>
|
|
<td>{$vo.id}</td>
|
|
<td>{$vo.category|default='无'}</td>
|
|
<td>{$vo.title}</td>
|
|
<td style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="{$vo.content}">{$vo.content}</td>
|
|
<td>
|
|
<input type="text" class="layui-input" value="{$vo.sort}"
|
|
onchange="updateSort({$vo.id}, this.value)"
|
|
style="width: 60px; display: inline-block;">
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" name="status" lay-skin="switch" lay-text="启用|禁用"
|
|
{eq name="vo.status" value="1"}checked{/eq}
|
|
onchange="updateStatus({$vo.id}, this.checked ? 1 : 0)">
|
|
</td>
|
|
<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
|
|
<td class="td-manage">
|
|
<a title="编辑" onclick="x_admin_show('编辑','/chat_quick_reply/edit?id={$vo.id}',600,400)" href="javascript:;">
|
|
<i class="layui-icon"></i>
|
|
</a>
|
|
<a title="删除" onclick="member_del(this,'{$vo.id}')" href="javascript:;">
|
|
<i class="layui-icon"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{/volist}
|
|
</tbody>
|
|
</table>
|
|
<div class="page">
|
|
{$list->render()}
|
|
</div>
|
|
</div>
|
|
<script>
|
|
layui.use(['form', 'layer'], function(){
|
|
var form = layui.form;
|
|
var layer = layui.layer;
|
|
|
|
form.render();
|
|
});
|
|
|
|
// 删除
|
|
function member_del(obj, id){
|
|
layer.confirm('确认要删除吗?', function(index){
|
|
$.ajax({
|
|
url: '/chat_quick_reply/del',
|
|
type: 'POST',
|
|
data: {id: id},
|
|
success: function(res){
|
|
if(res.code == 0){
|
|
$(obj).parents("tr").remove();
|
|
layer.msg('删除成功', {icon: 1, time: 1000});
|
|
} else {
|
|
layer.msg(res.msg, {icon: 2, time: 1000});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// 更新状态
|
|
function updateStatus(id, status){
|
|
$.post('/chat_quick_reply/status', {id: id, status: status}, function(res){
|
|
if(res.code == 0){
|
|
layer.msg('操作成功', {icon: 1, time: 1000});
|
|
} else {
|
|
layer.msg(res.msg, {icon: 2, time: 1000});
|
|
}
|
|
});
|
|
}
|
|
|
|
// 更新排序
|
|
function updateSort(id, sort){
|
|
$.post('/chat_quick_reply/sort', {id: id, sort: sort}, function(res){
|
|
if(res.code == 0){
|
|
layer.msg('操作成功', {icon: 1, time: 1000});
|
|
} else {
|
|
layer.msg(res.msg, {icon: 2, time: 1000});
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|