diff --git a/src/biz/MoreBtn.tsx b/src/biz/MoreBtn.tsx index 752fbc1..055546a 100644 --- a/src/biz/MoreBtn.tsx +++ b/src/biz/MoreBtn.tsx @@ -11,7 +11,7 @@ import { import Popover from '../components/Popover' import {Placement} from '@popperjs/core/lib/enums' import {useAppDispatch, useAppSelector} from '../hooks/redux' -import {setDownloadType, setEnvData, setPage} from '../redux/envReducer' +import {setEnvData, setPage, setTempData} from '../redux/envReducer' import {EventBusContext} from '../Router' import {EVENT_EXPAND, PAGE_SETTINGS} from '../const' import {formatSrtTime, formatTime, formatVttTime} from '../util/util' @@ -62,7 +62,7 @@ const MoreBtn = (props: Props) => { const data = useAppSelector(state => state.env.data) const envReady = useAppSelector(state => state.env.envReady) const envData = useAppSelector(state => state.env.envData) - const downloadType = useAppSelector(state => state.env.downloadType) + const downloadType = useAppSelector(state => state.env.tempData.downloadType) const [moreVisible, setMoreVisible] = useState(false) const eventBus = useContext(EventBusContext) const segments = useAppSelector(state => state.env.segments) @@ -162,7 +162,9 @@ const MoreBtn = (props: Props) => { }, []) const selectCallback = useCallback((e: any) => { - dispatch(setDownloadType(e.target.value)) + dispatch(setTempData({ + downloadType: e.target.value, + })) }, [dispatch]) const preventCallback = useCallback((e: any) => { diff --git a/src/redux/envReducer.ts b/src/redux/envReducer.ts index 00e9532..ba2570b 100644 --- a/src/redux/envReducer.ts +++ b/src/redux/envReducer.ts @@ -24,7 +24,6 @@ interface EnvState { curIdx?: number // 从0开始 needScroll?: boolean currentTime?: number - downloadType?: string infos?: any[] curInfo?: any curFetched?: boolean @@ -226,9 +225,6 @@ export const slice = createSlice({ setNoVideo: (state, action: PayloadAction) => { state.noVideo = action.payload }, - setDownloadType: (state, action: PayloadAction) => { - state.downloadType = action.payload - }, setNeedScroll: (state, action: PayloadAction) => { state.needScroll = action.payload }, @@ -285,7 +281,6 @@ export const { addTaskId, delTaskId, setTaskIds, - setDownloadType, setAutoTranslate, setAutoScroll, setNoVideo, diff --git a/src/typings.d.ts b/src/typings.d.ts index d3980ba..5422c25 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -27,6 +27,7 @@ interface EnvData { interface TempData { curSummaryType: SummaryType + downloadType?: string compact?: boolean // 是否紧凑视图 }