From e2201169393af3f41d66b52e3059b8572fc7d6d2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 3 Sep 2026 16:45:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(voices):=20=E3=80=8C=E5=8E=BB=E9=85=8D?= =?UTF-8?q?=E9=9F=B3=E5=BA=93=E4=B8=8A=E4=BC=A0=E3=80=8D=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80=E4=B8=8A=E4=BC=A0=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Step5VoiceSelect: navigate 路径加 ?tab=material&upload=1 - VoiceLibrary: mount 时检测 upload=1 参数,自动切到素材Tab并打开上传弹窗 --- .../pages/generate/components/Step5VoiceSelect.tsx | 2 +- apps/web/src/pages/voices/VoiceLibrary.tsx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx b/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx index 166dc4eed..ebb709cca 100644 --- a/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx +++ b/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx @@ -134,7 +134,7 @@ const Step5VoiceSelect: React.FC = ({ /** 跳转到配音库上传 */ const handleGoToUpload = useCallback(() => { - navigate("/app/voices") + navigate("/app/voices?tab=material&upload=1") }, [navigate]) // 加载中状态 diff --git a/apps/web/src/pages/voices/VoiceLibrary.tsx b/apps/web/src/pages/voices/VoiceLibrary.tsx index 4e83cd6c2..22af085b4 100755 --- a/apps/web/src/pages/voices/VoiceLibrary.tsx +++ b/apps/web/src/pages/voices/VoiceLibrary.tsx @@ -14,7 +14,8 @@ * 弹窗集合 → components/VoiceModals * Toast 提示 → components/VoiceToasts */ -import React, { useCallback, useState } from "react" +import React, { useCallback, useEffect, useState } from "react" +import { useSearchParams } from "react-router-dom" import { UploadOutlined, AudioOutlined, RobotOutlined } from "@ant-design/icons" import { Button } from "@/components/ui" import PageHead from "@/components/layout/PageHead" @@ -158,6 +159,16 @@ const VoiceLibrary: React.FC = () => { handleUploadClose, } = useVoiceUpload({ showToast }) + // ── URL 参数自动打开上传弹窗 ──────────────────────────── + const [searchParams] = useSearchParams() + + useEffect(() => { + if (searchParams.get("upload") === "1") { + setActiveTab("material") + setUploadOpen(true) + } + }, []) // eslint-disable-line react-hooks/exhaustive-deps + // ── 切换 Tab 时停止播放 ─────────────────────────────── const handleTabChange = useCallback( (tab: VoiceTabKey) => { -- 2.54.0 From f4db7eaaa85d3fdae01794c9dbeb5867015611eb Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 3 Sep 2026 16:48:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20useEffect=20=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=8A=A0=E5=85=A5=20searchParams=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20SPA=20=E5=86=85=E8=B7=B3=E8=BD=AC=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/pages/voices/VoiceLibrary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/pages/voices/VoiceLibrary.tsx b/apps/web/src/pages/voices/VoiceLibrary.tsx index 22af085b4..c2828e2be 100755 --- a/apps/web/src/pages/voices/VoiceLibrary.tsx +++ b/apps/web/src/pages/voices/VoiceLibrary.tsx @@ -167,7 +167,7 @@ const VoiceLibrary: React.FC = () => { setActiveTab("material") setUploadOpen(true) } - }, []) // eslint-disable-line react-hooks/exhaustive-deps + }, [searchParams, setActiveTab, setUploadOpen]) // ── 切换 Tab 时停止播放 ─────────────────────────────── const handleTabChange = useCallback( -- 2.54.0