- 管理后台帖子与用户审核操作中添加失败错误重定向处理 - 管理后台帖子、用户、评论删除操作中添加错误检查及提示 - 用户角色更新操作失败时添加错误重定向 - 用户封禁通知失败时添加相应错误提示 - 登录登出时session保存加入错误处理 - 讨论区上传目录创建失败时显示错误提示 - 移除admin_dashboard.html多余样式及修正侧边栏当前页高亮 - admin_posts.html和admin_users.html添加状态样式动态使用的隐藏span元素 - admin_users.html为角色选择添加label以提升无障碍性 - 升级项目依赖版本,包含gin、gorm、validator等核心库版本更新
101 lines
5.9 KiB
HTML
101 lines
5.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>发表新帖 - lv8girl</title>
|
||
<style>
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
:root {
|
||
--bg: #f0f7f0;
|
||
--surface: #ffffff;
|
||
--surface-light: #e8f0e8;
|
||
--border: #d0e0d0;
|
||
--text: #2c3e2c;
|
||
--text-soft: #5f6b5f;
|
||
--text-hint: #8f9f8f;
|
||
--primary: #3d9e4a;
|
||
--accent: #ffb347;
|
||
--gradient: linear-gradient(135deg, #3d9e4a, #5a9cff);
|
||
}
|
||
body.dark-mode {
|
||
--bg: #1a1e1a;
|
||
--surface: #1e261e;
|
||
--surface-light: #2a3a2a;
|
||
--border: #2a3a2a;
|
||
--text: #e0e8e0;
|
||
--text-soft: #b0bcb0;
|
||
--text-hint: #8a958a;
|
||
--primary: #6b8e6b;
|
||
--accent: #ffb347;
|
||
}
|
||
body { background: var(--bg); color: var(--text); font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; line-height: 1.6; transition: background 0.3s, color 0.3s; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
|
||
.post-wrapper { max-width: 800px; width: 100%; }
|
||
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
|
||
.logo { font-size: 2rem; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
|
||
.logo span { font-size: 0.9rem; background: var(--accent); color: var(--surface); padding: 4px 12px; border-radius: 30px; margin-left: 10px; -webkit-text-fill-color: var(--surface); }
|
||
.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); }
|
||
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 30px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); }
|
||
.post-card h2 { font-size: 1.8rem; font-weight: 600; color: var(--accent); margin-bottom: 25px; text-align: center; }
|
||
.error-message { background: var(--surface-light); border-left: 4px solid #ff6b6b; color: var(--text-soft); padding: 12px 15px; border-radius: 8px; margin-bottom: 20px; }
|
||
.success-message { background: var(--surface-light); border-left: 4px solid var(--primary); color: var(--text-soft); padding: 12px 15px; border-radius: 8px; margin-bottom: 20px; }
|
||
.form-group { margin-bottom: 20px; }
|
||
label { display: block; margin-bottom: 8px; color: var(--text-soft); font-weight: 500; }
|
||
input[type="text"], textarea { width: 100%; padding: 12px 15px; background: var(--surface-light); border: 1px solid var(--border); border-radius: 30px; color: var(--text); font-size: 1rem; outline: none; transition: border 0.2s; }
|
||
textarea { border-radius: 20px; resize: vertical; min-height: 150px; }
|
||
input:focus, textarea:focus { border-color: var(--accent); }
|
||
input[type="file"] { background: var(--surface-light); border: 1px solid var(--border); border-radius: 30px; padding: 10px 15px; width: 100%; color: var(--text); }
|
||
.file-note { color: var(--text-hint); font-size: 0.85rem; margin-top: 5px; }
|
||
.btn { background: var(--gradient); border: none; border-radius: 40px; padding: 14px 30px; color: white; font-weight: 600; font-size: 1rem; cursor: pointer; transition: transform 0.2s; width: 100%; margin-top: 10px; }
|
||
.btn:hover { transform: scale(1.02); }
|
||
.footer-links { margin-top: 20px; text-align: center; }
|
||
.footer-links a { color: var(--text-hint); text-decoration: none; margin: 0 10px; }
|
||
.footer-links a:hover { color: var(--accent); }
|
||
</style>
|
||
</head>
|
||
<body class="dark-mode">
|
||
<div class="post-wrapper">
|
||
<div class="header">
|
||
<div class="logo">lv8girl<span>绿坝娘</span></div>
|
||
<button class="theme-toggle" id="themeToggle">🌓</button>
|
||
</div>
|
||
<div class="post-card">
|
||
<h2>发表新帖</h2>
|
||
{{if .Error}}<div class="error-message">{{.Error}}</div>{{end}}
|
||
{{if .Success}}
|
||
<div class="success-message">{{.Success}}</div>
|
||
{{else}}
|
||
<form method="post" enctype="multipart/form-data">
|
||
<div class="form-group">
|
||
<label for="title">标题</label>
|
||
<input type="text" id="title" name="title" placeholder="请输入标题" required>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="content">内容</label>
|
||
<textarea id="content" name="content" placeholder="请输入帖子内容..." required></textarea>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="image">上传图片(可选,不超过2MB)</label>
|
||
<input type="file" id="image" name="image" accept="image/*">
|
||
<div class="file-note">支持 JPEG、PNG、GIF、WEBP 格式</div>
|
||
</div>
|
||
<button type="submit" class="btn">发 布</button>
|
||
</form>
|
||
{{end}}
|
||
<div class="footer-links">
|
||
<a href="/">返回首页</a>
|
||
<a href="/profile">个人主页</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
const themeToggle = document.getElementById('themeToggle');
|
||
themeToggle.addEventListener('click', () => {
|
||
document.body.classList.toggle('dark-mode');
|
||
themeToggle.textContent = document.body.classList.contains('dark-mode') ? '☀️' : '🌓';
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|