|
@@ -6,7 +6,7 @@ |
|
@@ -6,7 +6,7 @@ |
6
|
<li class="active"><a href="#">分类管理</a></li>
|
6
|
<li class="active"><a href="#">分类管理</a></li>
|
7
|
<li ><a href="{:url('Label/lab_list')}">标签管理</a></li>
|
7
|
<li ><a href="{:url('Label/lab_list')}">标签管理</a></li>
|
8
|
</ul>
|
8
|
</ul>
|
9
|
- <button type="button" class="btn btn-default" style="margin-top: 10px;" data-toggle="modal" data-target="#myModal">添加分类</button>
|
9
|
+ <a href="{:url('Label/classify_add')}"><button type="button" class="btn btn-default" style="margin-top: 10px;">添加分类</button></a>
|
10
|
<table class="table table-bordered">
|
10
|
<table class="table table-bordered">
|
11
|
<caption>分类管理列表</caption>
|
11
|
<caption>分类管理列表</caption>
|
12
|
<thead>
|
12
|
<thead>
|
|
@@ -22,7 +22,7 @@ |
|
@@ -22,7 +22,7 @@ |
22
|
<td>{$vo.name}</td>
|
22
|
<td>{$vo.name}</td>
|
23
|
<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
|
23
|
<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
|
24
|
<td>
|
24
|
<td>
|
25
|
- <button type="button" class="btn btn-default" data-toggle="modal" data-target="#myeditModal" onclick="myedit({$vo.id})">编辑</button>
|
25
|
+ <button type="button" class="btn btn-default">编辑</button>
|
26
|
<button type="button" class="btn btn-default" onclick="del({$vo.id})">删除</button>
|
26
|
<button type="button" class="btn btn-default" onclick="del({$vo.id})">删除</button>
|
27
|
</td>
|
27
|
</td>
|
28
|
</tr>
|
28
|
</tr>
|
|
@@ -30,99 +30,9 @@ |
|
@@ -30,99 +30,9 @@ |
30
|
</tbody>
|
30
|
</tbody>
|
31
|
</table>
|
31
|
</table>
|
32
|
</div>
|
32
|
</div>
|
33
|
-<!-- 添加模态框(Modal) -->
|
|
|
34
|
-<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
|
35
|
- <div class="modal-dialog">
|
|
|
36
|
- <div class="modal-content">
|
|
|
37
|
- <div class="modal-header">
|
|
|
38
|
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
39
|
- <h4 class="modal-title" id="myModalLabel">添加分类</h4>
|
|
|
40
|
- </div>
|
|
|
41
|
- <div class="modal-body">
|
|
|
42
|
- <div style="padding: 10px 100px 10px;">
|
|
|
43
|
- <form class="bs-example bs-example-form" role="form">
|
|
|
44
|
- <div class="input-group">
|
|
|
45
|
- <span class="input-group-addon">分类名称:</span>
|
|
|
46
|
- <input type="text" class="form-control" name="name">
|
|
|
47
|
- </div>
|
|
|
48
|
- <br>
|
|
|
49
|
- </form>
|
|
|
50
|
- </div>
|
|
|
51
|
- </div>
|
|
|
52
|
- <div class="modal-footer">
|
|
|
53
|
- <button type="button" class="btn btn-default guanbi" data-dismiss="modal">关闭</button>
|
|
|
54
|
- <button type="button" class="btn btn-primary" onclick="mysave()">保存</button>
|
|
|
55
|
- </div>
|
|
|
56
|
- </div><!-- /.modal-content -->
|
|
|
57
|
- </div><!-- /.modal -->
|
|
|
58
|
-</div>
|
|
|
59
|
-
|
|
|
60
|
-<!-- 编辑模态框(Modal) -->
|
|
|
61
|
-<div class="modal fade" id="myeditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
|
62
|
- <div class="modal-dialog">
|
|
|
63
|
- <div class="modal-content">
|
|
|
64
|
- <div class="modal-header">
|
|
|
65
|
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
66
|
- <h4 class="modal-title" id="myModalLabel">编辑</h4>
|
|
|
67
|
- </div>
|
|
|
68
|
- <div class="modal-body">
|
|
|
69
|
- <div style="padding: 10px 100px 10px;">
|
|
|
70
|
- <form class="bs-example bs-example-form" role="form">
|
|
|
71
|
- <div class="input-group">
|
|
|
72
|
- <span class="input-group-addon">分类名称:</span>
|
|
|
73
|
- <input type="text" class="form-control" name="edit_name">
|
|
|
74
|
- <input type="hidden" name="id" value="">
|
|
|
75
|
- </div>
|
|
|
76
|
- <br>
|
|
|
77
|
- </form>
|
|
|
78
|
- </div>
|
|
|
79
|
- </div>
|
|
|
80
|
- <div class="modal-footer">
|
|
|
81
|
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
|
|
82
|
- <button type="button" class="btn btn-primary" onclick="edit_post()">保存</button>
|
|
|
83
|
- </div>
|
|
|
84
|
- </div><!-- /.modal-content -->
|
|
|
85
|
- </div><!-- /.modal -->
|
|
|
86
|
-</div>
|
|
|
87
|
|
33
|
|
88
|
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
|
34
|
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
|
89
|
<script>
|
35
|
<script>
|
90
|
- //添加分类保存
|
|
|
91
|
- function mysave(){
|
|
|
92
|
- name = $("input[name='name']").val();
|
|
|
93
|
- if(name == ''){
|
|
|
94
|
- alert('分类名称不能为空');
|
|
|
95
|
- }else{
|
|
|
96
|
- $.post("{:url('Label/classify_add')}",{name:name},function(data){
|
|
|
97
|
- if(data){
|
|
|
98
|
- shuju = JSON.parse(data);
|
|
|
99
|
- $('.tb').append("<tr class='tr"+shuju.id+"'><td>"+name+"</td><td>"+shuju.create_time+"</td><td><button type='button' class='btn btn-default' data-toggle='modal' data-target='#myeditModal' onclick='myedit("+shuju.id+")'>编辑</button><button type='button' class='btn btn-default' onclick='del("+shuju.id+")'>删除</button></td></tr>");
|
|
|
100
|
- $('.guanbi').trigger('click');
|
|
|
101
|
- }else{
|
|
|
102
|
- alert('添加失败');
|
|
|
103
|
- }
|
|
|
104
|
- });
|
|
|
105
|
- }
|
|
|
106
|
- }
|
|
|
107
|
-
|
|
|
108
|
- //编辑分类
|
|
|
109
|
- function myedit(id){
|
|
|
110
|
- $.post("{:url('Label/classify_edit')}",{id:id},function(data){
|
|
|
111
|
- shuju = JSON.parse(data);
|
|
|
112
|
- $("input[name='edit_name']").val(shuju.name);
|
|
|
113
|
- $("input[name='id']").val(shuju.id);
|
|
|
114
|
- })
|
|
|
115
|
- }
|
|
|
116
|
-
|
|
|
117
|
- //编辑修改分类
|
|
|
118
|
- function edit_post(){
|
|
|
119
|
- name = $("input[name='edit_name']").val();
|
|
|
120
|
- id = $("input[name='id']").val();
|
|
|
121
|
- $.post("{:url('Label/classify_edit_post')}",{name:name,id:id},function(data){
|
|
|
122
|
- window.location.reload();
|
|
|
123
|
- });
|
|
|
124
|
- }
|
|
|
125
|
-
|
|
|
126
|
//删除
|
36
|
//删除
|
127
|
function del(id){
|
37
|
function del(id){
|
128
|
ccc = window.confirm('是否删除这条分类?');
|
38
|
ccc = window.confirm('是否删除这条分类?');
|