摘要:{include file="/public/head"}<body><div class="x-nav"> <span class="layui-breadcrumb"> <a href="&
{include file="/public/head"}
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<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">
<xblock>
<button class="layui-btn" onclick="x_admin_show('添加用户','{:url(\'News/add\')}')"><i class="layui-icon"></i>添加</button>
<span class="x-right" style="line-height:40px">共有数据:条</span>
</xblock>
<table class="layui-table">
<thead>
<tr>
<!--<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon"></i></div>
</th>-->
<th>新闻ID</th>
<th>标题</th>
<th>图片</th>
<th>简介</th>
<th>发布人</th>
<th>发布日期</th>
<th >操作</th>
</tr>
</thead>
<tbody>
{volist name="new" id="news"}
<tr>
<!-- <td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'>
<i class="layui-icon"></i></div>
</td>-->
<td>{$news.id}</td>
<td>{$news.title}</td>
<td><img src="#"></td>
<td>{$news.desc}</td>
<td>{$news.username}</td>
<td>{$news.time|date="Y-m-d"}</td>
<td class="td-manage">
<a title="编辑" onclick="x_admin_show('编辑','{:url(\'News/edit\')}?id={$news.id}')" href="javascript:;">
<i class="layui-icon"></i>
</a>
<a title="删除" onclick="member_del(this,'{$news.id}')" href="javascript:;">
<i class="layui-icon"></i>
</a>
</td>
</tr>
{/volist}
</tbody>
</table>
<div class="page">
<div>
{$new|raw}
</div>
</div>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$.get('{:url(\'del\')}','id='+id,function(data){
if(data.res ==1){
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
}
})
});
}
</script>
</body>
</html>
批改老师:韦小宝批改时间:2019-01-04 09:15:48
老师总结:写的还可以!要多动手多动脑!多研究!这样才能进步的快!