update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-08-25 21:25:20 +08:00
parent 93b6f0bef0
commit d64a046f82
9 changed files with 487 additions and 153 deletions

View File

@ -0,0 +1,14 @@
# 2026-08-25 工作日志
## 新增 /en/ 登录注册页(20:02)
- 用户要求:把 /en/ 下的 login 和 register 做出来,符合当前网站设计。
- 背景:Astro i18n `prefixDefaultLocale: true`,导航 Login/Signup 链接解析为 `/en/login`、`/en/register`,但这两个文件之前不存在(只有根 `src/pages/login.astro` 等 ComingSoon 占位),点开 404。
- 改动(加法式,不动根 ComingSoon 页、不动原 Login.astro/Register.astro 组件):
1. `src/lib/api.ts`:新增 `saveSession(token, user)`,写入 `fa_token`/`fa_user`(与 `getUser`/`fetchMe` 共用 key),供登录/注册后落地本地会话。
2. 新建 `src/components/pages/AuthForm.astro`:登录/注册通用编辑风表单(props `mode: 'login'|'register'`)。
- 设计:沿用全站黑白极简编辑风——monospace 顶边 kicker(Account / Sign In|Create Account)、`font-serif font-black` 大标题、monospace 副标题、黑底描边 input(`auth-input`)、黑底白字描边按钮(hover 反白,沿用 `cs-btn` 调性)、底部 footer 链接(注册↔登录互链)。容器用 `w-full max-w-[460px] mx-auto`(避免 m-auto shrink-to-fit,见 MEMORY Layout 陷阱)。
- 客户端 `<script>`(module,可 import):读 `form.dataset.mode/redirect`;提交 POST `/api/auth/login` 或 `/api/auth/register`(body JSON),成功 `saveSession` 后 `location.href = redirect`(优先 `?redirect=`,否则 `/en/`);失败/网络错在 `auth-error` 内联显示;注册时校验两次密码一致。后端不可用时优雅报错,不破坏设计。
3. 新建 `src/pages/en/login.astro`、`src/pages/en/register.astro`:套 `<Layout>` + `<AuthForm>`。
4. `src/layouts/Layout.astro`:原来 `<title>{`111`}</title>` 硬编码 bug,改为支持 `title` prop(`${title} — Portfolio Studio`)。属于让新页面标题正确的必要小修;导航(header)未动。
- 验证:`npm run build` BUILD_EXIT=0;AuthForm/两个 page/Layout `read_lints` 全 0;`dist/client/en/login/index.html`、`en/register/index.html` 均含 `auth-form`/`auth-input`/对应标题;`python -m http.server 8088` 托管 dist/client,`/en/login/`、`/en/register/` 均 200。
- ⚠️ 范围说明:仅做了 /en/ 版。根 `/login`、`/cn/login`(及 register 对应)仍是 ComingSoon 占位,未动。若要补齐 /cn/ 与根版,需再建 `src/pages/cn/login.astro` 等(可复用 AuthForm)。后端 `/api/auth/login|register` 是否就绪未知,未接时提交会显示内联错误。

View File

@ -5,8 +5,8 @@
- **所有走秀页 `/shows`**(新建 2026-08-08):全局走秀档案(区别于 `/articles` 的品牌档案视图 ?brand_id)。基于 articles.astro,标题「All Runway」,保留系列/季节/品牌筛选 + 三视图(Grid/Magazine/Timeline),新增分页 Load More(page/total/busy,append 模式,后端 `?page=&size=30&with_images=5`)。首页 sec-more「全部走秀 →」指向 /shows。
- 其余模块(Portfolio / Latest Projects / About / Contact / 登录注册)为「暂未上线」占位页:直接访问旧 URL 或点击导航旧链接均渲染 ComingSoon 占位;**导航(header)保持原样未改动**(用户 2026-08-07 明确「header 别动」),门禁完全靠占位页实现。
- **首页 tabbar**(index.astro, id="tabbar"):仅「发布会(backstage)」上线(默认激活 + Live 徽标,承载 getShows(8) SSR 真实卡片);「灵感(shows)/社媒(events)/街拍(street)」标 `data-soon="true"` + Soon 灰徽标,点击仅显示 ComingSoon 占位、不再请求后端;「品牌」tab 仍为指向 /brands 的有效链接(属已上线模块,未屏蔽)。
- 占位实现:src/components/ComingSoon.astro(编辑风,props: module / moduleZh / note;两个按钮「浏览走秀档案 →」「返回首页」)。6 个页面(portfolio / latest-projects / about / contact / login / register)改为 `<Layout><ComingSoon/></Layout>`。
- login/register 原 standalone 页(未 import global.css、字体变量未定义),已改为套 Layout + ComingSoon 占位页,顺带修复字体一致性;导航中 Login/Signup 链接保留,点击即见占位。
- 占位实现:src/components/ComingSoon.astro(编辑风,props: module / moduleZh / note;两个按钮「浏览走秀档案 →」「返回首页」)。portfolio / latest-projects / about / contact 仍为 ComingSoon 占位页。
- **登录/注册(2026-08-25 更新)**:`/en/login`、`/en/register` 已做成真实编辑风页面(套 Layout + 新建 `src/components/pages/AuthForm.astro` 通用表单组件,`mode:'login'|'register'`,客户端 POST `/api/auth/login|register`,用 `saveSession` 写 `fa_token`/`fa_user`)。根 `/login`(src/pages/login.astro) 与 `/cn/login` 等**仍是 ComingSoon 占位**(未动,属当时范围外);导航 Login/Signup 在 en 语境下现指向真实的 /en/login、/en/register。
## 架构总览
- 前端:/d/project/test/test — Astro SSG + Tailwind v4。构建 `PUBLIC_API_BASE=http://localhost:8090 npm run build`;预览 `python -m http.server` 托管 dist/。