123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <!--加载公共头部文件-->
- {include file='Base/top'}
- <!--加载公共左侧文件-->
- {include file='Base/left'}
- <!--加载公共底部文件-->
- {include file='Base/fotter'}
- <!-- 内容主体区域 -->
- <div class="layui-body">
- <!--面包屑导航-->
- <blockquote class="layui-elem-quote">
- <span class="layui-breadcrumb" style="visibility: visible;">
- <a >栏目管理</a>
- <span lay-separator="">/</span>
- <a href="{:url('Column/lst')}">
- <cite>栏目列表</cite>
- </a>
- </span>
- </blockquote>
- <!--面包屑导航 结束-->
- <div >
- <button class="layui-btn layui-btn-normal layui-btn-xs" id="add">
- <i class="layui-icon"></i>添加
- </button>
- <button class="layui-btn layui-btn-normal layui-btn-xs" id="up">
- <i class="layui-icon"></i> 更新排序
- </button>
- </div>
- <form class="layui-form" action="{:url('Column/sort')}" method="post" id="vo_form">
- <table class="layui-table" id="deleteds">
- <thead>
- <tr width="100">
- <th width="6%" style="text-align: center;">栏目ID</th>
- <th width="10%" style="text-align: center;">栏目名称</th>
- <th width="10%" style="text-align: center;">权重</th>
- <th width="30">操作</th>
- </tr>
- </thead>
- <tbody>
-
- {volist name='list' id='vo'}
- <tr>
- <td align="center">{$vo.id}</td>
- <td align="center">{$vo.catename}</td>
- <td>
- <input type="text" class="layui-input x-sort" name="sort[{$vo['id']}]" value="{$vo.sort}">
- </td>
- <td>
- <div class="layui-btn-group">
- <a class="layui-btn layui-btn-xs" onclick="edit({$vo['id']})" >
- <i class="layui-icon"></i>编辑
- </a>
- <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- </td>
- </tr>
- {/volist}
- </tbody>
- </table>
- <!-- 分页 -->
- <div class="pages" style="text-align:center;">
- <div class="plist" >{$list->render()}</div>
- </div>
- </form>
- </div>
- <!-- 内容主体区域 结束-->
- <script>
- layui.use(['table','layer','laypage','jquery'], function(){
- var table = layui.table,
- layer = layui.layer,
- laypage = layui.laypage,
- $ = layui.jquery;
- //点击添加
- $("#add").click(function () {
- layer.open({
- type: 2, //open类型
- title: false, //新开窗口标题 无
- offset: 'auto', //上下左右居中
- area: ['800px','700px'], //新开add页面窗口大小
- content: '{:url("column/add")}', //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
- end: function () {
- location.reload();
- }
- });
- });
- //更新排序
- $("#up").click(function () {
- $.ajax({
- type:'post',
- url:'{:url("sort")}',
- data: $('#vo_form').serialize(), //获取表单提交的所有数据
- success: function(data) {
- layer.msg('规则排序成功!',{time:1000,icon: 1},function () {
- location.reload(true);//刷新当前页面
- });
- },
- error: function(err) {
- layer.msg(err, {time:1000,icon: 2},function () {
- location.reload(true);//刷新当前页面
- });
- }
- });
- })
- //删除
- $('.delete').click(function(){
- var id = $(this).attr('id');
- layer.confirm('确定要删除?',{icon: 5}, function(index) {
- $.ajax({
- url:"{:url('admin/Column/del')}?id="+id,
- data:{id:id},
- success:function(res) {
- layer.msg(res.msg);
- if(res.data == 200) {
- setTimeout(function(){
- window.location.reload();
- },1000)
- }
- }
- })
- })
- })
- });
- </script>
- <script type="text/javascript">
- //点击编辑
- function edit($id) {
- layer.open({
- type: 2, //open类型
- title: false, //新开窗口标题 无
- offset: 'auto', //上下左右居中
- area: ['800px','700px'], //新开add页面窗口大小
- content: '{:url("edit")}?id='+$id, //这里content是一个URL,传递要编辑的参数
- end: function () {
- location.reload();
- }
- });
- };
-
- </script>
|