feat(frontend): polish login and design tokens

This commit is contained in:
iye
2026-06-16 12:30:45 +08:00
parent 77c037495e
commit b2288a2652
23 changed files with 828 additions and 926 deletions
+2 -2
View File
@@ -347,7 +347,7 @@ export function AssetFactoryPage({ navigate, aiTasks, assets = [] }: { navigate:
<span className="pct">60%</span>
</div>
) : (
<span className="muted-2 mono" style={{ fontSize: 11 }}>
<span className="muted-2 mono" style={{ fontSize: 12 }}>
{pill === "ok" ? "已完成" : "—"}
</span>
)}
@@ -358,7 +358,7 @@ export function AssetFactoryPage({ navigate, aiTasks, assets = [] }: { navigate:
{statusText(task.status)}
</span>
</td>
<td className="muted-2 mono" style={{ fontSize: 11 }}>{(task.created_at || "").slice(0, 10)}</td>
<td className="muted-2 mono" style={{ fontSize: 12 }}>{(task.created_at || "").slice(0, 10)}</td>
<td />
</tr>
);
+129 -167
View File
@@ -1,53 +1,59 @@
import { useEffect, useRef, useState } from "react";
import type { FormEvent } from "react";
import { Eye, EyeOff, LockKeyhole, UserRound } from "lucide-react";
import { api } from "../api";
import type { Team, User } from "../types";
import type { AuthMode } from "./route-config";
const CHECK_SVG = (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M20 6L9 17l-5-5" /></svg>
);
const MAIL_SVG = (
<svg className="ic-l" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z" /><path d="m22 6-10 7L2 6" /></svg>
);
const LOCK_SVG = (
<svg className="ic-l" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" /><path d="M7 11V7a5 5 0 0 1 10 0v4" /></svg>
);
const EYE_SVG = (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7z" /><circle cx="12" cy="12" r="3" /></svg>
);
const ARROW_SVG = (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h14M12 5l7 7-7 7" /></svg>
);
const LOGIN_PROGRESS_STAGE_MS = 520;
type LoginProgress = "checking" | "verified" | "entering";
const LOGIN_PROGRESS_COPY: Record<LoginProgress, string> = {
checking: "正在验证用户名和密码…",
verified: "验证成功,正在登录…",
entering: "登录成功,正在进入 Airshelf"
};
function wait(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function completeProgressStage(startedAt: number) {
const remaining = LOGIN_PROGRESS_STAGE_MS - (Date.now() - startedAt);
if (remaining > 0) await wait(remaining);
}
type FieldErrors = {
username?: string;
password?: string;
};
export function AuthScreen({
initialMode,
onModeChange,
initialMode: _initialMode,
onModeChange: _onModeChange,
onAuthed
}: {
initialMode: AuthMode;
onModeChange: (mode: AuthMode) => void;
onAuthed: (payload: { token: string; user: User; team: Team }) => void;
onAuthed: (payload: { token: string; user: User; team: Team }) => void | Promise<void>;
}) {
const [mode, setMode] = useState<AuthMode>(initialMode);
// 不预填设计稿假账号:真实登录页字段必须从空开始
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [teamName, setTeamName] = useState("");
const [email, setEmail] = useState("");
const [registerPassword, setRegisterPassword] = useState("");
const [registerPassword2, setRegisterPassword2] = useState("");
const [invite, setInvite] = useState("");
const [agreed, setAgreed] = useState(true);
const [showPwd, setShowPwd] = useState(false);
const [showRegPwd, setShowRegPwd] = useState(false);
const [showRegPwd2, setShowRegPwd2] = useState(false);
const [fieldErrors, setFieldErrors] = useState<FieldErrors>({});
const [error, setError] = useState("");
const [busy, setBusy] = useState(false);
const [toast, setToast] = useState<{ title: string; sub: string } | null>(null);
const [loginProgress, setLoginProgress] = useState<LoginProgress | null>(null);
const toastTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => setMode(initialMode), [initialMode]);
useEffect(() => {
const path = window.location.pathname.replace(/\/+$/, "").toLowerCase();
if (path === "/register" || window.location.hash === "#register") {
window.history.replaceState(null, "", "/login");
}
}, []);
useEffect(() => () => { if (toastTimer.current) clearTimeout(toastTimer.current); }, []);
function showToast(title: string, sub: string) {
@@ -56,41 +62,48 @@ export function AuthScreen({
toastTimer.current = setTimeout(() => setToast(null), 2800);
}
function switchMode(next: AuthMode) {
setMode(next);
function setFieldValue(field: keyof FieldErrors, value: string) {
if (field === "username") setUsername(value);
if (field === "password") setPassword(value);
setError("");
onModeChange(next);
setLoginProgress(null);
setFieldErrors((current) => ({ ...current, [field]: undefined }));
}
async function submit(event: FormEvent) {
event.preventDefault();
function validateLogin() {
const next: FieldErrors = {};
if (!username.trim()) next.username = "请输入用户名";
if (!password) next.password = "请输入密码";
setFieldErrors(next);
if (Object.keys(next).length > 0) {
setError("请补全必填字段后再登录");
return false;
}
return true;
}
async function submit(event?: FormEvent) {
event?.preventDefault();
if (busy) return;
if (!validateLogin()) return;
setBusy(true);
setError("");
setLoginProgress("checking");
try {
if (mode === "login") {
if (!username.trim() || !password) throw new Error("请输入邮箱和密码");
}
if (mode === "register") {
if (registerPassword.length < 8) throw new Error("密码至少 8 位");
if (registerPassword !== registerPassword2) throw new Error("两次密码不一致");
if (!agreed) throw new Error("请同意用户协议");
}
const payload =
mode === "login"
? await api.login({ username, password })
: await api.register({
username: email,
email,
password: registerPassword,
team_name: teamName
});
onAuthed(payload);
const checkingStartedAt = Date.now();
const payload = await api.login({ username: username.trim(), password });
await completeProgressStage(checkingStartedAt);
setLoginProgress("verified");
await wait(LOGIN_PROGRESS_STAGE_MS);
setLoginProgress("entering");
await wait(LOGIN_PROGRESS_STAGE_MS);
await onAuthed(payload);
} catch (err) {
setLoginProgress(null);
const raw = err instanceof Error ? err.message : "";
// 后端错误是英文原文(invalid credentials 等),映射成用户可读的中文
const friendly = /invalid credentials|unable to log in|non_field_errors/i.test(raw)
? "邮箱或密码不正确"
: raw || (mode === "login" ? "登录失败,请稍后重试" : "注册失败,请稍后重试");
? "用户名或密码不正确"
: raw || "登录失败,请稍后重试";
setError(friendly);
} finally {
setBusy(false);
@@ -98,132 +111,81 @@ export function AuthScreen({
}
return (
<main className={`auth-exact-page ${mode === "register" ? "auth-register-page" : "auth-login-page"}`}>
<a className="top-back" href={mode === "register" ? "/login" : "/dashboard"} onClick={(event) => { if (mode === "register") { event.preventDefault(); switchMode("login"); } }}>
{mode === "register" ? "← 返回登录" : "← 返回工作台"}
</a>
<main className="auth-exact-page auth-login-page">
<div className="auth-wrap">
<span className="corner-tr" aria-hidden="true"></span><span className="corner-bl" aria-hidden="true"></span>
<aside className="auth-brand">
<div className="logo"><img className="logo-img" src="/assets/logo-dark.png" alt="Airshelf" /></div>
<div className="tag">// SHORT-VIDEO COMMERCE PLATFORM</div>
<div className="hero">
{mode === "login" ? <><h1>AI 全流程<br /><span className="h">短剧化</span>带货生成</h1><p>商品 → AI 脚本 → 故事板 → Seedance 视频片段 → 一键导出 9:16 ≤60s 成片。</p></> : <><h1>开通团队,<br />开始 <span className="h">AI 带货</span> 第一条短剧</h1><p>个人 / 企业团队 1-2 小时出成片,失败不扣费,确认后扣。</p></>}
<h1>AI 全流程<br /><span className="h">短剧化</span>带货生成</h1>
<p>商品 → AI 脚本 → 故事板 → Seedance 视频片段 → 一键导出 9:16 ≤60s 成片。</p>
</div>
{mode === "login" ? (
<div className="ascii">
<div className="ln"><span className="k">// step·1</span> &nbsp; 脚本生成 &nbsp; &nbsp; <span className="v">●●●●●</span></div>
<div className="ln"><span className="k">// step·2</span> &nbsp; 基础资产 &nbsp; &nbsp; <span className="v">●●●●○</span></div>
<div className="ln"><span className="k">// step·3</span> &nbsp; 故事板 &nbsp; &nbsp; &nbsp; <span className="v">●●●○○</span></div>
<div className="ln"><span className="k">// step·4</span> &nbsp; 视频片段 &nbsp; &nbsp; <span className="v">●●○○○</span></div>
<div className="ln"><span className="k">// step·5</span> &nbsp; 拼接导出 &nbsp; &nbsp; <span className="v">●○○○○</span></div>
</div>
) : (
<div className="val-list">
<div className="val-item"><span className="ic-v">{CHECK_SVG}</span><span className="txt-v"><b>5 阶段流水线</b> · 脚本 → 资产 → 故事板 → 视频片段 → 拼接导出</span></div>
<div className="val-item"><span className="ic-v">{CHECK_SVG}</span><span className="txt-v"><b>失败不扣费</b> · 任务仅在用户通过时扣费,失败 / 超时 / 重跑一律不扣</span></div>
<div className="val-item"><span className="ic-v">{CHECK_SVG}</span><span className="txt-v"><b>团队 + 角色 + 四层额度</b> · 超管 / 团管 / 成员,日 / 月 + 团队 / 总四层防超支</span></div>
<div className="val-item"><span className="ic-v">{CHECK_SVG}</span><span className="txt-v"><b>跨项目资产库</b> · 主播 / 场景 / 商品图沉淀复用,不重复生成</span></div>
</div>
)}
<div className="foot"><a href="#">关于</a><a href="#">定价</a><a href="#">联系</a><a href="#">隐私</a></div>
</aside>
<main className="auth-form">
<div className="h-row"><h2>{mode === "login" ? "登录" : "注册团队"}</h2><span className="sub">{mode === "login" ? "// /auth/login" : "// /auth/register"}</span></div>
<p className="lead">{mode === "login" ? "使用团队邀请邮箱登录,接受邀请后自动加入对应团队。" : "填写团队信息开通账户,默认成为团队超管。"}</p>
{mode === "login" ? (
<form id="login-form" autoComplete="off" onSubmit={submit}>
<div className="field">
<label className="field-label" htmlFor="auth-email">邮箱 <span className="req">*</span></label>
<div className="field-input-wrap">
{MAIL_SVG}
<input type="email" id="auth-email" placeholder="name@company.com" value={username} onChange={(event) => setUsername(event.target.value)} required />
</div>
<section className="auth-form" aria-label="登录">
<div className="h-row"><h2>登录</h2><span className="sub">// LOGIN</span></div>
<form id="login-form" autoComplete="off" onSubmit={submit} noValidate>
<div className={`field${fieldErrors.username ? " has-error" : ""}`}>
<label className="field-label" htmlFor="auth-username">用户名 <span className="req">*</span></label>
<div className="field-input-wrap">
<UserRound className="ic-l" size={16} strokeWidth={1.5} aria-hidden="true" />
<input
id="auth-username"
type="text"
placeholder="请输入用户名"
value={username}
autoComplete="username"
aria-invalid={Boolean(fieldErrors.username)}
onChange={(event) => setFieldValue("username", event.target.value)}
/>
</div>
<div className="field">
<label className="field-label" htmlFor="auth-pwd">密码 <span className="req">*</span></label>
<div className="field-input-wrap">
{LOCK_SVG}
<input type={showPwd ? "text" : "password"} id="auth-pwd" placeholder="••••••••" value={password} onChange={(event) => setPassword(event.target.value)} required />
<button type="button" className="toggle-pwd" aria-label="切换密码可见" onClick={() => setShowPwd((value) => !value)}>{EYE_SVG}</button>
</div>
</div>
<div className="row-between">
<label><input type="checkbox" defaultChecked /> 记住我 7 天</label>
<a href="#" onClick={(event) => { event.preventDefault(); showToast("已发送重置邮件", `请到 ${username.trim() || "登录邮箱"} 收件箱查看 · 链接 30 分钟有效`); }}>忘记密码?</a>
</div>
{error && <div className="form-error">{error}</div>}
<button className="btn-cta" type="submit" disabled={busy}>
{busy ? <span className="busy-copy">// 验证中...</span> : <>登录{ARROW_SVG}</>}
</button>
<div className="divider"><span className="line"></span><span className="txt">OR</span><span className="line"></span></div>
<div className="sso-row">
<button type="button" className="sso-btn" onClick={() => showToast("微信扫码", "请在 60s 内用微信扫一扫完成授权 · 内测中,以邮箱登录为准")}>
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9 4C5 4 2 6.5 2 9.5c0 1.7 1 3.2 2.5 4.2L4 16l2.2-1.1c.7.2 1.5.3 2.3.3-.3-.5-.5-1.1-.5-1.7 0-2.8 2.9-5 6.5-5h.5C14.6 6 12 4 9 4zm-2 3.5c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1 .4-1 1-1zm4 0c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1 .4-1 1-1zM15 9c-3.3 0-6 2.2-6 5s2.7 5 6 5c.7 0 1.4-.1 2-.3L19 20l-.4-1.7c1.4-.9 2.4-2.3 2.4-3.8 0-2.8-2.7-5-6-5zm-2 2.5c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1 .4-1 1-1zm4 0c.6 0 1 .4 1 1s-.4 1-1 1-1-.4-1-1 .4-1 1-1z" /></svg>
微信扫码
</button>
<button type="button" className="sso-btn" onClick={() => showToast("飞书 SSO", "即将打开企业飞书登录授权页 · 内测中,以邮箱登录为准")}>
<svg viewBox="0 0 24 24" fill="currentColor"><rect x="3" y="3" width="18" height="18" rx="3" /></svg>
飞书 SSO
</div>
<div className={`field${fieldErrors.password ? " has-error" : ""}`}>
<label className="field-label" htmlFor="auth-pwd">密码 <span className="req">*</span></label>
<div className="field-input-wrap">
<LockKeyhole className="ic-l" size={16} strokeWidth={1.5} aria-hidden="true" />
<input
id="auth-pwd"
type={showPwd ? "text" : "password"}
placeholder="请输入密码"
value={password}
autoComplete="current-password"
aria-invalid={Boolean(fieldErrors.password)}
onChange={(event) => setFieldValue("password", event.target.value)}
/>
<button
type="button"
className={`toggle-pwd${showPwd ? " active" : ""}`}
aria-label={showPwd ? "隐藏密码" : "显示密码"}
aria-pressed={showPwd}
title={showPwd ? "隐藏密码" : "显示密码"}
onClick={() => setShowPwd((value) => !value)}
>
{showPwd ? <EyeOff size={18} strokeWidth={1.5} aria-hidden="true" /> : <Eye size={18} strokeWidth={1.5} aria-hidden="true" />}
</button>
</div>
<div className="switch-row">还没账号? <a href="/register" onClick={(event) => { event.preventDefault(); switchMode("register"); }}>注册团队 →</a></div>
</form>
) : (
<form id="register-form" autoComplete="off" onSubmit={submit}>
<div className="field">
<label className="field-label" htmlFor="reg-team">团队名 <span className="req">*</span></label>
<div className="field-input-wrap">
<svg className="ic-l" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /><path d="M9 22V12h6v10" /></svg>
<input type="text" id="reg-team" placeholder="例: 小李的店 / XX 文化传媒" value={teamName} onChange={(event) => setTeamName(event.target.value)} required />
</div>
</div>
<div className="field">
<label className="field-label" htmlFor="reg-email">超管邮箱 <span className="req">*</span><span className="hint">用于成员邀请 + 找回密码</span></label>
<div className="field-input-wrap">
{MAIL_SVG}
<input type="email" id="reg-email" placeholder="name@company.com" value={email} onChange={(event) => setEmail(event.target.value)} required />
</div>
</div>
<div className="field-row">
<div className="field">
<label className="field-label" htmlFor="reg-pwd">密码 <span className="req">*</span></label>
<div className="field-input-wrap">
{LOCK_SVG}
<input type={showRegPwd ? "text" : "password"} id="reg-pwd" placeholder="至少 8 位" value={registerPassword} onChange={(event) => setRegisterPassword(event.target.value)} required />
<button type="button" className="toggle-pwd" onClick={() => setShowRegPwd((value) => !value)}>{EYE_SVG}</button>
</div>
</div>
<div className="field">
<label className="field-label" htmlFor="reg-pwd2">确认密码 <span className="req">*</span></label>
<div className="field-input-wrap">
{LOCK_SVG}
<input type={showRegPwd2 ? "text" : "password"} id="reg-pwd2" placeholder="再输一次" value={registerPassword2} onChange={(event) => setRegisterPassword2(event.target.value)} required />
<button type="button" className="toggle-pwd" onClick={() => setShowRegPwd2((value) => !value)}>{EYE_SVG}</button>
</div>
</div>
</div>
<div className="field">
<label className="field-label" htmlFor="reg-invite">邀请码 <span className="hint">可选 · 团队邀请才需要</span></label>
<div className="field-input-wrap">
<svg className="ic-l" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" /></svg>
<input type="text" id="reg-invite" placeholder="例: TEAM-XXXX-XXXX" value={invite} onChange={(event) => setInvite(event.target.value)} />
</div>
</div>
<label className="agree">
<input type="checkbox" id="reg-agree" checked={agreed} onChange={(event) => setAgreed(event.target.checked)} />
<span>我已阅读并同意 <a href="#" onClick={(event) => { event.preventDefault(); showToast("用户协议", "含数据处理 / 内容生成版权 / 计费规则三章 · 完整文本将在正式版接入"); }}>用户协议</a> 与 <a href="#" onClick={(event) => { event.preventDefault(); showToast("隐私政策", "遵循《个人信息保护法》· 团队数据存中国境内 · 默认不用于模型训练"); }}>隐私政策</a>,知悉「失败不扣费 · 确认后扣」的扣费规则。</span>
</label>
{error && <div className="form-error">{error}</div>}
<button className="btn-cta" type="submit" id="reg-submit" disabled={busy}>
{busy ? <span className="busy-copy">// 创建团队中...</span> : <>创建团队 · 开始使用{ARROW_SVG}</>}
</button>
<div className="switch-row">已有账号? <a href="/login" onClick={(event) => { event.preventDefault(); switchMode("login"); }}>登录 →</a></div>
</form>
</div>
<div className="row-between">
<label><input type="checkbox" defaultChecked /> 记住我 7 天</label>
<a href="#" onClick={(event) => { event.preventDefault(); showToast("重置密码", "请联系团队超管重置你的登录密码"); }}>忘记密码?</a>
</div>
</form>
</section>
<div className="auth-submit-zone">
{loginProgress && !error && (
<div className="login-progress" role="status" aria-live="polite">
<span className="login-progress-spinner" aria-hidden="true"></span>
<span>{LOGIN_PROGRESS_COPY[loginProgress]}</span>
</div>
)}
</main>
{error && <div className="form-error" role="alert">{error}</div>}
<button className="btn-cta" type="button" form="login-form" disabled={busy} onClick={() => { void submit(); }}>
{busy ? "登录中" : "登录"}
</button>
</div>
</div>
{toast && <div className="login-toast"><div>{toast.title}</div><div style={{ fontSize: "11.5px", color: "rgba(0,0,0,.56)", fontWeight: 400, letterSpacing: ".02em" }}>// {toast.sub}</div></div>}
{toast && <div className="login-toast"><div>{toast.title}</div><span>// {toast.sub}</span></div>}
</main>
);
}
+16 -2
View File
@@ -1,4 +1,3 @@
import { Plus } from "lucide-react";
import type { Asset, BillingSummary, Product, Project } from "../types";
import type { Page } from "./route-config";
import { money, stageMeta, statusPill } from "./stage-config";
@@ -18,7 +17,22 @@ export function Dashboard({ products, projects, assets, billing, userName, navig
const productTitle = (id: string) => products.find((product) => product.id === id)?.title || "商品";
return (
<>
<div className="page-head"><div><h1>欢迎回来{userName ? `,${userName.split("@")[0]}` : ""}</h1><div className="sub"><span className="mono">// {new Date().toLocaleDateString("zh-CN")}</span><span>·</span><span>你有 <b>{running} 个项目</b> 正在进行中</span></div></div><div className="actions"><button className="btn" type="button" onClick={() => navigate("products")}><Plus size={13} />新建商品</button><button className="btn btn-primary btn-lg" type="button" onClick={() => navigate("projectWizard")}><Plus size={13} />新建项目</button></div></div>
<div className="page-head">
<div>
<h1>欢迎回来{userName ? `,${userName.split("@")[0]}` : ""}</h1>
<div className="sub"><span className="mono">// {new Date().toLocaleDateString("zh-CN")}</span><span>·</span><span>你有 <b>{running} 个项目</b> 正在进行中</span></div>
</div>
<div className="actions">
<button className="btn" type="button" onClick={() => navigate("products")}>
<IconKitSvg name="productPlus" size={16} />
新建商品
</button>
<button className="btn btn-primary btn-lg btn-create" type="button" onClick={() => navigate("projectWizard")}>
<IconKitSvg name="clapperboard" size={16} />
新建项目
</button>
</div>
</div>
<div className="stats with-corners"><span className="corner-tr">+</span><span className="corner-bl">+</span><KpiStat label="总项目" badge="ALL" value={projects.length} delta={`↑ 本月 +${Math.max(projects.length, 0)}`} /><KpiStat label="进行中" badge="WIP" value={running} delta="待处理" /><KpiStat label="成片" badge="DONE" value={completed} delta="导出完成" /><button className="stat" type="button" onClick={() => navigate("account")}><div className="lbl">余额 <span className="badge">¥</span></div><div className="v">{money(billing?.account.balance)}</div><div className="bar"><span style={{ width: "38%" }} /></div><div className="sub">已冻结 {money(billing?.account.reserved_balance)}</div></button></div>
<div className="dash-grid"><div><div className="section-h"><h2>最近项目</h2><button className="more" type="button" onClick={() => navigate("projects")}>[ ALL · {projects.length} ] →</button></div><div className="card-hard">{projects.slice(0, 6).map((project) => <button className="recent-row" key={project.id} type="button" onClick={() => navigate("pipeline")}><div className="placeholder thumb"><span className="ph-frame">9:16</span></div><div className="recent-meta"><div className="name">{project.name}</div><div className="sub">{productTitle(project.product)} / AI 全生 / 4 镜</div></div><Progress status={project.current_stage} /><span className={`pill ${statusPill(project.status)}`}><span className="dot" />{stageMeta[project.current_stage]?.label || project.current_stage}</span><span className="btn btn-sm">继续</span></button>)}</div></div><div style={{ display: "flex", flexDirection: "column", gap: 24 }}><div><div className="section-h"><h2>快捷入口</h2><span className="more">[ /shortcuts ]</span></div><div className="shortcuts"><Shortcut name="package" title="商品库" desc={`${products.length} SKU`} onClick={() => navigate("products")} /><Shortcut name="images" title="资产库" desc={`${assets.length} 资产`} onClick={() => navigate("library")} /><Shortcut name="creditCard" title="充值" desc={money(billing?.account.balance)} onClick={() => navigate("account")} /><Shortcut name="clapperboard" title="所有项目" desc={`${projects.length} 个`} onClick={() => navigate("projects")} /></div></div><div><div className="section-h"><h2>提示</h2><span className="more">[ FAQ ]</span></div><div className="tip"><strong>扣费规则</strong>生成失败、超时、用户重跑 — 均不扣费。仅在你点 <span className="mono">[ 确认通过 ]</span> 时按 token 实际结算。</div></div></div></div>
</>
+22 -22
View File
@@ -1381,7 +1381,7 @@ export function PipelinePage(props: {
<div className="pane-h">
<div className="shot-headline">
<strong>镜头脚本</strong>
<span className="muted-2 mono" id="shots-meta" style={{ fontSize: "11px" }}>
<span className="muted-2 mono" id="shots-meta" style={{ fontSize: "12px" }}>
{shots.length ? `· ${shots.length} 镜 · ${scriptAdopted ? "已采用" : "待采用"}` : "· 空 · 待生成"}
</span>
</div>
@@ -1499,7 +1499,7 @@ export function PipelinePage(props: {
<div className="pane-h">
<div className="ai-avatar">AI</div>
<strong>脚本助手</strong>
<span className="muted-2 mono" style={{ fontSize: "11px" }}>· {scriptModelName}</span>
<span className="muted-2 mono" style={{ fontSize: "12px" }}>· {scriptModelName}</span>
<span className="spacer"></span>
<button className="btn btn-ghost btn-sm" type="button" id="chat-clear-btn" disabled={!chatText && chatAttachments.length === 0 && chatMsgs.length === 0} onClick={clearChat}>清空对话</button>
</div>
@@ -1658,7 +1658,7 @@ export function PipelinePage(props: {
</div>
<div className="body-2">
<div className="hstack">
<strong style={{ fontSize: "13.5px" }}>{assetName(group.adopted_asset) || `${KIND_LABEL[kind]} ${gi + 1}`}</strong>
<strong style={{ fontSize: "14px" }}>{assetName(group.adopted_asset) || `${KIND_LABEL[kind]} ${gi + 1}`}</strong>
<span className="spacer"></span>
{group.adopted_asset
? <span className="pill ok"><span className="dot"></span>已采用</span>
@@ -1744,7 +1744,7 @@ export function PipelinePage(props: {
</span>
<div className="note-copy"><strong>仅支持整张重跑</strong> · 不能局部改某一镜。如需调单镜,先在 <a href="#stage-1" onClick={(event) => { event.preventDefault(); goStage(1); }}>Stage 1 脚本</a> 改镜头描述,再回此处整张重跑。</div>
</div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "6px", letterSpacing: ".04em" }}>// 整张提示词(重跑时生效,可编辑)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "6px", letterSpacing: ".04em" }}>// 整张提示词(重跑时生效,可编辑)</div>
{/* key 跟版本走:切版本重新种子;onInput 实时回写 state → 整张重跑用的就是你编辑后的文本 */}
<div
className="prompt-edit"
@@ -1761,7 +1761,7 @@ export function PipelinePage(props: {
{adoptedStoryboard ? "整张重跑" : "生成故事板"}
</button>
<span className="spacer"></span>
<span className="muted-2 mono" style={{ fontSize: "11px", alignSelf: "center" }}>~¥0.45/场</span>
<span className="muted-2 mono" style={{ fontSize: "12px", alignSelf: "center" }}>~¥0.45/场</span>
</div>
<div className="sb-history">
<div className="sb-history-h">// 历史版本(<span id="sb-history-ct">{storyboards.length}</span>)</div>
@@ -1774,15 +1774,15 @@ export function PipelinePage(props: {
<div className="ts">{(ver.created_at || "").slice(11, 16) || "--:--"}</div>
</div>
);
}) : <span className="muted-2 mono" style={{ fontSize: "11px" }}>// 暂无历史</span>}
}) : <span className="muted-2 mono" style={{ fontSize: "12px" }}>// 暂无历史</span>}
</div>
</div>
<div className="divider" style={{ marginTop: "16px" }}></div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 绑定的资产</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 绑定的资产</div>
<div style={{ display: "flex", gap: "6px", flexWrap: "wrap" }} id="sb-bound-assets">
{groups.filter((g) => g.adopted_asset).length ? groups.filter((g) => g.adopted_asset).map((g) => (
<span className="asset-tag" key={g.id}><span className="dotc"></span>{assetName(g.adopted_asset) || KIND_LABEL[g.kind] || g.kind}({KIND_LABEL[g.kind] || g.kind})</span>
)) : <span className="muted-2 mono" style={{ fontSize: "11px" }}>// 暂无绑定资产</span>}
)) : <span className="muted-2 mono" style={{ fontSize: "12px" }}>// 暂无绑定资产</span>}
</div>
</div>
</div>
@@ -1818,7 +1818,7 @@ export function PipelinePage(props: {
<div className="queue-bar">
<div>
<div style={{ fontSize: "14px", fontWeight: 600 }}>视频生成 · {segDone} / {segments.length} 完成</div>
<div className="muted-2 mono" style={{ fontSize: "11px", marginTop: "3px", letterSpacing: ".02em" }}>// 每场 Seedance 生成 · {statusText}</div>
<div className="muted-2 mono" style={{ fontSize: "12px", marginTop: "3px", letterSpacing: ".02em" }}>// 每场 Seedance 生成 · {statusText}</div>
</div>
<div className="bar-wrap"><span style={{ width: `${pct}%` }}></span></div>
<span className="muted mono" style={{ fontSize: "12px" }}>{pct}%</span>
@@ -2038,7 +2038,7 @@ export function PipelinePage(props: {
<span className="k">烧入字幕</span>
<button className={`btn btn-sm ${edState.subtitleEnabled ? "btn-primary" : "btn-ghost"}`} type="button" onClick={() => commitEdit({ ...edState, subtitleEnabled: !edState.subtitleEnabled })}>{edState.subtitleEnabled ? "已开启" : "已关闭"}</button>
</div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 字幕样式(导出烧入)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 字幕样式(导出烧入)</div>
<div className="style-swatch">
{STYLE_SWATCHES.map((sw) => (
<div className={`swatch-card${edState.subtitleStyle === sw.key ? " selected" : ""}`} key={sw.key} role="button" tabIndex={0} style={{ cursor: "pointer", opacity: edState.subtitleEnabled ? 1 : 0.5 }} onClick={() => commitEdit({ ...edState, subtitleStyle: sw.key, subtitleEnabled: true })}>
@@ -2046,17 +2046,17 @@ export function PipelinePage(props: {
</div>
))}
</div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, margin: "12px 0 6px", letterSpacing: ".04em" }}>// 字幕文本(默认取脚本旁白,可逐段改)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, margin: "12px 0 6px", letterSpacing: ".04em" }}>// 字幕文本(默认取脚本旁白,可逐段改)</div>
<div style={{ display: "flex", flexDirection: "column", gap: "6px", maxHeight: "186px", overflowY: "auto" }}>
{edState.clips.map((c, idx) => (
<div key={c.key} style={{ display: "flex", gap: "6px", alignItems: "flex-start" }}>
<span className="mono" style={{ fontSize: "10px", color: "var(--black-alpha-48)", marginTop: "7px", flex: "0 0 auto" }}>{idx + 1}</span>
<span className="mono" style={{ fontSize: "12px", color: "var(--black-alpha-48)", marginTop: "7px", flex: "0 0 auto" }}>{idx + 1}</span>
<textarea value={c.subtitle} onChange={(e) => setClipSubtitle(idx, e.target.value)} rows={1} disabled={!edState.subtitleEnabled} placeholder={`第 ${idx + 1} 段字幕`} style={{ flex: 1, minWidth: 0, resize: "vertical", fontSize: "12px", lineHeight: 1.4, padding: "4px 6px", border: "1px solid var(--border-faint)", borderRadius: "6px", background: "var(--surface)", color: "var(--accent-black)", fontFamily: "inherit" }} />
</div>
))}
</div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, margin: "14px 0 6px", letterSpacing: ".04em" }}>// 旁白配音(TTS · 导出混在 BGM 之上)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, margin: "14px 0 6px", letterSpacing: ".04em" }}>// 旁白配音(TTS · 导出混在 BGM 之上)</div>
{voInfo ? (
<div className="props-row" style={{ marginBottom: 6 }}>
<span style={{ fontSize: "12px", flex: 1 }}>已生成 {voInfo.items.length} 段 · {VO_VOICES.find((v) => v.key === voInfo.voice_type)?.label || voInfo.voice_type}</span>
@@ -2065,7 +2065,7 @@ export function PipelinePage(props: {
) : (
<div className="muted" style={{ fontSize: "12px", marginBottom: 6 }}>未生成配音 · 将按上方字幕文本逐段合成人声</div>
)}
{voStale && <div style={{ fontSize: "11.5px", color: "#B45309", marginBottom: 6 }}>字幕文本已修改,与现有配音不一致,建议重新生成</div>}
{voStale && <div style={{ fontSize: "12px", color: "#B45309", marginBottom: 6 }}>字幕文本已修改,与现有配音不一致,建议重新生成</div>}
<div className="props-row" style={{ marginBottom: 6 }}>
<span className="k">音色</span>
<select value={voVoicePick || voInfo?.voice_type || VO_VOICES[0].key} onChange={(e) => setVoVoicePick(e.target.value)} style={{ flex: 1, fontSize: "12px", padding: "4px 6px", border: "1px solid var(--border-faint)", borderRadius: "6px", background: "var(--surface)", color: "var(--accent-black)" }}>
@@ -2081,7 +2081,7 @@ export function PipelinePage(props: {
{propsTab === "transition" && (
<>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 片段间转场(导出 xfade 烧入)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 片段间转场(导出 xfade 烧入)</div>
<div style={{ display: "flex", flexDirection: "column", gap: "6px" }}>
{TRANSITIONS.map((tr) => (
<button className={`btn btn-sm ${edState.transition === tr.key ? "btn-primary" : "btn-ghost"}`} key={tr.key} type="button" style={{ justifyContent: "flex-start" }} onClick={() => commitEdit({ ...edState, transition: tr.key })}>{tr.nm}</button>
@@ -2092,7 +2092,7 @@ export function PipelinePage(props: {
{propsTab === "bgm" && (
<>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 背景音乐(导出混音)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 背景音乐(导出混音)</div>
<div className="props-row"><span style={{ fontSize: "12px", flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{serverBgm ? serverBgmName : "未设置 BGM"}</span></div>
{serverBgmUrl && <audio src={serverBgmUrl} controls style={{ width: "100%", height: 30, marginBottom: 8 }} />}
<div className="props-row"><span className="k">音量 {edState.bgmVolume}</span>
@@ -2107,12 +2107,12 @@ export function PipelinePage(props: {
)}
<div className="divider"></div>
<div className="muted mono" style={{ fontSize: "11px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 时间轴(<span id="ed-inspect-name">{timeline?.name || "未命名"}</span>)</div>
<div className="muted mono" style={{ fontSize: "12px", fontWeight: 500, marginBottom: "8px", letterSpacing: ".04em" }}>// 时间轴(<span id="ed-inspect-name">{timeline?.name || "未命名"}</span>)</div>
<div className="props-row"><span className="k">总时长</span><input className="input-mini" value={fmtMs(edRulerMs)} readOnly /></div>
<div className="props-row"><span className="k">片段</span><input className="input-mini" value={`${edClips.length} 段`} readOnly /></div>
<div className="props-row"><span className="k">字幕</span><input className="input-mini" value={subVisible ? `${edClips.length} 条` : "关"} readOnly /></div>
<div className="props-row"><span className="k">转场</span><input className="input-mini" value={(TRANSITIONS.find((t) => t.key === edState.transition) || TRANSITIONS[0]).nm} readOnly /></div>
<div className="props-row"><span className="k">分辨率</span><span className="mono" style={{ fontSize: "11.5px" }}>{resolution}</span></div>
<div className="props-row"><span className="k">分辨率</span><span className="mono" style={{ fontSize: "12px" }}>{resolution}</span></div>
</div>
<div className="timeline" id="ed-timeline" style={{ overflowX: edZoom > 100 ? "auto" : "hidden" }}>
@@ -2174,7 +2174,7 @@ export function PipelinePage(props: {
<span className="num">{idx + 1}</span><span className="lbl">{lbl}</span>
</div>
);
}) : <span className="muted-2 mono" style={{ position: "absolute", left: "8px", top: "50%", transform: "translateY(-50%)", fontSize: "11px" }}>// 暂无片段</span>}
}) : <span className="muted-2 mono" style={{ position: "absolute", left: "8px", top: "50%", transform: "translateY(-50%)", fontSize: "12px" }}>// 暂无片段</span>}
</div>
</div>
@@ -2260,7 +2260,7 @@ export function PipelinePage(props: {
<div className="asset-modal">
<div className="asset-modal-h">
<h2>视频详情</h2>
<span className="mono" style={{ fontSize: "11px", color: "var(--black-alpha-48)" }}>// 场 {vdSeg.sort_order + 1} · {vdSeg.target_duration_seconds}s</span>
<span className="mono" style={{ fontSize: "12px", color: "var(--black-alpha-48)" }}>// 场 {vdSeg.sort_order + 1} · {vdSeg.target_duration_seconds}s</span>
<button className="x" type="button" aria-label="关闭" onClick={() => setVdSegId(null)}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="M6 6l12 12M6 18L18 6" /></svg>
</button>
@@ -2291,13 +2291,13 @@ export function PipelinePage(props: {
</div>
<div className="ts">{(v.created_at || "").slice(11, 16) || "--:--"}</div>
</div>
)) : <span className="muted-2 mono" style={{ fontSize: "11px" }}>// 暂无版本</span>}
)) : <span className="muted-2 mono" style={{ fontSize: "12px" }}>// 暂无版本</span>}
</div>
</div>
<div className="vd-prompt-field">
<div className="vd-prompt-head">
<span className="label">// 本场提示词(重跑生效,可编辑)</span>
<span className="mono" style={{ fontSize: "10.5px", color: "var(--black-alpha-48)" }}>系统会自动织入本镜旁白与参考图</span>
<span className="mono" style={{ fontSize: "12px", color: "var(--black-alpha-48)" }}>系统会自动织入本镜旁白与参考图</span>
</div>
<div
className="vd-prompt-edit"
+3 -3
View File
@@ -352,7 +352,7 @@ export function ProductsPage({ products, projects = [], navigate, openProduct, o
</div>
{showGuide && (
<div className="pc-guide-note" style={{ padding: "10px 14px", margin: "0 16px 8px", background: "var(--black-alpha-4)", borderRadius: 8, fontSize: 12.5, lineHeight: 1.7, color: "var(--black-alpha-72)" }}>
<div className="pc-guide-note" style={{ padding: "10px 14px", margin: "0 16px 8px", background: "var(--black-alpha-4)", borderRadius: 8, fontSize: 13, lineHeight: 1.7, color: "var(--black-alpha-72)" }}>
<strong>// 建好商品的 3 步</strong><br />
① 填写商品名称 + 品类(必填,用于脚本/素材生成)<br />
② 上传清晰主图(800×800 以上),便于 AI 出图更准<br />
@@ -744,7 +744,7 @@ export function ProductDetailPage({ product, projects, assets, navigate, onUpdat
{triGenerating ? "生成中…" : "生成"}
</button>
<span style={{ flex: 1 }}></span>
<span className="mono" style={{ fontSize: "11px", color: "var(--black-alpha-56)" }}>~¥0.30 / 次</span>
<span className="mono" style={{ fontSize: "12px", color: "var(--black-alpha-56)" }}>~¥0.30 / 次</span>
</div>
<div className="prod-preview-history" id="ov-tri-history">
<div className="h-lbl">// 历史版本 · <span className="ct" id="ov-tri-history-count">0</span> 版</div>
@@ -831,7 +831,7 @@ export function ProductDetailPage({ product, projects, assets, navigate, onUpdat
))}
<div className="img-upload" id="ov-img-add" title="上传图片" role="button" tabIndex={0} onClick={() => imgInputRef.current?.click()} onKeyDown={(event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); imgInputRef.current?.click(); } }}>
{uploading ? (
<span className="ph-frame" style={{ fontSize: 10 }}>上传中…</span>
<span className="ph-frame" style={{ fontSize: 12 }}>上传中…</span>
) : (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M5 12h14" /></svg>
)}
+1 -1
View File
@@ -608,7 +608,7 @@ export function ProjectsPage({ products, projects, navigate, openPipeline, onDel
<td>
<div className="hstack">
<div className="prog">{[1, 2, 3, 4, 5].map((i) => <span key={i} className={i < no ? "done" : i === no ? "cur" : ""} />)}</div>
<span className="muted-2 mono" style={{ fontSize: "11px" }}>{no}/5</span>
<span className="muted-2 mono" style={{ fontSize: "12px" }}>{no}/5</span>
</div>
</td>
<td><span className={`pill ${projPillClass(project)}`}><span className="dot" />{projStatusLabel(project)}</span></td>
+2 -2
View File
@@ -33,7 +33,7 @@ export type Page =
| "settings"
| "settingsNotify";
export type AuthMode = "login" | "register";
export type AuthMode = "login";
export type ResolvedRoute = {
page: Page;
authMode: AuthMode;
@@ -111,7 +111,7 @@ export function resolveRoute(): ResolvedRoute {
const search = new URLSearchParams(window.location.search);
const hash = window.location.hash.replace("#", "");
if (path === "/register" || hash === "register") return { page: "dashboard", authMode: "register", hash };
if (path === "/register" || hash === "register") return { page: "dashboard", authMode: "login", hash };
if (path === "/login") return { page: "dashboard", authMode: "login", hash };
if (path === "/" && isPage(hash)) return { page: hash, authMode: "login", hash };
if (path === "/" || path === "/dashboard") return { page: "dashboard", authMode: "login", hash };
+1 -1
View File
@@ -288,7 +288,7 @@ export function TeamPage({ team, user, members, billing, notifications = [], nav
<td><span className="quota-cell"><span className="v">{monthly > 0 ? money(monthly) : "不限"}</span></span></td>
<td><div className="quota-cell"><span className="v">{money(memberUsed)}</span> <span className="lbl">/ {monthly > 0 ? `${memberPct.toFixed(0)}%` : "不限"}</span></div><div className="used-bar"><span className={barClass} style={{ width: `${barWidth}%` }}></span></div></td>
<td><div className="acts">{isOwner
? <span style={{ fontFamily: "var(--font-mono)", fontSize: "10.5px", color: "var(--black-alpha-32)", alignSelf: "center" }}>不可编辑</span>
? <span style={{ fontFamily: "var(--font-mono)", fontSize: "12px", color: "var(--black-alpha-32)", alignSelf: "center" }}>不可编辑</span>
: <>
<button className="icon-btn-sm" type="button" title="编辑" onClick={() => openEdit(member)}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z" /></svg></button>
<button className="icon-btn-sm" type="button" title="重置密码" onClick={() => { setResetTarget(member); setResetPwd(""); }}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" /><path d="M7 11V7a5 5 0 0 1 10 0v4" /></svg></button>