409 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			409 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\configlist.php";i:1747370938;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
 | |
| <!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;">
 | |
| <style>
 | |
| 	.config-container {
 | |
|         padding: 20px;
 | |
|         background-color: #fff;
 | |
|         border-radius: 8px;
 | |
|         /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); */
 | |
|     }
 | |
|     .config-header {
 | |
|         display: flex;
 | |
|         align-items: center;
 | |
|         margin-bottom: 30px;
 | |
|         padding-bottom: 15px;
 | |
|         border-bottom: 1px solid #eee;
 | |
|     }
 | |
|     .config-header span {
 | |
|         font-size: 18px;
 | |
|         color: #2c3e50;
 | |
|         font-weight: 500;
 | |
|         margin-right: 20px;
 | |
|     }
 | |
|     .config-header a {
 | |
|         text-decoration: none;
 | |
|     }
 | |
|     .config-header a span {
 | |
|         padding: 6px 15px;
 | |
|         background: #f8f9fa;
 | |
|         border-radius: 4px;
 | |
|         color: #606266;
 | |
|         font-size: 14px;
 | |
|         transition: all 0.3s;
 | |
|     }
 | |
|     .config-header a span:hover {
 | |
|         background: #e9ecef;
 | |
|         color: #409EFF;
 | |
|     }
 | |
| 	.action-buttons {
 | |
| 		display: flex;
 | |
| 		gap: 8px;
 | |
| 		margin-bottom: 20px;
 | |
| 	}
 | |
| 	.layui-btn {
 | |
| 		border-radius: 4px;
 | |
| 		box-shadow: 0 2px 5px rgba(0,0,0,0.1);
 | |
| 		transition: all 0.3s;
 | |
| 		height: 32px;
 | |
| 		line-height: 32px;
 | |
| 		padding: 0 16px;
 | |
| 	}
 | |
| 	.layui-btn:hover {
 | |
| 		transform: translateY(-1px);
 | |
| 		box-shadow: 0 4px 8px rgba(0,0,0,0.15);
 | |
| 	}
 | |
| 	.layui-btn .layui-icon {
 | |
| 		margin-right: 4px;
 | |
| 		font-size: 14px;
 | |
| 	}
 | |
| 	.layui-table {
 | |
| 		margin: 15px 0;
 | |
| 		border-radius: 4px;
 | |
| 		overflow: hidden;
 | |
| 	}
 | |
| 	.layui-table thead tr {
 | |
| 		background-color: #fafafa;
 | |
| 	}
 | |
| 	.layui-table tbody tr:hover {
 | |
| 		background-color: #f5f7fa;
 | |
| 	}
 | |
| 	.layui-table-cell {
 | |
| 		height: 40px;
 | |
| 		line-height: 40px;
 | |
| 	}
 | |
| 	.layui-badge {
 | |
| 		padding: 4px 8px;
 | |
| 		border-radius: 3px;
 | |
| 		font-weight: 500;
 | |
| 		height: auto;
 | |
| 	}
 | |
| 	.layui-badge.layui-bg-green {
 | |
| 		background-color: #67C23A !important;
 | |
| 	}
 | |
| 	.layui-badge.layui-bg-gray {
 | |
| 		background-color: #909399 !important;
 | |
| 	}
 | |
| 	.layui-layer {
 | |
| 		border-radius: 8px;
 | |
| 		overflow: hidden;
 | |
| 	}
 | |
| </style>
 | |
| 
 | |
| <div class="config-container">
 | |
| 	<div class="config-header">
 | |
|         <span>站点管理</span>
 | |
|         <!-- <a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/configvalue">
 | |
|             <span>站点配置</span>
 | |
|         </a> -->
 | |
|     </div>
 | |
| 
 | |
| 
 | |
| 	<div class="layui-card-body" style="padding: 0;">
 | |
| 		<div class="action-buttons">
 | |
| 			<button type="button" class="layui-btn layui-btn-normal" id="btn-add">
 | |
| 				<i class="layui-icon layui-icon-add-1"></i>添加
 | |
| 			</button>
 | |
| 			<button type="button" class="layui-btn layui-btn-normal" id="btn-edit">
 | |
| 				<i class="layui-icon layui-icon-edit"></i>修改
 | |
| 			</button>
 | |
| 			<button type="button" class="layui-btn layui-btn-danger" id="btn-del">
 | |
| 				<i class="layui-icon layui-icon-delete"></i>删除
 | |
