dev_unstable
hjm 6 years ago
parent 678ad697cb
commit 6d6199a708

@ -104,7 +104,7 @@ function InfoVideo (props) {
setLoading(true)
axios.get(fetchUrl, {
params: {
per_page: 200
per_page: 100
}
})
.then((response) => {

@ -31,6 +31,10 @@ export function reducer(state, action) {
return {
videos: update(state.videos, {$splice: [[action.index, 1]]})
}
case 'removeAll':
return {
videos: []
}
case 'updateProgress':
let _index = find(state, action)
let newvideos = state.videos

@ -17,13 +17,16 @@ const files = []
const MAX_FILE_COUNT = 3
const MAX_FILE_SIZE = 200
let noUploads = true
function VideoUploadList (props) {
// const [videos, setvideos] = useState([]);
const [state, dispatch] = useReducer(reducer, initialState);
const theme = useContext(ThemeContext)
const [couldRouteNav, setCouldRouteNav] = useState(false)
useEffect(() => {
setCouldRouteNav(false);
// Chrome removed support for custom message in ver 51
// https://stackoverflow.com/questions/38879742/is-it-possible-to-display-a-custom-message-in-the-beforeunload-popup
window.addEventListener("beforeunload", beforeunload);
@ -220,6 +223,8 @@ function VideoUploadList (props) {
}).then((response) => {
// to success page
if (response.data.status == 0) {
dispatch({type: 'removeAll'})
// setCouldRouteNav(true)
history.push(`/users/${username}/videos/success`)
}
}).catch((error) => {
@ -234,7 +239,7 @@ function VideoUploadList (props) {
return (
<div className="educontent videoUploadList" style={{ marginBottom: '200px' }}>
<Prompt
when={state.videos.length}
when={state.videos.length }
message='确认要离开当前页面,当前数据不可恢复'
/>
<style>{`

Loading…
Cancel
Save