fix(voices): 「去配音库上传」跳转自动打开上传弹窗 #1650

Merged
auto-approve-bot merged 2 commits from fix/voice-upload-redirect into develop 2026-09-03 16:55:45 +08:00
2 changed files with 13 additions and 2 deletions
@@ -134,7 +134,7 @@ const Step5VoiceSelect: React.FC<Step5VoiceSelectProps> = ({
/** 跳转到配音库上传 */
const handleGoToUpload = useCallback(() => {
navigate("/app/voices")
navigate("/app/voices?tab=material&upload=1")
}, [navigate])
// 加载中状态
+12 -1
View File
@@ -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)
}
}, [searchParams, setActiveTab, setUploadOpen])
// ── 切换 Tab 时停止播放 ───────────────────────────────
const handleTabChange = useCallback(
(tab: VoiceTabKey) => {