feat(digital): 打造星港响应式数字人对话空间
新增角色探索、收藏、世界书和身份资料;接入流式打字、停止重生成、固定记忆、会话分支与导出;适配手机和桌面并保持实验只由后台控制。
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
||||
/* 登录页与数字人前台共享深色金色基调。 */
|
||||
.stellar-login {
|
||||
min-height: 100dvh;
|
||||
background: #141218;
|
||||
color: #f4eef4;
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 1fr;
|
||||
font-family: Inter, "PingFang SC", sans-serif;
|
||||
color-scheme: dark;
|
||||
}
|
||||
.stellar-login-story {
|
||||
padding: 45px 60px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
background:
|
||||
radial-gradient(ellipse at 60% 50%, #8e635644, transparent 65%),
|
||||
linear-gradient(135deg, #281d29, #19141c);
|
||||
border-right: 1px solid #ffffff0b;
|
||||
}
|
||||
.stellar-login-brand {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
color: #e0b888;
|
||||
text-decoration: none;
|
||||
font-size: 38px;
|
||||
align-items: center;
|
||||
}
|
||||
.stellar-login-brand span {
|
||||
font-size: 26px;
|
||||
color: #f4eef4;
|
||||
}
|
||||
.stellar-login-brand small {
|
||||
font-size: 9px;
|
||||
letter-spacing: 3px;
|
||||
display: block;
|
||||
color: #b09da9;
|
||||
}
|
||||
.stellar-login-story > div > p {
|
||||
font-size: 10px;
|
||||
letter-spacing: 4px;
|
||||
color: #e0b888;
|
||||
}
|
||||
.stellar-login-story h1 {
|
||||
font-size: 44px;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
letter-spacing: -1px;
|
||||
margin: 22px 0;
|
||||
}
|
||||
.stellar-login-story > div > span {
|
||||
font-size: 14px;
|
||||
line-height: 2;
|
||||
color: #b5a6b7;
|
||||
}
|
||||
.stellar-login-story > small {
|
||||
font-size: 11px;
|
||||
color: #9b879e;
|
||||
}
|
||||
.stellar-login-panel {
|
||||
max-width: 470px;
|
||||
width: 100%;
|
||||
padding: 70px 40px;
|
||||
margin: auto;
|
||||
}
|
||||
.stellar-login-panel h2 {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.stellar-login-panel > p {
|
||||
font-size: 12px;
|
||||
color: #aa9aaf;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
.stellar-login-star {
|
||||
font-size: 45px;
|
||||
color: #e0b888;
|
||||
}
|
||||
.stellar-login-panel > .login-form {
|
||||
gap: 20px;
|
||||
}
|
||||
.stellar-login-panel .login-form label {
|
||||
color: #c5b7c9;
|
||||
font-size: 12px;
|
||||
}
|
||||
.stellar-login-panel .input-wrap {
|
||||
background: #211c25;
|
||||
border: 1px solid #ffffff18;
|
||||
border-radius: 10px;
|
||||
color: #ac9bb2;
|
||||
}
|
||||
.stellar-login-panel .input-wrap:focus-within {
|
||||
border-color: #e0b88888;
|
||||
}
|
||||
.stellar-login-panel input {
|
||||
color: #f4eef4;
|
||||
font-size: 16px;
|
||||
background: none;
|
||||
}
|
||||
.stellar-login-panel input::placeholder {
|
||||
color: #796d80;
|
||||
}
|
||||
.stellar-login-panel .primary-button {
|
||||
background: #e0b888;
|
||||
color: #2b1d11;
|
||||
border-radius: 10px;
|
||||
min-height: 46px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.stellar-login-panel > small {
|
||||
display: block;
|
||||
text-align: center;
|
||||
color: #776a7d;
|
||||
font-size: 10px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
.stellar-login-panel .form-error {
|
||||
color: #ffa6a6;
|
||||
}
|
||||
.stellar-login-panel .icon-button {
|
||||
color: #b3a1b9;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.stellar-login {
|
||||
grid-template-columns: 1fr;
|
||||
min-height: 100dvh;
|
||||
}
|
||||
.stellar-login-story {
|
||||
padding: 30px 25px 22px;
|
||||
border: 0;
|
||||
background: radial-gradient(ellipse at 80% 50%, #8e635638, transparent 70%);
|
||||
}
|
||||
.stellar-login-brand {
|
||||
font-size: 25px;
|
||||
}
|
||||
.stellar-login-brand span {
|
||||
font-size: 21px;
|
||||
}
|
||||
.stellar-login-brand small {
|
||||
display: none;
|
||||
}
|
||||
.stellar-login-story > div {
|
||||
padding-top: 30px;
|
||||
}
|
||||
.stellar-login-story h1 {
|
||||
font-size: 29px;
|
||||
line-height: 1.5;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.stellar-login-story > div > p {
|
||||
font-size: 8px;
|
||||
letter-spacing: 3px;
|
||||
}
|
||||
.stellar-login-story > div > span {
|
||||
display: none;
|
||||
}
|
||||
.stellar-login-story > small {
|
||||
display: none;
|
||||
}
|
||||
.stellar-login-panel {
|
||||
padding: 12px 25px 45px;
|
||||
max-width: 470px;
|
||||
}
|
||||
.stellar-login-star {
|
||||
display: none;
|
||||
}
|
||||
.stellar-login-panel h2 {
|
||||
font-size: 21px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.stellar-login-panel > p {
|
||||
font-size: 11px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
body:has(.stellar-login) .environment-badge {
|
||||
display: none;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,11 @@
|
||||
"use client";
|
||||
|
||||
/** 复用原有账号登录,成功后进入数字人空间。 */
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Eye, EyeOff, LockKeyhole, Smartphone } from "lucide-react";
|
||||
import { FormEvent, useState } from "react";
|
||||
|
||||
/** 现有账号的登录表单,不保存明文密码。 */
|
||||
export function LoginForm() {
|
||||
const router = useRouter();
|
||||
const [error, setError] = useState("");
|
||||
@@ -16,38 +18,45 @@ export function LoginForm() {
|
||||
setPending(true);
|
||||
|
||||
const formData = new FormData(event.currentTarget);
|
||||
const response = await fetch("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
username: String(formData.get("username") || "").trim(),
|
||||
password: String(formData.get("password") || "")
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const payload = (await response.json().catch(() => null)) as { message?: string } | null;
|
||||
setError(payload?.message || "登录失败,请检查手机号和密码");
|
||||
try {
|
||||
const response = await fetch("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
username: String(formData.get("username") || "").trim(),
|
||||
password: String(formData.get("password") || ""),
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const payload = await response.json().catch(() => null);
|
||||
throw new Error(payload?.message || "登录失败,请检查账号和密码");
|
||||
}
|
||||
router.replace("/discover");
|
||||
router.refresh();
|
||||
} catch (error) {
|
||||
setError(
|
||||
error instanceof TypeError
|
||||
? "网络连接失败,请稍后重试"
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: "登录失败,请重试",
|
||||
);
|
||||
} finally {
|
||||
setPending(false);
|
||||
return;
|
||||
}
|
||||
|
||||
router.replace("/dashboard");
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="login-form" onSubmit={handleSubmit}>
|
||||
<label>
|
||||
<span>手机号</span>
|
||||
<span>登录账号</span>
|
||||
<div className="input-wrap">
|
||||
<Smartphone aria-hidden size={18} />
|
||||
<input
|
||||
autoComplete="username"
|
||||
defaultValue="13211111111"
|
||||
inputMode="tel"
|
||||
inputMode="text"
|
||||
name="username"
|
||||
placeholder="请输入员工手机号"
|
||||
placeholder="请输入账号"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
@@ -58,7 +67,6 @@ export function LoginForm() {
|
||||
<LockKeyhole aria-hidden size={18} />
|
||||
<input
|
||||
autoComplete="current-password"
|
||||
defaultValue="pw111111"
|
||||
name="password"
|
||||
placeholder="请输入登录密码"
|
||||
required
|
||||
@@ -70,7 +78,11 @@ export function LoginForm() {
|
||||
onClick={() => setPasswordVisible((visible) => !visible)}
|
||||
type="button"
|
||||
>
|
||||
{passwordVisible ? <EyeOff aria-hidden size={18} /> : <Eye aria-hidden size={18} />}
|
||||
{passwordVisible ? (
|
||||
<EyeOff aria-hidden size={18} />
|
||||
) : (
|
||||
<Eye aria-hidden size={18} />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user