diff --git a/api/script_episode.ts b/api/script_episode.ts index 6edae57..72dd527 100644 --- a/api/script_episode.ts +++ b/api/script_episode.ts @@ -63,12 +63,50 @@ export interface ScriptEpisode { // 创建剧集 export const createScriptEpisode = async (data: CreateScriptEpisodeRequest): Promise> => { - return post>('/script_episode/create', data); + // return post>('/script_episode/create', data); + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + code: 0, + message: 'success', + data: { + id: 1, + title: 'test', + script_id: 1, + status: 1, + episode_sort: 1, + creator_name: 'king', + created_at: '2025-07-03 10:00:00', + updated_at: '2025-07-03 10:00:00' + }, + successful: true + }); + }, 1000); + }); }; // 更新剧集 export const updateScriptEpisode = async (data: UpdateScriptEpisodeRequest): Promise> => { - return post>('/script_episode/update', data); + // return post>('/script_episode/update', data); + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + code: 0, + message: 'success', + data: { + id: 1, + title: 'test', + script_id: 1, + status: 1, + episode_sort: 1, + creator_name: 'king', + created_at: '2025-07-03 10:00:00', + updated_at: '2025-07-03 10:00:00' + }, + successful: true + }); + }, 0); + }); }; // 获取剧集详情 diff --git a/api/script_project.ts b/api/script_project.ts index 138456a..41263b8 100644 --- a/api/script_project.ts +++ b/api/script_project.ts @@ -72,7 +72,31 @@ export interface DeleteScriptProjectRequest { // 创建剧本项目 export const createScriptProject = async (data: CreateScriptProjectRequest): Promise> => { - return post>('/script_project/create', data); + // return post>('/script_project/create', data); + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + code: 0, + message: 'success', + data: { + id: 1, + title: '2025·07·03·001', + script_author: 'king', + characters: [], + summary: '', + project_type: 1, + status: 1, + cate_tags: [], + creator_name: 'king', + mode: 1, + resolution: 1, + created_at: '2025-07-03 10:00:00', + updated_at: '2025-07-03 10:00:00' + }, + successful: true + }); + }, 0); + }); }; // 获取剧本项目列表 diff --git a/api/video_flow.ts b/api/video_flow.ts index 8957099..91b381c 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -60,7 +60,25 @@ export type ConvertScenePromptResponse = ApiResponse; export const convertScenePrompt = async ( request: ConvertScenePromptRequest ): Promise => { - return post('/video_flow/convert-scene-prompts', request); + // return post('/video_flow/convert-scene-prompts', request); + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + code: 0, + message: 'success', + data: { + scenes: [], + characters: [], + summary: '', + scene: '', + atmosphere: '', + episode_id: 0, + total_shots: '' + }, + successful: true + }); + }, 0); + }); }; /** diff --git a/components/video-grid-layout.tsx b/components/video-grid-layout.tsx index 5665864..94dc84d 100644 --- a/components/video-grid-layout.tsx +++ b/components/video-grid-layout.tsx @@ -1,6 +1,6 @@ 'use client'; // Add this to ensure it's a client component -import React, { useState } from 'react'; +import React, { useState, useRef } from 'react'; import { Edit2, Trash2, Play, Volume2, VolumeX } from 'lucide-react'; import { Button } from '@/components/ui/button'; import dynamic from 'next/dynamic'; @@ -20,6 +20,7 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP const [hoveredId, setHoveredId] = useState(null); const [isPlaying, setIsPlaying] = useState<{ [key: string]: boolean }>({}); const [isMuted, setIsMuted] = useState<{ [key: string]: boolean }>({}); + const videoRefs = useRef<{ [key: string]: HTMLVideoElement | null }>({}); const handleMouseEnter = (id: string) => { setHoveredId(id); @@ -28,7 +29,7 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP const handleMouseLeave = (id: string) => { setHoveredId(null); // 暂停视频并重新静音以便下次预览 - const video = document.getElementById(`video-${id}`) as HTMLVideoElement; + const video = videoRefs.current[id]; if (video) { video.pause(); video.muted = true; @@ -38,7 +39,7 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP }; const togglePlay = (id: string) => { - const video = document.getElementById(`video-${id}`) as HTMLVideoElement; + const video = videoRefs.current[id]; if (video) { if (video.paused) { // 在用户主动播放时取消静音 @@ -55,7 +56,7 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP const toggleMute = (id: string, event: React.MouseEvent) => { event.stopPropagation(); // 防止触发父元素的点击事件 - const video = document.getElementById(`video-${id}`) as HTMLVideoElement; + const video = videoRefs.current[id]; if (video) { video.muted = !video.muted; setIsMuted(prev => ({ ...prev, [id]: video.muted })); @@ -74,7 +75,7 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP {/* 视频容器 */}