468d1d27dd
- 移除未登录全页面拦截,改为浏览自由 + 功能使用时弹窗 - 修复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>
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import type {
|
|
EcommerceVideoStage,
|
|
EcommerceVideoSceneTask,
|
|
EcommerceVideoPlanResult,
|
|
PlanStep,
|
|
} from "./ecommerceVideoTypes";
|
|
|
|
const KEEPALIVE_KEY = "omniai:ecommerce-video-workspace";
|
|
|
|
interface EcommerceVideoKeepalive {
|
|
stage: EcommerceVideoStage;
|
|
completedSteps: PlanStep[];
|
|
planResult: EcommerceVideoPlanResult | null;
|
|
scenes: EcommerceVideoSceneTask[];
|
|
sourceImageUrls: string[];
|
|
savedAt: number;
|
|
}
|
|
|
|
export function saveEcommerceVideoState(state: {
|
|
stage: EcommerceVideoStage;
|
|
completedSteps: PlanStep[];
|
|
planResult: EcommerceVideoPlanResult | null;
|
|
scenes: EcommerceVideoSceneTask[];
|
|
sourceImageUrls?: string[];
|
|
}): void {
|
|
try {
|
|
const entry: EcommerceVideoKeepalive = {
|
|
...state,
|
|
sourceImageUrls: state.sourceImageUrls || [],
|
|
savedAt: Date.now(),
|
|
};
|
|
window.localStorage.setItem(KEEPALIVE_KEY, JSON.stringify(entry));
|
|
} catch {
|
|
// quota exceeded — silently drop
|
|
}
|
|
}
|
|
|
|
export function loadEcommerceVideoState(): EcommerceVideoKeepalive | null {
|
|
try {
|
|
const raw = window.localStorage.getItem(KEEPALIVE_KEY);
|
|
if (!raw) return null;
|
|
const parsed = JSON.parse(raw) as EcommerceVideoKeepalive;
|
|
// Discard entries older than 2 hours
|
|
if (Date.now() - (parsed.savedAt || 0) > 2 * 60 * 60 * 1000) {
|
|
clearEcommerceVideoState();
|
|
return null;
|
|
}
|
|
return parsed;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function clearEcommerceVideoState(): void {
|
|
try {
|
|
window.localStorage.removeItem(KEEPALIVE_KEY);
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|