Files
2026-08-12 16:44:57 +08:00

121 lines
3.6 KiB
PHP

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>评论管理 - 后台 - 笔记小站</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<nav class="navbar">
<a class="navbar-brand" href="index.html"><span class="logo-icon">📝</span> 笔记小站</a>
<div class="navbar-actions" id="navbarActions"></div>
</nav>
<div class="admin-layout">
<aside class="admin-sidebar">
<nav class="admin-nav">
<a class="admin-nav-item" href="admin_categories.php">
<span>📂</span> 分类管理
</a>
<a class="admin-nav-item" href="admin_notes.php">
<span>📝</span> 笔记管理
</a>
<a class="admin-nav-item active" href="admin_comments.php">
<span>💬</span> 评论管理
</a>
<a class="admin-nav-item" href="admin_users.php">
<span>👥</span> 用户管理
</a>
</nav>
</aside>
<main class="admin-main">
<div class="admin-panel">
<div class="admin-panel-header">
<h3>💬 评论管理</h3>
</div>
<div class="admin-panel-body">
<table class="admin-table">
<thead>
<tr>
<th>ID</th>
<th>笔记</th>
<th>用户</th>
<th>内容</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<!--
========================================
后端循环输出 <tr>,示例:
<tr>
<td>1</td>
<td>如何搭建个人博客</td>
<td>test</td>
<td>写的真好!</td>
<td>2026-01-12</td>
<td class="actions">
<button class="btn btn-sm btn-danger" onclick="deleteComment(1)">删除</button>
</td>
</tr>
========================================
-->
</tbody>
</table>
</div>
</div>
</main>
</div>
<!-- ==================== 删除确认模态框 ==================== -->
<div class="modal-overlay" id="deleteModal" style="display:none;">
<div class="form-modal" onclick="event.stopPropagation()">
<h3>⚠️ 确认删除</h3>
<input type="hidden" id="deleteId" value="">
<p style="margin-bottom:16px;">确定要删除该评论吗?此操作不可恢复。</p>
<div class="form-actions">
<button class="btn" onclick="closeDeleteModal()">取消</button>
<button class="btn btn-danger" onclick="confirmDeleteComment()">确认删除</button>
</div>
</div>
</div>
<div class="toast-container" id="toastContainer"></div>
<script src="js/common.js"></script>
<script>
/* ==================== 删除评论 ==================== */
function deleteComment(id) {
document.getElementById('deleteId').value = id;
document.getElementById('deleteModal').style.display = 'flex';
}
function closeDeleteModal() {
document.getElementById('deleteModal').style.display = 'none';
}
function confirmDeleteComment() {
var id = document.getElementById('deleteId').value;
// TODO: 发送删除请求
console.log('删除评论, id:', id);
closeDeleteModal();
showToast('已删除', 'info');
// window.location.reload();
}
/* ==================== 点击遮罩关闭 ==================== */
document.getElementById('deleteModal').addEventListener('click', function(e) {
if (e.target === this) closeDeleteModal();
});
</script>
</body>
</html>