|
|
|
@ -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>{`
|
|
|
|
|