/
category-list.html
144 lines (135 loc) · 5.14 KB
/
category-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>栏目列表</title>
<base href="{{ base_path() }}">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<link rel="stylesheet" href="theme/admin/assets/layui/css/layui.css">
<link rel="stylesheet" href="theme/admin/assets/css/style.css">
</head>
<body>
<div class="tab-body">
<div class="handle-box">
<ul>
<li class="handle-item"><a href="javascript:;" onclick="categoryAdd();" class="layui-btn btn-add btn-default" id="btn-addcategory"><i class="linyer icon-add"></i> 添加栏目</a></li>
</ul>
</div>
<table class="layui-table" id="userTable">
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>链接</th>
<th>权重排序</th>
<th>启用</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{!! $cats_list !!}
</tbody>
</table>
<input id="iframe_status" value="" hidden="hidden">
</div>
<script src="theme/admin/assets/layui/layui.js"></script>
<script>
function categoryAdd(cid) {
layui.use(['layer'], function() {
var $ = layui.jquery;
var layer = layui.layer;
var index = layer.open({
title: '新建栏目',
type: 2,
area: ['800px', '590px'],
fix: false, //不固定
maxmin: true,
content: "admin/category/add?cid=" + cid,
success: function(layero, index) {},
end: function() {
var iframe_status = $("#iframe_status").val();
if (iframe_status == '1') {
layer.msg('新建成功!', {
icon: 1,
time: 1000,
shade: 0.1
}, function() {
location.reload();
});
} else if (iframe_status == '0') {
layer.msg('新建失败!', {
icon: 5
});
}
}
});
layer.full(index);
});
}
function categoryEdit(cid) {
layui.use(['layer'], function() {
var $ = layui.jquery;
var layer = layui.layer;
var index = layer.open({
title: '栏目编辑',
type: 2,
area: ['800px', '590px'],
fix: false, //不固定
maxmin: true,
content: "admin/category/edit/" + cid,
success: function(layero, index) {},
end: function() {
var iframe_status = $("#iframe_status").val();
if (iframe_status == '1') {
layer.msg('编辑成功!', {
icon: 1,
time: 1000,
shade: 0.1
}, function() {
location.reload();
});
} else if (iframe_status == '0') {
layer.msg('没有编辑内容', {
icon: 5
});
} else if (iframe_status == '') {}
}
});
layer.full(index);
});
}
function categoryDel(cid) {
layui.use(['layer'], function() {
var $ = layui.jquery;
var layer = layui.layer;
layer.confirm('确定删除此栏目?', {
icon: 3,
title: '栏目删除'
}, function(index) {
$.ajax({
type: "GET",
url: "admin/category/del/" + cid,
success: function(msg) {
if (msg) { //如果成功了
layer.msg('删除成功', {
icon: 1,
time: 1000,
shade: 0.1
}, function() {
location.reload();
});
} else {
layer.msg('删除失败', {
icon: 5
});
}
}
});
});
});
}
</script>
</body>
</html>