nk-lihaink-cn/app/admin/view/slide/slide_info.html
2021-01-30 20:59:12 +08:00

114 lines
2.6 KiB
HTML

{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-content">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<a class="layui-btn layui-btn-normal layui-btn-sm" href="/admin/slide/slide_info_add?sid={$slide_id}">添加轮播</a>
</div>
</script>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" href="/admin/slide/slide_info_add?id={{d.id}}">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var slide_id = '{$slide_id}';
function init(layui) {
var table = layui.table,
form = layui.form;
var tableIns = table.render({
elem: '#test',
title: '轮播列表',
toolbar: '#toolbarDemo',
url: '/admin/slide/slide_info_list', //数据接口
where: {
id: slide_id
},
page: false, //开启分页
cols: [
[
{
field: 'id',
title: 'ID号',
align: 'center',
width: 80
}, {
field: 'sort',
title: '排序',
width: 80
}, {
field: 'title',
title: '标题',
width: 300
}, {
field: 'desc',
title: '描述'
}, {
field: 'status',
title: '状态',
toolbar: '#status',
align: 'center',
width: 80
}, {
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 120,
align: 'center'
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
//console.log(obj)
if (obj.event === 'del') {
layer.confirm('确定删除该轮播数据吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/admin/slide/slide_info_delete",
data: {
id: data.id
},
success: function(res) {
layer.msg(res.msg);
if (res.code == 1) {
obj.del();
}
}
})
layer.close(index);
});
}
});
//监听返回
$('.body-content').on('click', '[lay-event="back"]', function () {
history.back(-1);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->