fix: 全站页面保活机制、登录拦截优化、UI修复与功能完善
- 移除未登录全页面拦截,改为浏览自由 + 功能使用时弹窗 - 修复PageTransition退出动画卡死导致黑屏的bug - CanvasPage添加加载中状态避免首次访问黑屏假死 - 全站7个工具页添加页面保活机制,切页后台任务不中断 - 修复未登录时401误触发"用户已在别处登录"弹窗 - 删除MorePage模板板块、微信登录、EcommerceTemplates/SizeTemplate路由 - 剧本评分接入DashScope qwen3.7-max直连API - 电商视频生成重构为3阶段可视管线(策划→生成图片→生成视频) - 电商视频保活增强:异步函数直接写localStorage避免卸载丢失 - Workbench侧边栏移除mode过滤,三模式共用同一对话列表 - 首页更新轮播图/背景视频、按钮跳转修正、文案优化 - AppShell顶栏新增网站备案信息按钮 - 多个页面的terminate/cancel按钮覆盖、单镜头重试、批量保存下载 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
SafetyOutlined,
|
||||
ShareAltOutlined,
|
||||
UserOutlined,
|
||||
WechatOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useEffect, useRef, useState, type ChangeEvent, type FormEvent } from "react";
|
||||
import { aiGenerationClient } from "../../api/aiGenerationClient";
|
||||
@@ -37,7 +36,7 @@ interface ProfilePageProps {
|
||||
onDeleteProject?: (project: WebProjectSummary) => void;
|
||||
}
|
||||
|
||||
type AuthTab = "password" | "email" | "phone" | "wechat";
|
||||
type AuthTab = "password" | "email" | "phone";
|
||||
type ProfilePanel = "works" | "projects" | "assets" | "community";
|
||||
type AccountPanel = "credits" | "tasks";
|
||||
|
||||
@@ -170,8 +169,6 @@ function ProfilePage({
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [smsCooldown, setSmsCooldown] = useState(0);
|
||||
const [isSendingSms, setIsSendingSms] = useState(false);
|
||||
const [wechatTicket, setWechatTicket] = useState<{ url?: string; state?: string; message?: string; configured?: boolean } | null>(null);
|
||||
const [wechatStatus, setWechatStatus] = useState<string | null>(null);
|
||||
|
||||
const [activePanel, setActivePanel] = useState<ProfilePanel>("works");
|
||||
const [accountPanel, setAccountPanel] = useState<AccountPanel>("credits");
|
||||
@@ -248,55 +245,6 @@ function ProfilePage({
|
||||
return () => window.clearInterval(timer);
|
||||
}, [smsCooldown]);
|
||||
|
||||
useEffect(() => {
|
||||
if (authTab !== "wechat" || isLoggedIn) return;
|
||||
|
||||
let cancelled = false;
|
||||
let pollTimer: number | undefined;
|
||||
|
||||
const startWechatLogin = async () => {
|
||||
setWechatStatus("正在创建微信登录二维码...");
|
||||
setWechatTicket(null);
|
||||
try {
|
||||
const ticket = await keyServerClient.getWechatLoginTicket();
|
||||
if (cancelled) return;
|
||||
setWechatTicket(ticket);
|
||||
if (!ticket.configured || !ticket.url || !ticket.state) {
|
||||
setWechatStatus(ticket.message || "微信登录暂未配置");
|
||||
return;
|
||||
}
|
||||
setWechatStatus("请使用微信扫码登录");
|
||||
pollTimer = window.setInterval(() => {
|
||||
void keyServerClient
|
||||
.getWechatLoginSession(ticket.state!)
|
||||
.then(async (result) => {
|
||||
if (cancelled) return;
|
||||
if (result.status === "completed" && result.session) {
|
||||
if (pollTimer) window.clearInterval(pollTimer);
|
||||
setWechatStatus("微信登录成功,正在进入工作台...");
|
||||
await onAuthComplete?.(result.session);
|
||||
} else if (result.status !== "pending") {
|
||||
if (pollTimer) window.clearInterval(pollTimer);
|
||||
setWechatStatus(result.error || "微信登录已失效,请刷新二维码");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!cancelled) setWechatStatus(error instanceof Error ? error.message : "微信登录状态查询失败");
|
||||
});
|
||||
}, 2000);
|
||||
} catch (error) {
|
||||
if (!cancelled) setWechatStatus(error instanceof Error ? error.message : "微信登录二维码创建失败");
|
||||
}
|
||||
};
|
||||
|
||||
void startWechatLogin();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
if (pollTimer) window.clearInterval(pollTimer);
|
||||
};
|
||||
}, [authTab, isLoggedIn, onAuthComplete]);
|
||||
|
||||
const handleSendSms = async () => {
|
||||
if (smsCooldown > 0 || !phone.trim() || isSendingSms) return;
|
||||
if (mode === "register" && !betaCode.trim()) {
|
||||
@@ -359,7 +307,7 @@ function ProfilePage({
|
||||
|
||||
const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (isSubmitting || authTab === "wechat") return;
|
||||
if (isSubmitting) return;
|
||||
|
||||
const errors: Record<string, string> = {};
|
||||
if (mode === "register") {
|
||||
@@ -814,9 +762,6 @@ function ProfilePage({
|
||||
<button type="button" className={authTab === "phone" ? "is-active" : ""} onClick={() => { setAuthTab("phone"); setFieldErrors({}); }}>
|
||||
<MobileOutlined /> 手机验证码
|
||||
</button>
|
||||
<button type="button" className={authTab === "wechat" ? "is-active" : ""} onClick={() => { setAuthTab("wechat"); setFieldErrors({}); }}>
|
||||
<WechatOutlined /> 微信
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{pendingActionLabel ? (
|
||||
@@ -827,7 +772,7 @@ function ProfilePage({
|
||||
) : null}
|
||||
|
||||
<form className="auth-page__form" onSubmit={(event) => void handleSubmit(event)}>
|
||||
{mode === "register" && authTab !== "wechat" ? (
|
||||
{mode === "register" ? (
|
||||
<label className={`auth-page__field${fieldErrors.betaCode ? " auth-page__field--error" : ""}`}>
|
||||
<span>
|
||||
<SafetyOutlined /> 企业邀请码 / 内测码
|
||||
@@ -967,35 +912,11 @@ function ProfilePage({
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{authTab === "wechat" ? (
|
||||
<div className="auth-page__wechat-qr">
|
||||
<div className="auth-page__qr-placeholder">
|
||||
{wechatTicket?.url ? (
|
||||
<>
|
||||
<iframe className="auth-page__wechat-frame" title="微信扫码登录" src={wechatTicket.url} />
|
||||
<a className="auth-page__wechat-link" href={wechatTicket.url} target="_blank" rel="noreferrer">
|
||||
新窗口打开二维码
|
||||
</a>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<WechatOutlined />
|
||||
<span>微信扫码登录</span>
|
||||
<p>{wechatStatus || "正在准备微信登录"}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{wechatStatus ? <p className="auth-page__wechat-status">{wechatStatus}</p> : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{notice ? <p className="auth-page__notice">{notice}</p> : null}
|
||||
|
||||
{authTab !== "wechat" ? (
|
||||
<button type="submit" className="auth-page__submit" disabled={isSubmitting}>
|
||||
{isSubmitting ? "处理中..." : mode === "login" ? "登录" : "注册"}
|
||||
</button>
|
||||
) : null}
|
||||
<button type="submit" className="auth-page__submit" disabled={isSubmitting}>
|
||||
{isSubmitting ? "处理中..." : mode === "login" ? "登录" : "注册"}
|
||||
</button>
|
||||
|
||||
<div className="auth-page__agreement">
|
||||
<span>
|
||||
@@ -1009,9 +930,6 @@ function ProfilePage({
|
||||
</div>
|
||||
|
||||
<div className="auth-page__social">
|
||||
<button type="button" className="auth-page__social-btn" title="微信登录" onClick={() => setAuthTab("wechat")}>
|
||||
<WechatOutlined />
|
||||
</button>
|
||||
<button type="button" className="auth-page__social-btn" title="手机号登录" onClick={() => setAuthTab("phone")}>
|
||||
<MobileOutlined />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user