You've already forked bilibili-subtitle
保存下载类型选择
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
|||||||
import Popover from '../components/Popover'
|
import Popover from '../components/Popover'
|
||||||
import {Placement} from '@popperjs/core/lib/enums'
|
import {Placement} from '@popperjs/core/lib/enums'
|
||||||
import {useAppDispatch, useAppSelector} from '../hooks/redux'
|
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 {EventBusContext} from '../Router'
|
||||||
import {EVENT_EXPAND, PAGE_SETTINGS} from '../const'
|
import {EVENT_EXPAND, PAGE_SETTINGS} from '../const'
|
||||||
import {formatSrtTime, formatTime, formatVttTime} from '../util/util'
|
import {formatSrtTime, formatTime, formatVttTime} from '../util/util'
|
||||||
@@ -62,7 +62,7 @@ const MoreBtn = (props: Props) => {
|
|||||||
const data = useAppSelector(state => state.env.data)
|
const data = useAppSelector(state => state.env.data)
|
||||||
const envReady = useAppSelector(state => state.env.envReady)
|
const envReady = useAppSelector(state => state.env.envReady)
|
||||||
const envData = useAppSelector(state => state.env.envData)
|
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 [moreVisible, setMoreVisible] = useState(false)
|
||||||
const eventBus = useContext(EventBusContext)
|
const eventBus = useContext(EventBusContext)
|
||||||
const segments = useAppSelector(state => state.env.segments)
|
const segments = useAppSelector(state => state.env.segments)
|
||||||
@@ -162,7 +162,9 @@ const MoreBtn = (props: Props) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const selectCallback = useCallback((e: any) => {
|
const selectCallback = useCallback((e: any) => {
|
||||||
dispatch(setDownloadType(e.target.value))
|
dispatch(setTempData({
|
||||||
|
downloadType: e.target.value,
|
||||||
|
}))
|
||||||
}, [dispatch])
|
}, [dispatch])
|
||||||
|
|
||||||
const preventCallback = useCallback((e: any) => {
|
const preventCallback = useCallback((e: any) => {
|
||||||
|
@@ -24,7 +24,6 @@ interface EnvState {
|
|||||||
curIdx?: number // 从0开始
|
curIdx?: number // 从0开始
|
||||||
needScroll?: boolean
|
needScroll?: boolean
|
||||||
currentTime?: number
|
currentTime?: number
|
||||||
downloadType?: string
|
|
||||||
infos?: any[]
|
infos?: any[]
|
||||||
curInfo?: any
|
curInfo?: any
|
||||||
curFetched?: boolean
|
curFetched?: boolean
|
||||||
@@ -226,9 +225,6 @@ export const slice = createSlice({
|
|||||||
setNoVideo: (state, action: PayloadAction<boolean>) => {
|
setNoVideo: (state, action: PayloadAction<boolean>) => {
|
||||||
state.noVideo = action.payload
|
state.noVideo = action.payload
|
||||||
},
|
},
|
||||||
setDownloadType: (state, action: PayloadAction<string>) => {
|
|
||||||
state.downloadType = action.payload
|
|
||||||
},
|
|
||||||
setNeedScroll: (state, action: PayloadAction<boolean>) => {
|
setNeedScroll: (state, action: PayloadAction<boolean>) => {
|
||||||
state.needScroll = action.payload
|
state.needScroll = action.payload
|
||||||
},
|
},
|
||||||
@@ -285,7 +281,6 @@ export const {
|
|||||||
addTaskId,
|
addTaskId,
|
||||||
delTaskId,
|
delTaskId,
|
||||||
setTaskIds,
|
setTaskIds,
|
||||||
setDownloadType,
|
|
||||||
setAutoTranslate,
|
setAutoTranslate,
|
||||||
setAutoScroll,
|
setAutoScroll,
|
||||||
setNoVideo,
|
setNoVideo,
|
||||||
|
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@@ -27,6 +27,7 @@ interface EnvData {
|
|||||||
|
|
||||||
interface TempData {
|
interface TempData {
|
||||||
curSummaryType: SummaryType
|
curSummaryType: SummaryType
|
||||||
|
downloadType?: string
|
||||||
compact?: boolean // 是否紧凑视图
|
compact?: boolean // 是否紧凑视图
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user