fix(admin): 添加管理操作错误处理及更新模板样式

- 管理后台帖子与用户审核操作中添加失败错误重定向处理
- 管理后台帖子、用户、评论删除操作中添加错误检查及提示
- 用户角色更新操作失败时添加错误重定向
- 用户封禁通知失败时添加相应错误提示
- 登录登出时session保存加入错误处理
- 讨论区上传目录创建失败时显示错误提示
- 移除admin_dashboard.html多余样式及修正侧边栏当前页高亮
- admin_posts.html和admin_users.html添加状态样式动态使用的隐藏span元素
- admin_users.html为角色选择添加label以提升无障碍性
- 升级项目依赖版本,包含gin、gorm、validator等核心库版本更新
This commit is contained in:
2026-02-24 21:14:55 +08:00
parent ddec422813
commit 690b4d5961
26 changed files with 290 additions and 199 deletions

View File

@@ -46,9 +46,6 @@
.dropdown a:hover { background: var(--surface-light); }
.theme-toggle { background: var(--surface-light); border: none; color: var(--text); font-size: 1.3rem; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.theme-toggle:hover { background: var(--accent); color: var(--surface); }
.success-message, .error-message { padding: 12px 20px; border-radius: 8px; margin-bottom: 20px; }
.success-message { background: var(--primary); color: white; }
.error-message { background: #ff6b6b; color: white; }
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 25px; margin-bottom: 30px; display: flex; gap: 25px; flex-wrap: wrap; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background: var(--gradient); overflow: hidden; display: flex; align-items: center; justify-content: center; color: white; font-size: 2.5rem; font-weight: 600; flex-shrink: 0; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
@@ -85,7 +82,7 @@
.footer a:hover { color: var(--accent); }
</style>
</head>
<body>
<body class="dark-mode">
<div class="container">
<div class="header">
<div class="logo">lv8girl<span>绿坝娘</span></div>
@@ -135,6 +132,7 @@
</form>
</div>
{{else}}
<!--suppress HtmlUnknownTarget-->
<a href="/send-message?to={{.User.ID}}" class="edit-btn" style="margin-top:10px;">📩 发送私信</a>
{{end}}
</div>
@@ -187,8 +185,11 @@
themeToggle.textContent = document.body.classList.contains('dark-mode') ? '☀️' : '🌓';
});
function toggleUpload() {
var form = document.getElementById('uploadForm');
form.style.display = form.style.display === 'none' ? 'block' : 'none';
/** @type {HTMLElement|null} */
const form = document.getElementById('uploadForm');
if (form instanceof HTMLElement) {
form.style.display = form.style.display === 'none' ? 'block' : 'none';
}
}
</script>
</body>