232 lines
		
	
	
		
			9.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			232 lines
		
	
	
		
			9.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php /*a:2:{s:67:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\articlecate.php";i:1746861621;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
 | |
| <!DOCTYPE html>
 | |
| <html>
 | |
| 	<head>
 | |
| 		<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
 | |
| 		<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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
 | |
| 		<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
 | |
| 		<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
 | |
| 		<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
 | |
| 		<style type="text/css">
 | |
| 			.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
 | |
| 			.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
 | |
| 			.header button{float:right;margin-top:-5px;}
 | |
| 			.pagination {
 | |
| 				display: inline-block;
 | |
| 				padding-left: 0;
 | |
| 				margin: 20px 0;
 | |
| 				border-radius: 4px;
 | |
| 			}
 | |
| 			.pagination > li {
 | |
| 				display: inline;
 | |
| 			}
 | |
| 			.pagination > li > a,
 | |
| 			.pagination > li > span {
 | |
| 				position: relative;
 | |
| 				float: left;
 | |
| 				padding: 6px 12px;
 | |
| 				margin-left: -1px;
 | |
| 				line-height: 1.42857143;
 | |
| 				color: #337ab7;
 | |
| 				text-decoration: none;
 | |
| 				background-color: #fff;
 | |
| 				border: 1px solid #ddd;
 | |
| 			}
 | |
| 			.pagination > li:first-child > a,
 | |
| 			.pagination > li:first-child > span {
 | |
| 				margin-left: 0;
 | |
| 				border-top-left-radius: 4px;
 | |
| 				border-bottom-left-radius: 4px;
 | |
| 			}
 | |
| 			.pagination > li:last-child > a,
 | |
| 			.pagination > li:last-child > span {
 | |
| 				border-top-right-radius: 4px;
 | |
| 				border-bottom-right-radius: 4px;
 | |
| 			}
 | |
| 			.pagination > li > a:hover,
 | |
| 			.pagination > li > span:hover,
 | |
| 			.pagination > li > a:focus,
 | |
| 			.pagination > li > span:focus {
 | |
| 				z-index: 2;
 | |
| 				color: #23527c;
 | |
| 				background-color: #eee;
 | |
| 				border-color: #ddd;
 | |
| 			}
 | |
| 			.pagination > .active > a,
 | |
| 			.pagination > .active > span,
 | |
| 			.pagination > .active > a:hover,
 | |
| 			.pagination > .active > span:hover,
 | |
| 			.pagination > .active > a:focus,
 | |
| 			.pagination > .active > span:focus {
 | |
| 				z-index: 3;
 | |
| 				color: #fff;
 | |
| 				cursor: default;
 | |
| 				background-color: #337ab7;
 | |
| 				border-color: #337ab7;
 | |
| 			}
 | |
| 			.pagination > .disabled > span,
 | |
| 			.pagination > .disabled > span:hover,
 | |
| 			.pagination > .disabled > span:focus,
 | |
| 			.pagination > .disabled > a,
 | |
| 			.pagination > .disabled > a:hover,
 | |
| 			.pagination > .disabled > a:focus {
 | |
| 				color: #777;
 | |
| 				cursor: not-allowed;
 | |
| 				background-color: #fff;
 | |
| 				border-color: #ddd;
 | |
| 			}
 | |
| 			.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
 | |
| 		</style>
 | |
| 		<script type="text/javascript" src="/static/layui/layui.js"></script>
 | |
| 		<script type="text/javascript">
 | |
| 			layui.use(['layer','form','table','laydate','element','upload'],function(){
 | |
| 				layer = layui.layer;		// layui 弹框
 | |
| 				form = layui.form;			// layui form表单
 | |
| 				table = layui.table;		// layui 表格
 | |
| 				laydate = layui.laydate;	// layui 时间框
 | |
| 				element = layui.element;	// layui element
 | |
| 				upload = layui.upload;		// layui 上传
 | |
| 				$ = layui.jquery;			// layui jquery
 | |
| 			})
 | |
| 		</script>
 | |
| 	</head>
 | |
| 	<body style="padding:10px; box-sizing: border-box;">
 | |
| <div class="config-container">
 | |
|     <div class="config-header" style="display:flex;justify-content: space-between;">
 | |
|         <div>
 | |
|             <span>文章分类列表</span>
 | |
|         </div>
 | |
|         <div>
 | |
|             <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
 | |
|                 <i class="layui-icon layui-icon-add-1"></i>添加
 | |
|             </button>
 | |
|             <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="refresh()">
 | |
|                 <i class="layui-icon layui-icon-refresh"></i>刷新
 | |
|             </button>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     <table class="layui-table">
 | |
|         <thead>
 | |
|             <tr>
 | |
|                 <th width="20">ID</th>
 | |
|                 <th width="120">分类名称</th>
 | |
|                 <th width="120">分类图片</th>
 | |
|                 <th>描述</th>
 | |
|                 <th width="80">排序</th>
 | |
|                 <th width="80">状态</th>
 | |
|                 <th width="180">创建时间</th>
 | |
|                 <th width="240">操作</th>
 | |
|             </tr>
 | |
|         </thead>
 | |
|         <tbody>
 | |
|             <?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;if($vo['cid'] == 0): ?>
 | |
|             <tr>
 | |
|                 <td><?php echo htmlentities((string) $vo['id']); ?></td>
 | |
|                 <td><?php echo htmlentities((string) $vo['name']); ?></td>
 | |
|                 <td><img src="<?php echo htmlentities((string) $vo['image']); ?>" style="width: 100px;height: auto;"></td>
 | |
|                 <td></td><?php echo htmlentities((string) $vo['desc']); ?></td>
 | |
|                 <td><?php echo htmlentities((string) $vo['sort']); ?></td>
 | |
|                 <td><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
 | |
|                 <td><?php echo htmlentities((string) $vo['create_time']); ?></td>
 | |
|                 <td>
 | |
|                     <button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
 | |
|                         onclick="addchanel(<?php echo htmlentities((string) $vo['id']); ?>)">
 | |
|                         <i class="layui-icon layui-icon-add-1"></i>添加子栏目
 | |
|                     </button>
 | |
|                     <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['id']); ?>)">
 | |
|                         <i class="layui-icon layui-icon-edit"></i>编辑
 | |
|                     </button>
 | |
|                     <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del(<?php echo htmlentities((string) $vo['id']); ?>)">
 | |
|                         <i class="layui-icon layui-icon-delete"></i>删除
 | |
|                     </button>
 | |
|                 </td>
 | |
|             </tr>
 | |
|             <?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub): $mod = ($i % 2 );++$i;if($sub['cid'] == $vo['id']): ?>
 | |
|             <tr>
 | |
|                 <td><?php echo htmlentities((string) $sub['id']); ?></td>
 | |
|                 <td style="padding-left: 30px;">├─ <?php echo htmlentities((string) $sub['name']); ?></td>
 | |
|                 <td><img src="<?php echo htmlentities((string) $sub['image']); ?>" style="width: 100px;height: auto;"></td>
 | |
|                 <td><?php echo htmlentities((string) $sub['desc']); ?></td>
 | |
|                 <td><?php echo htmlentities((string) $sub['sort']); ?></td>
 | |
|                 <td><?php echo $sub['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
 | |
|                 <td><?php echo htmlentities((string) $sub['create_time']); ?></td>
 | |
|                 <td>
 | |
|                     <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $sub['id']); ?>)">
 | |
|                         <i class="layui-icon layui-icon-edit"></i>编辑
 | |
|                     </button>
 | |
|                     <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del(<?php echo htmlentities((string) $sub['id']); ?>)">
 | |
|                         <i class="layui-icon layui-icon-delete"></i>删除
 | |
|                     </button>
 | |
|                 </td>
 | |
|             </tr>
 | |
|             <?php endif; ?>
 | |
|             <?php endforeach; endif; else: echo "" ;endif; ?>
 | |
|             <?php endif; ?>
 | |
|             <?php endforeach; endif; else: echo "" ;endif; ?>
 | |
|         </tbody>
 | |
|     </table>
 | |
| </div>
 | |
| 
 | |
| <script type="text/javascript">
 | |
|     layui.use(['layer'], function () {
 | |
|         layer = layui.layer;
 | |
|         $ = layui.jquery;
 | |
|     });
 | |
| 
 | |
|     function add() {
 | |
|         layer.open({
 | |
|             type: 2,
 | |
|             title: '添加分类',
 | |
|             shadeClose: true,
 | |
|             shade: 0.8,
 | |
|             area: ['800px', '600px'],
 | |
|             content: '<?php echo url("article/cateadd"); ?>'
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     function edit(id) {
 | |
|         layer.open({
 | |
|             type: 2,
 | |
|             title: '编辑分类',
 | |
|             shadeClose: true,
 | |
|             shade: 0.8,
 | |
|             area: ['800px', '800px'],
 | |
|             content: '<?php echo url("article/cateedit"); ?>?id=' + id
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     function del(id) {
 | |
|         layer.confirm('确定要删除该分类吗?', {
 | |
|             btn: ['确定', '取消']
 | |
|         }, function () {
 | |
|             $.post('<?php echo url("article/catedel"); ?>', { id: id }, function (res) {
 | |
|                 if (res.code == 0) {
 | |
|                     layer.msg(res.msg, { icon: 1 });
 | |
|                     setTimeout(function () {
 | |
|                         window.location.reload();
 | |
|                     }, 1000);
 | |
|                 } else {
 | |
|                     layer.msg(res.msg, { icon: 2 });
 | |
|                 }
 | |
|             });
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     function addchanel(id) {
 | |
|         layer.open({
 | |
|             type: 2,
 | |
|             title: '添加子栏目',
 | |
|             shadeClose: true,
 | |
|             shade: 0.8,
 | |
|             area: ['800px', '600px'],
 | |
|             content: '<?php echo url("article/cateadd"); ?>?cid=' + id
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     function refresh() {
 | |
|         window.location.reload();
 | |
|     }
 | |
| </script>
 |