feat(website): 独立注册页 /register(邮箱/邀请码预填+验证码注册+平台匹配下载)+ 主页/落地页跳转接入 + 登录态隐藏注册入口
ci-pangolin / Lint — shellcheck (pull_request) Successful in 13s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 25s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 23s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 34s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 21s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 34s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 8s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 8s
ci-pangolin / Go — build + test (pull_request) Failing after 13s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 10s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 4m34s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 19s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
This commit is contained in:
wangjia
2026-07-13 12:20:32 +08:00
parent 254db4f40d
commit 65ce2664ee
12 changed files with 789 additions and 43 deletions
+6 -14
View File
@@ -6,6 +6,7 @@
import { useEffect, useRef, useState } from 'react';
import { Download, Menu } from 'lucide-react';
import { SITE } from '../config/site';
import { isLoggedIn, getStoredEmail, clearStoredSession } from '../lib/authState';
function Mark() {
return (
@@ -42,24 +43,15 @@ export default function Header({ lang = 'zh', t = {} }) {
const displayName = (email && email.split('@')[0]) || 'Account';
// 与用户中心同源:登录后 localStorage 存 pg_uc_refresh+ pg_uc_email)→ 显示用户名下拉。
// 判断逻辑单一实现见 lib/authState.jsAnnouncementBar/SignupForm/RegisterCard/InviteCard 同源复用)。
useEffect(() => {
try {
setLoggedIn(!!localStorage.getItem('pg_uc_refresh'));
setEmail(localStorage.getItem('pg_uc_email') || '');
} catch {
setLoggedIn(false);
}
setLoggedIn(isLoggedIn());
setEmail(getStoredEmail());
}, []);
// 清登录态并跳转(切换用户 = 回登录页;退出 = 回主页)。
const clearSession = () => {
try {
localStorage.removeItem('pg_uc_refresh');
localStorage.removeItem('pg_uc_email');
} catch { /* ignore */ }
};
const onSwitch = () => { clearSession(); window.location.href = loginHref; };
const onLogout = () => { clearSession(); window.location.href = '/'; };
const onSwitch = () => { clearStoredSession(); window.location.href = loginHref; };
const onLogout = () => { clearStoredSession(); window.location.href = '/'; };
useEffect(() => {
if (!langOpen) return;