From 3635e67c0a88e9a5fc13d384fcb5cb82547b1558 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: Mon, 18 Aug 2025 20:20:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9F=A5=E7=9C=8B=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E4=B8=8B=E8=A7=86=E9=A2=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/video_flow.ts | 5 +- app/service/Interaction/RoleShotService.ts | 2 +- app/service/domain/Entities.ts | 2 +- components/ui/replace-panel.tsx | 92 +++++++++------------- 4 files changed, 41 insertions(+), 60 deletions(-) diff --git a/api/video_flow.ts b/api/video_flow.ts index 218f41e..f24c9ac 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -987,7 +987,7 @@ export const batchUpdateVideoSegments = async (request: { /** 新的视频地址列表 */ video_urls: string[]; /** 新的状态 0:视频加载中 1:任务已完成 2:任务失败 */ - status: number; + status: number | null; /** 优化后的描述文本 */ optimized_description?: string; /** 关键词列表 */ @@ -1033,7 +1033,8 @@ export const getCharacterShots = async (request: { video_id: string; video_status: number|null; }[]; - + /** 视频状态 */ + video_status: number|null; }>; /** 总数量 */ total_count: number; diff --git a/app/service/Interaction/RoleShotService.ts b/app/service/Interaction/RoleShotService.ts index 2726b1c..4c75ed1 100644 --- a/app/service/Interaction/RoleShotService.ts +++ b/app/service/Interaction/RoleShotService.ts @@ -98,7 +98,7 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity, name: `视频片段_${scene.video_id}`, sketchUrl: "", videoUrl: scene.video_urls,// 保持为string[]类型 - status:scene.video_urls.length>0?1:0, // 默认为已完成状态 + status: scene.video_status !== null? scene.video_status : scene.video_urls.length>0?1:0, // 默认为已完成状态 lens: [], selected: false, applied: true // 由于是通过角色查询到的,所以都是已应用的 diff --git a/app/service/domain/Entities.ts b/app/service/domain/Entities.ts index 93fa67d..d7139f5 100644 --- a/app/service/domain/Entities.ts +++ b/app/service/domain/Entities.ts @@ -88,7 +88,7 @@ export interface VideoSegmentEntity { video_status: number | null; }[]; /**视频片段状态 0:视频加载中 1:任务已完成 2:任务失败 */ - status: number; + status: number|null; /**镜头项 */ lens: LensType[]; } diff --git a/components/ui/replace-panel.tsx b/components/ui/replace-panel.tsx index c27dce2..7487fd3 100644 --- a/components/ui/replace-panel.tsx +++ b/components/ui/replace-panel.tsx @@ -1,6 +1,6 @@ -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { Check, X, CircleAlert, ArrowLeft, ArrowRight } from 'lucide-react'; +import { Check, X, CircleAlert, ArrowLeft, ArrowRight, Loader2 } from 'lucide-react'; import { cn } from '@/public/lib/utils'; import { throttle } from 'lodash'; @@ -30,33 +30,12 @@ export function ReplacePanel({ ); const [addToLibrary, setAddToLibrary] = useState(false); const [hoveredVideoId, setHoveredVideoId] = useState(null); - const [isAtStart, setIsAtStart] = useState(true); - const [isAtEnd, setIsAtEnd] = useState(false); const videoRefs = useRef<{ [key: string]: HTMLVideoElement }>({}); const shotsRef = useRef(null); - // 检查滚动位置 - const checkScrollPosition = () => { - if (!shotsRef.current) return; - - const { scrollLeft, scrollWidth, clientWidth } = shotsRef.current; - setIsAtStart(scrollLeft <= 0); - setIsAtEnd(Math.ceil(scrollLeft + clientWidth) >= scrollWidth); - }; - - // 添加滚动事件监听 - React.useEffect(() => { - const shotsElement = shotsRef.current; - if (!shotsElement) return; - - shotsElement.addEventListener('scroll', checkScrollPosition); - // 初始检查 - checkScrollPosition(); - - return () => { - shotsElement.removeEventListener('scroll', checkScrollPosition); - }; - }, []); + useEffect(() => { + console.log('replace-panel-shots', shots); + }, [shots]); const handleShotToggle = (shotId: string) => { // setSelectedShots(prev => @@ -66,10 +45,6 @@ export function ReplacePanel({ // ); }; - const handleSelectAllShots = (checked: boolean) => { - setSelectedShots(checked ? shots.map(shot => shot.id) : []); - }; - const handleMouseEnter = (shotId: string) => { setHoveredVideoId(shotId); if (videoRefs.current[shotId]) { @@ -173,29 +148,34 @@ export function ReplacePanel({ whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} > - {shot.videoUrl && shot.videoUrl.length > 0 && ( -