From a0b4d75548179ce6d556306eef1cd6254122b6ac 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: Wed, 13 Aug 2025 03:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=BA=E7=89=A9=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=96=B0=E5=A2=9EtriggerSu?= =?UTF-8?q?ccess=E5=B1=9E=E6=80=A7=E4=BB=A5=E4=BC=98=E5=8C=96=E6=9C=AA?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=87=BA=E4=BA=BA=E5=83=8F=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=89=AB=E6=8F=8F=E7=8A=B6=E6=80=81=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B6=85=E6=97=B6=E5=92=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E5=92=8C=E4=BB=A3=E7=A0=81=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/person-detection.tsx | 6 ++++-- components/ui/shot-tab-content.tsx | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/ui/person-detection.tsx b/components/ui/person-detection.tsx index 62a3bbe..f1ef4fe 100644 --- a/components/ui/person-detection.tsx +++ b/components/ui/person-detection.tsx @@ -45,6 +45,7 @@ type Props = { videoSrc?: string; detections: PersonDetection[]; triggerScan: boolean; + triggerSuccess: boolean; onScanStart?: (currentTime?: number) => void; onScanTimeout?: () => void; onScanExit?: () => void; // 扫描退出回调 @@ -59,6 +60,7 @@ export const PersonDetectionScene: React.FC = ({ videoSrc, detections, triggerScan, + triggerSuccess, onScanStart, onScanTimeout, onScanExit, @@ -375,8 +377,8 @@ export const PersonDetectionScene: React.FC = ({ {/* 人物识别框和浮签 */} - {detections.length === 0 && ( -
+ {detections.length === 0 && triggerSuccess && ( +
未识别出人像
)} diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 54abe81..480466a 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -37,7 +37,7 @@ export function ShotTabContent({ const [selectedIndex, setSelectedIndex] = useState(currentSketchIndex); const [detections, setDetections] = useState([]); - const [scanState, setScanState] = useState<'idle' | 'scanning' | 'detected'>('idle'); + const [scanState, setScanState] = useState<'idle' | 'scanning' | 'detected' | 'failed' | 'timeout'>('idle'); const [isScanFailed, setIsScanFailed] = useState(false); const [isLoadingLibrary, setIsLoadingLibrary] = useState(false); const [isReplaceLibraryOpen, setIsReplaceLibraryOpen] = useState(false); @@ -82,10 +82,10 @@ export function ShotTabContent({ } }; - // 处理扫描超时/失败 + // 处理扫描超时 const handleScanTimeout = () => { setIsScanFailed(true); - setScanState('detected'); + setScanState('timeout'); setDetections([]); }; @@ -97,9 +97,10 @@ export function ShotTabContent({ // 处理检测到结果 const handleDetectionsChange = (newDetections: PersonDetection[]) => { - if (newDetections.length > 0 && scanState === 'scanning') { - setScanState('detected'); - } + // console.log('handleDetectionsChange', newDetections); + // if (newDetections.length > 0 && scanState === 'scanning') { + // setScanState('detected'); + // } }; // 处理人物点击 打开角色库 @@ -317,6 +318,7 @@ export function ShotTabContent({ videoSrc={shotData[selectedIndex]?.videoUrl[0]} detections={detections} triggerScan={scanState === 'scanning'} + triggerSuccess={scanState === 'detected'} onScanTimeout={handleScanTimeout} onScanExit={handleScanExit} onDetectionsChange={handleDetectionsChange}