From 56f6fa0ef1e422fd2e777fb3d82300ca66183e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Fri, 10 Oct 2025 17:35:18 +0800 Subject: [PATCH] =?UTF-8?q?review=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 20 +- api/movie_queue.ts | 12 +- ...ueueNotication.tsx => QueueNotication.tsx} | 12 +- components/QueueBox/QueueNotification2.tsx | 237 ------------------ components/pages/work-flow/H5MediaViewer.tsx | 8 +- components/pages/work-flow/H5ProgressBar.tsx | 1 - .../pages/work-flow/use-workflow-data.tsx | 11 +- 7 files changed, 27 insertions(+), 274 deletions(-) rename components/QueueBox/{H5QueueNotication.tsx => QueueNotication.tsx} (95%) delete mode 100644 components/QueueBox/QueueNotification2.tsx diff --git a/.env.production b/.env.production index 1720734..24e6f58 100644 --- a/.env.production +++ b/.env.production @@ -1,16 +1,16 @@ # 测试 -NEXT_PUBLIC_JAVA_URL = https://auth.test.movieflow.ai -NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com -NEXT_PUBLIC_CUT_URL = https://77.smartcut.py.qikongjian.com -NEXT_PUBLIC_GOOGLE_REDIRECT_URI=https://www.movieflow.net/api/auth/google/callback -NEXT_PUBLIC_CUT_URL_TO = https://smartcut.huiying.video +# NEXT_PUBLIC_JAVA_URL = https://auth.test.movieflow.ai +# NEXT_PUBLIC_BASE_URL = https://77.smartvideo.py.qikongjian.com +# NEXT_PUBLIC_CUT_URL = https://77.smartcut.py.qikongjian.com +# NEXT_PUBLIC_GOOGLE_REDIRECT_URI=https://www.movieflow.net/api/auth/google/callback +# NEXT_PUBLIC_CUT_URL_TO = https://smartcut.huiying.video # 生产 -# NEXT_PUBLIC_JAVA_URL = https://auth.movieflow.ai -# NEXT_PUBLIC_BASE_URL = https://api.video.movieflow.ai -# NEXT_PUBLIC_CUT_URL = https://smartcut.api.movieflow.ai -# NEXT_PUBLIC_GOOGLE_REDIRECT_URI=https://www.movieflow.ai/api/auth/google/callback -# NEXT_PUBLIC_CUT_URL_TO = https://smartcut.movieflow.ai +NEXT_PUBLIC_JAVA_URL = https://auth.movieflow.ai +NEXT_PUBLIC_BASE_URL = https://api.video.movieflow.ai +NEXT_PUBLIC_CUT_URL = https://smartcut.api.movieflow.ai +NEXT_PUBLIC_GOOGLE_REDIRECT_URI=https://www.movieflow.ai/api/auth/google/callback +NEXT_PUBLIC_CUT_URL_TO = https://smartcut.movieflow.ai # 通用 # 当前域名配置 NEXT_PUBLIC_FRONTEND_URL = https://www.movieflow.ai diff --git a/api/movie_queue.ts b/api/movie_queue.ts index a20d442..30a80cd 100644 --- a/api/movie_queue.ts +++ b/api/movie_queue.ts @@ -1,6 +1,5 @@ import { ApiResponse } from './common'; -import { showH5QueueNotification } from '../components/QueueBox/H5QueueNotication'; -import { notification } from 'antd'; +import { showQueueNotification } from '../components/QueueBox/QueueNotication'; /** 队列状态枚举 */ export enum QueueStatus { @@ -75,7 +74,6 @@ export async function withQueuePolling( const cancel = () => { isCancelled = true; try { closeModal?.(); } catch {} - notification.destroy(); // 兼容旧弹层 onCancel?.(); cancelTokens.delete(pollId); }; @@ -104,14 +102,14 @@ export async function withQueuePolling( position !== undefined && waiting !== undefined) { // 打开或更新 H5 弹窗(仅允许 Cancel 关闭,Refresh 触发刷新) try { closeModal?.(); } catch {} - closeModal = showH5QueueNotification( + closeModal = showQueueNotification( position, waiting, status, cancel, async () => { // 触发一次立刻刷新:重置 attempts 的等待,直接递归调用 poll() - // 不关闭弹窗,由 showH5QueueNotification 保持打开 + // 不关闭弹窗,由 showQueueNotification 保持打开 attempts = Math.max(0, attempts - 1); } ); @@ -123,7 +121,6 @@ export async function withQueuePolling( // 检查是否达到最大尝试次数 if (attempts >= maxAttempts) { - notification.destroy(); // 关闭通知 throw new Error('Exceeded the maximum polling limit'); } @@ -135,17 +132,14 @@ export async function withQueuePolling( // 如果状态为ready,结束轮询 if (response.code !== 202 && response.data) { try { closeModal?.(); } catch {} - notification.destroy(); // 兼容旧弹层 onSuccess?.(response.data); return response; } try { closeModal?.(); } catch {} - notification.destroy(); // 兼容旧弹层 return response; } catch (error) { try { closeModal?.(); } catch {} - notification.destroy(); // 兼容旧弹层 if (error instanceof Error) { onError?.(error); } diff --git a/components/QueueBox/H5QueueNotication.tsx b/components/QueueBox/QueueNotication.tsx similarity index 95% rename from components/QueueBox/H5QueueNotication.tsx rename to components/QueueBox/QueueNotication.tsx index 4fd062a..0f32745 100644 --- a/components/QueueBox/H5QueueNotication.tsx +++ b/components/QueueBox/QueueNotication.tsx @@ -14,7 +14,7 @@ interface H5QueueNotificationProps { onClose?: () => void; } -function H5QueueNotificationModal(props: H5QueueNotificationProps) { +function QueueNotificationModal(props: H5QueueNotificationProps) { const { position, estimatedMinutes, status, onCancel, onClose } = props; const containerRef = useRef(null); @@ -39,11 +39,11 @@ function H5QueueNotificationModal(props: H5QueueNotificationProps) { return (
{/* 去除右上角关闭按钮,避免除取消以外的关闭路径 */} @@ -116,7 +116,7 @@ function H5QueueNotificationModal(props: H5QueueNotificationProps) { * @param {() => void} onCancel - Callback when user confirms cancel. * @returns {() => void} - Close function to dismiss the modal programmatically. */ -export function showH5QueueNotification( +export function showQueueNotification( position: number, estimatedMinutes: number, status: QueueStatus, @@ -128,7 +128,7 @@ export function showH5QueueNotification( } const mount = document.createElement('div'); - mount.setAttribute('data-alt', 'h5-queue-root'); + mount.setAttribute('data-alt', 'queue-root'); document.body.appendChild(mount); let root: Root | null = null; @@ -151,7 +151,7 @@ export function showH5QueueNotification( }; root.render( - ( -
- - {/* AI导演的圆形头部 */} - - {/* 眼睛 */} - - - {/* 笑容 */} - - {/* 导演帽 */} - - {/* 身体 */} - - {/* 手臂 - 动画中会移动 */} - - - -
-); - -/** 工作进度条组件 */ -const ProgressTimeline = () => ( -
-
-
-); - -/** 工作台元素组件 */ -const Workstation = () => ( -
- {/* 小型场景图标,会在动画中浮动 */} - {[...Array(3)].map((_, i) => ( -
- ))} -
-); - -/** - * 显示队列等待通知 - * @param position - 当前队列位置 - * @param estimatedMinutes - 预计等待分钟数 - */ -export const showQueueNotification = ( - position: number, - estimatedMinutes: number, - status: string, - onCancel: () => void -) => { - const notificationKey = 'queueNotification'; - - // 创建或更新通知内容 - const notificationContent = ( -
- {/* AI导演工作室场景 */} -
- - - -
- - {/* 队列信息 */} -
- 🎬 - {status === 'process' ? `Your work is being produced. Please wait until it is completed before creating a new work.` : `Your work is waiting for production at the ${position} position`} -
- - {/* 预计等待时间 */} -
- {status !== 'process' && `Estimated waiting time: about ${estimatedMinutes} minutes`} -
- - {/* 取消按钮 */} - -
- ); - - // 打开或更新通知 - notification.open({ - key: notificationKey, - message: null, - description: notificationContent, - duration: 0, - placement: 'topRight', - style: { - ...darkGlassStyle, - border: '1px solid rgba(246, 178, 102, 0.2)', - }, - className: 'director-studio-notification', - closeIcon: null, - }); -}; - -// 添加必要的CSS动画 -const styles = ` - .ai-director { - animation: bounce 2s ease-in-out infinite; - } - - .director-arm { - transform-origin: center; - animation: wave 1s ease-in-out infinite alternate; - } - - @keyframes bounce { - 0%, 100% { transform: translateY(0); } - 50% { transform: translateY(-5px); } - } - - @keyframes wave { - 0% { transform: rotate(-5deg); } - 100% { transform: rotate(5deg); } - } - - @keyframes float { - 0% { transform: translateY(0); } - 100% { transform: translateY(-10px); } - } - - @keyframes progress { - 0% { width: 0%; } - 50% { width: 60%; } - 100% { width: 30%; } - } - - .director-studio-notification { - animation: slideIn 0.3s ease-out; - } - - @keyframes slideIn { - from { transform: translateX(100%); opacity: 0; } - to { transform: translateX(0); opacity: 1; } - } - - .scene-0 { animation-delay: 0s; } - .scene-1 { animation-delay: 0.2s; } - .scene-2 { animation-delay: 0.4s; } -`; - -// 将样式注入到页面 -if (typeof document !== 'undefined') { - const styleSheet = document.createElement('style'); - styleSheet.textContent = styles; - document.head.appendChild(styleSheet); -} - -// 配置通知 -notification.config({ - maxCount: 3, -}); \ No newline at end of file diff --git a/components/pages/work-flow/H5MediaViewer.tsx b/components/pages/work-flow/H5MediaViewer.tsx index d159c9d..c66f7ec 100644 --- a/components/pages/work-flow/H5MediaViewer.tsx +++ b/components/pages/work-flow/H5MediaViewer.tsx @@ -369,9 +369,6 @@ export function H5MediaViewer({