From 2e53366717ad57da1a9dd6dc71a69c078961ad74 Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Thu, 10 Aug 2017 17:21:37 +0800 Subject: [PATCH] 新闻模块,平台首页 --- application/modules/Article/views/manager/list.phtml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 54 insertions(+), 1 deletions(-) diff --git a/application/modules/Article/views/manager/list.phtml b/application/modules/Article/views/manager/list.phtml index f8807a9..b43ef88 100644 --- a/application/modules/Article/views/manager/list.phtml +++ b/application/modules/Article/views/manager/list.phtml @@ -42,6 +42,7 @@ <script> $(function () { + var config = { "dom": 'l<"#toolbar">frtip', /* @@ -100,6 +101,30 @@ ], "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){ @@ -115,16 +140,44 @@ "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> -- Gitblit v1.8.0