| 			</button>
 | |
| 		</div>
 | |
| 		<table class="layui-table" id="lists" lay-filter="lists"></table>
 | |
| 	</div>
 | |
| </div>
 | |
| 
 | |
| <script type="text/javascript">
 | |
| 	layui.use(['layer', 'table', 'element'], function () {
 | |
| 		var table = layui.table;
 | |
| 		var layer = layui.layer;
 | |
| 		var element = layui.element;
 | |
| 		var $ = layui.jquery;
 | |
| 
 | |
| 		// 初始化表格
 | |
| 		function initTable() {
 | |
| 			table.render({
 | |
| 				elem: '#lists',
 | |
| 				method: 'post',
 | |
| 				url: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzer/configlist",
 | |
| 				title: '配置列表',
 | |
| 				page: true,
 | |
| 				skin: 'line',
 | |
| 				even: true,
 | |
| 				size: 'lg',
 | |
| 				cols: [[
 | |
| 					{ type: 'radio', fixed: 'left', width: 50 },
 | |
| 					{ field: 'config_id', width: 80, title: 'ID', sort: true, align: 'center' },
 | |
| 					{ field: 'config_sort', width: 120, title: '排序', sort: true, align: 'center' },
 | |
| 					{ field: 'config_name', width: 150, title: '关键词' },
 | |
| 					{ field: 'config_info', width: 150, title: '作用' },
 | |
| 					{ field: 'config_desc', minWidth: 300, title: '说明' },
 | |
| 					{
 | |
| 						field: 'config_status', width: 100, title: '状态', align: 'center', templet: function (res) {
 | |
| 							if (res.config_status == 1) {
 | |
| 								return '<span class="layui-badge layui-bg-green">开启</span>';
 | |
| 							} else {
 | |
| 								return '<span class="layui-badge layui-bg-gray">关闭</span>';
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 				]],
 | |
| 				limit: 15,
 | |
| 				limits: [15, 30, 50, 100],
 | |
| 				height: 'full-180'
 | |
| 			});
 | |
| 		}
 | |
| 
 | |
| 		// 加载表格数据
 | |
| 		initTable();
 | |
| 
 | |
| 		// 行点击事件
 | |
| 		table.on('row(lists)', function (obj) {
 | |
| 			obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
 | |
| 			obj.tr.find("div.layui-unselect.layui-form-radio")[0].click();
 | |
| 		});
 | |
| 
 | |
| 		// 添加按钮事件
 | |
| 		$('#btn-add').on('click', function () {
 | |
| 			layer.open({
 | |
| 				title: '<i class="layui-icon layui-icon-add-1"></i> 添加配置',
 | |
| 				type: 2,
 | |
| 				content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd',
 | |
| 				maxmin: true,
 | |
| 				area: ['700px', '550px'],
 | |
| 				skin: 'layui-layer-molv',
 | |
| 				btn: ['确定', '取消'],
 | |
| 				yes: function (index, layero) {
 | |
| 					var form = layero.find('iframe')[0].contentWindow;
 | |
| 					var button = {
 | |
| 						config_name: form.config_name.value,
 | |
| 						config_info: form.config_info.value,
 | |
| 						config_type: form.config_type.value,
 | |
| 						config_desc: form.config_desc.value,
 | |
| 						config_sort: form.config_sort.value,
 | |
| 						config_status: form.config_status.value
 | |
| 					};
 | |
| 
 | |
| 					var loadIndex = layer.load(1, {
 | |
| 						shade: [0.1,'#fff']
 | |
| 					});
 | |
| 
 | |
| 					$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd', button, function (res) {
 | |
| 						layer.close(loadIndex);
 | |
| 						if (res.code > 0) {
 | |
| 							layer.msg(res.msg, { icon: 2, time: 2000 });
 | |
| 						} else {
 | |
| 							layer.msg(res.msg, { icon: 1, time: 1000 });
 | |
| 							initTable();
 | |
| 							layer.close(index);
 | |
| 						}
 | |
| 					}, 'json');
 | |
| 				}
 | |
| 			});
 | |
| 		});
 | |
| 
 | |
| 		// 编辑按钮事件
 | |
| 		$('#btn-edit').on('click', function () {
 | |
| 			var checkStatus = table.checkStatus('lists');
 | |
| 			var data = checkStatus.data;
 | |
| 
 | |
| 			if (data.length === 0) {
 | |
| 				layer.msg('请选择一条数据进行编辑', { icon: 0 });
 | |
| 				return;
 | |
| 			}
 | |
| 
 | |
| 			layer.open({
 | |
| 				title: '<i class="layui-icon layui-icon-edit"></i> 修改配置',
 | |
| 				type: 2,
 | |
| 				content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit?config_id=' + data[0].config_id,
 | |
| 				maxmin: true,
 | |
| 				area: ['700px', '550px'],
 | |
| 				skin: 'layui-layer-molv',
 | |
| 				btn: ['确定', '取消'],
 | |
| 				yes: function (index, layero) {
 | |
| 					var form = layero.find('iframe')[0].contentWindow;
 | |
| 					var button = {
 | |
| 						config_id: data[0].config_id,
 | |
| 						config_name: form.config_name.value,
 | |
| 						config_info: form.config_info.value,
 | |
| 						config_type: form.config_type.value,
 | |
| 						config_desc: form.config_desc.value,
 | |
| 						config_sort: form.config_sort.value,
 | |
| 						config_status: form.config_status.value
 | |
| 					};
 | |
| 
 | |
| 					var loadIndex = layer.load(1, {
 | |
| 						shade: [0.1,'#fff']
 | |
| 					});
 | |
| 
 | |
| 					$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit', button, function (res) {
 | |
| 						layer.close(loadIndex);
 | |
| 						if (res.code > 0) {
 | |
| 							layer.msg(res.msg, { icon: 2, time: 2000 });
 | |
| 						} else {
 | |
| 							layer.msg(res.msg, { icon: 1, time: 1000 });
 | |
| 							initTable();
 | |
| 							layer.close(index);
 | |
| 						}
 | |
| 					}, 'json');
 | |
| 				}
 | |
| 			});
 | |
| 		});
 | |
| 
 | |
| 		// 删除按钮事件
 | |
| 		$('#btn-del').on('click', function () {
 | |
| 			var checkStatus = table.checkStatus('lists');
 | |
| 			var data = checkStatus.data;
 | |
| 
 | |
| 			if (data.length === 0) {
 | |
| 				layer.msg('请选择一条数据进行删除', { icon: 0 });
 | |
| 				return;
 | |
| 			}
 | |
| 
 | |
| 			layer.confirm('确定要删除该配置吗?', {
 | |
| 				icon: 3,
 | |
| 				title: '删除确认',
 | |
| 				skin: 'layui-layer-molv',
 | |
| 				btn: ['确定', '取消']
 | |
| 			}, function () {
 | |
| 				var loadIndex = layer.load(1, {
 | |
| 					shade: [0.1,'#fff']
 | |
| 				});
 | |
| 
 | |
| 				$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configdel', { 'config_id': data[0].config_id }, function (res) {
 | |
| 					layer.close(loadIndex);
 | |
| 					if (res.code > 0) {
 | |
| 						layer.msg(res.msg, { icon: 2, time: 2000 });
 | |
| 					} else {
 | |
| 						layer.msg(res.msg, { icon: 1, time: 1000 });
 | |
| 						initTable();
 | |
| 					}
 | |
| 				}, 'json');
 | |
| 			});
 | |
| 		});
 | |
| 	});
 | |
| </script>
 | |
| 	</body>
 | |
| </html>
 | |
| <script type="text/javascript">
 | |
| 	// 显示图片
 | |
| 	function show_img(obj){
 | |
| 		var imgurl = $(obj).attr('src');
 | |
| 		var res = getMousePos();
 | |
| 		var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
 | |
| 				<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
 | |
| 			</div>';
 | |
| 		$('body').append(html);
 | |
| 	}
 | |
| 	// 隐藏图片
 | |
| 	function hide_img(){
 | |
| 		$('#preview').remove();
 | |
| 	}
 | |
| 	// 图片位置计算
 | |
| 	function getMousePos(event) {
 | |
| 		var e = event || window.event;
 | |
| 		var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
 | |
| 		var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
 | |
| 		var x = e.pageX || e.clientX + scrollX;
 | |
| 		var y = e.pageY || e.clientY + scrollY;
 | |
| 		return { 'x': x, 'y': y };
 | |
| 	}
 | |
| 	// 删除图片
 | |
| 	function deleteImage(path,obj){
 | |
| 		$(obj).closest('.upload_pic_li').remove();
 | |
| 	}
 | |
| </script>
 |