e7f041e5 by yangjianbin

init

1 parent b43c4392
1 <?php $this->load->view('common/header'); ?> 1 <?php $this->load->view('common/header'); ?>
2 2
3 <body> 3 <body>
4 <div class="page-container"> 4 <div class="page-container">
5 <div> 5 <div>
6 <button class="btn btn-primary radius" onclick="layer_show('添加', '<?=site_url('/config/add')?>')">添加</button> 6 <button class="btn btn-primary radius" onclick="layer_show('添加', '<?= site_url('/config/add') ?>')">添加</button>
7 </div> 7 </div>
8 8
9 <div class="body mt-20"> 9 <div class="body mt-20">
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
26 </tbody> 26 </tbody>
27 </table> 27 </table>
28 </div> 28 </div>
29 </div> 29 </div>
30 <?php $this->load->view('common/footer'); ?> 30 <?php $this->load->view('common/footer'); ?>
31 31
32 <script> 32 <script>
33 var table = $('#table').dataTable({ 33 var table = $('#table').dataTable({
34 aaSorting: [[1, "desc"]], 34 aaSorting: [[1, "desc"]],
35 serverSide: true, 35 serverSide: true,
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
44 var ret = {}, json = jQuery.parseJSON(json); 44 var ret = {}, json = jQuery.parseJSON(json);
45 ret.data = json.data || []; 45 ret.data = json.data || [];
46 var draw = getUrlParam('draw'); 46 var draw = getUrlParam('draw');
47 if(draw) { 47 if (draw) {
48 ret.draw = draw; 48 ret.draw = draw;
49 } 49 }
50 ret.recordsTotal = 0; 50 ret.recordsTotal = 0;
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
68 <button class="btn radius size-M">请选择 <i class="Hui-iconfont">&#xe6d5;</i></button>\ 68 <button class="btn radius size-M">请选择 <i class="Hui-iconfont">&#xe6d5;</i></button>\
69 <ul class="dropDown-menu menu radius box-shadow">\ 69 <ul class="dropDown-menu menu radius box-shadow">\
70 <li><a href="javascript:;" onclick="layer_show(\'编辑\', \'/index.php/config/edit/' + data + '\')">编辑</a></li>\ 70 <li><a href="javascript:;" onclick="layer_show(\'编辑\', \'/index.php/config/edit/' + data + '\')">编辑</a></li>\
71 <li><a href="javascript:;del('+data+')">删除</a></li>\ 71 <li><a href="javascript:;del(' + data + ')">删除</a></li>\
72 </ul></span>'; 72 </ul></span>';
73 } 73 }
74 }, 74 },
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
86 86
87 function del(id) { 87 function del(id) {
88 layer.confirm('确认删除', { 88 layer.confirm('确认删除', {
89 btn: ['确认','取消'], 89 btn: ['确认', '取消'],
90 title: '删除产品', 90 title: '删除产品',
91 icon: 3 91 icon: 3
92 }, function(){ 92 }, function () {
93 $.ajax({ 93 $.ajax({
94 type: 'delete', 94 type: 'delete',
95 url: apiBaseUrl + 'config/product/' + id, 95 url: apiBaseUrl + 'config/product/' + id,
...@@ -104,10 +104,12 @@ ...@@ -104,10 +104,12 @@
104 } else { 104 } else {
105 layer.msg('删除成功'); 105 layer.msg('删除成功');
106 } 106 }
107 if(!data.code) { 107 setTimeout(function () {
108 window.parent.reload(); 108 if (!data.code) {
109 window.reload();
109 layer_close(); 110 layer_close();
110 } 111 }
112 }, 500);
111 }, 113 },
112 error: function () { 114 error: function () {
113 layer.alert("请求失败") 115 layer.alert("请求失败")
...@@ -116,9 +118,10 @@ ...@@ -116,9 +118,10 @@
116 118
117 }); 119 });
118 } 120 }
121
119 function reload() { 122 function reload() {
120 table.fnDraw(); 123 table.fnDraw();
121 } 124 }
122 </script> 125 </script>
123 </body> 126 </body>
124 <html> 127 <html>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!