feat(admin): 替换alert为Swal弹窗并优化样式

refactor: 统一代码缩进和格式化
style: 优化CSS样式和代码可读性
This commit is contained in:
2025-07-12 13:50:38 +08:00
parent 84f52e05b3
commit 5b009b838b
12 changed files with 332 additions and 265 deletions

View File

@@ -17,14 +17,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$stmt = $conn->prepare('INSERT INTO announcements (title, content, admin_id) VALUES (?, ?, ?)');
$stmt->bind_param('ssi', $title, $content, $admin_id);
if ($stmt->execute()) {
header('Location: announcements.php?success=公告发布成功');
echo '<script>Swal.fire("成功", "公告发布成功", "success").then(() => { window.location.reload(); });</script>';
exit;
} else {
$error = '公告发布失败: ' . $conn->error;
echo '<script>Swal.fire("错误", "公告发布失败: ' . $conn->error . '", "error");</script>';
}
$stmt->close();
} else {
$error = '标题和内容不能为空';
echo '<script>Swal.fire("错误", "标题和内容不能为空", "error");</script>';
}
}