fix: 修复登录重定向失效 + 404页面友好化

- ShowPage 未登录用户看未发布帖子时引导登录(携带 redirect 参数),替代直接 404
- login.js 无 redirect 参数时回退到同站 Referer 页面
- 404 页面重设计:SVG 图标 + 中文提示 + 返回首页和浏览帖子双按钮
- posts.css 新增 404 页面按钮样式
This commit is contained in:
2026-05-31 03:39:18 +08:00
parent 8b075f7387
commit e1fb28e8fb
4 changed files with 84 additions and 10 deletions

View File

@ -3,9 +3,17 @@
{{template "layout/nav.html" .}}
<div class="container">
<div class="error-404">
<h1>404</h1>
<p>帖子不存在或已被删除</p>
<a href="/posts" class="btn btn-primary">返回帖子列表</a>
<div class="error-404-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>
</svg>
</div>
<h1>页面未找到</h1>
<p>该帖子可能已被删除、尚未发布,或您输入的地址有误</p>
<div class="error-404-actions">
<a href="/" class="btn btn-secondary">返回首页</a>
<a href="/posts" class="btn btn-primary">浏览帖子</a>
</div>
</div>
</div>
{{template "layout/footer.html" .}}