feat: 重构博客为水墨纸质风格 + 搭建后台管理系统

- 重新设计全站 UI:parchment/ink/terracotta 水墨纸质色系,宋式 serif 排版
- 新增页面:文章列表、文章详情、分类、标签、关于
- GSAP ScrollTrigger 滚动动画 + 逐字揭示效果
- 后台管理系统 /admin:文章/分类/标签 CRUD,JSON 文件存储
- 登录认证(cookie session)
- 设计系统文档 UI.md
This commit is contained in:
胡旭
2026-06-24 08:45:28 +08:00
parent 507f12e501
commit dce8fe62ea
35 changed files with 3124 additions and 96 deletions
+60
View File
@@ -0,0 +1,60 @@
"use client";
import { useState } from "react";
import { useRouter } from "next/navigation";
export default function LoginPage() {
const [password, setPassword] = useState("");
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
const router = useRouter();
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError("");
const res = await fetch("/api/auth", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ password }),
});
if (res.ok) {
router.push("/admin");
} else {
const data = await res.json();
setError(data.error || "登录失败");
}
setLoading(false);
}
return (
<div className="min-h-screen bg-parchment flex items-center justify-center px-4">
<div className="w-full max-w-sm">
<div className="text-center mb-10">
<h1 className="font-display text-3xl font-medium text-ink"></h1>
<p className="mt-2 font-sans text-sm text-ink-muted">asui.xyz</p>
</div>
<form onSubmit={handleSubmit} className="space-y-5">
<div>
<input
type="password"
placeholder="输入管理密码"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full px-4 py-3 rounded-xl border border-warm-gray/20 bg-cream font-sans text-sm text-ink placeholder:text-ink-muted/50 focus:outline-none focus:border-terracotta/40 transition-colors"
autoFocus
/>
</div>
{error && <p className="font-sans text-sm text-red-600">{error}</p>}
<button
type="submit"
disabled={loading}
className="w-full py-3 rounded-xl bg-ink text-cream font-sans text-sm tracking-wide hover:bg-terracotta transition-colors disabled:opacity-50"
>
{loading ? "验证中..." : "登录"}
</button>
</form>
</div>
</div>
);
}