| | |
| | | 文章管理 |
| | | </h1> |
| | | <ol class="breadcrumb"> |
| | | <li><a href="#"><i class="fa fa-dashboard"></i> 平台首页</a></li> |
| | | <li><a href="#">文章管理</a></li> |
| | | <li><a href="/admin/index/index"><i class="fa fa-dashboard"></i> 平台首页</a></li> |
| | | <li><a href="/article/manager/list">文章管理</a></li> |
| | | <li class="active">文章列表</li> |
| | | </ol> |
| | | </section> |
| | |
| | | |
| | | <script> |
| | | $(function () { |
| | | |
| | | var config = { |
| | | "dom": 'l<"#toolbar">frtip', |
| | | /* |
| | |
| | | ], |
| | | "columnDefs": [ |
| | | { |
| | | "targets":1, |
| | | "searchable":false, |
| | | "render":function(data, type, row, meta){ |
| | | if(data == 0) { |
| | | return "未选择分类"; |
| | | } |
| | | else if(data == 1){ |
| | | return "平台通知"; |
| | | } |
| | | else if(data == 2){ |
| | | return "行业资讯"; |
| | | } |
| | | else if(data == 3){ |
| | | return "防辐射知识"; |
| | | } |
| | | else if(data == 4){ |
| | | return "母婴知识"; |
| | | } |
| | | else{ |
| | | return ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "targets":2, |
| | | "searchable":false, |
| | | "render":function(data, type, row, meta){ |
| | |
| | | "targets":4, |
| | | "searchable":false, |
| | | "render":function(data, type, row, meta){ |
| | | return '<a class="btn btn-primary" href="/<?php echo $route['module']?>/<?php echo $route['controller']?>/edit/id/'+row['_id']+'">编辑</a>' |
| | | return '<a class="btn btn-primary" href="/<?php echo $route['module']?>/<?php echo $route['controller']?>/edit/id/'+row['_id']+'">编辑</a> <a class="btn btn-danger del" data-id="'+row['_id']+'" data-target="/<?php echo $route['module']?>/<?php echo $route['controller']?>/del">删除</a>' |
| | | } |
| | | } |
| | | ], |
| | | "initComplete": function(){ |
| | | $("#toolbar").css("width", "100px").css("display", "inline").css("margin-left", "10px"); |
| | | $("#toolbar").append('<a id="build" class="btn btn-success" data-toggle="modal" data-target="" href="/<?php echo $route['module']?>/<?php echo $route['controller']?>/add"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加 <a> '); |
| | | $(".del").bind('click', function(){ |
| | | if(confirm('您确定要删除这条信息?')){ |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: $(this).data('target'), |
| | | data: {id:$(this).data('id')}, |
| | | success:function(response){ |
| | | var dataObj=jQuery.parseJSON(response); |
| | | if(dataObj.code == 200) |
| | | { |
| | | $.scojs_message('删除成功', $.scojs_message.TYPE_OK); |
| | | setTimeout(function(){window.location.href = "/<?php echo $route['module']?>/<?php echo $route['controller']?>/<?php echo $route['action']?>";}, 600); |
| | | }else |
| | | { |
| | | $.scojs_message(dataObj.content, $.scojs_message.TYPE_ERROR); |
| | | } |
| | | }, |
| | | error: function (request, status, error) { |
| | | $.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR); |
| | | } |
| | | }); |
| | | } |
| | | else{ |
| | | return false; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | $("#table_list").DataTable(config); |
| | | |
| | | |
| | | }); |
| | | </script> |