|
|
@ -4,7 +4,7 @@ import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder'
|
|
|
|
import axios from 'axios'
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
|
|
import VideoUpload from './VideoUpload'
|
|
|
|
import VideoUpload from './VideoUpload'
|
|
|
|
import { Button } from 'antd'
|
|
|
|
import { Button, Spin } from 'antd'
|
|
|
|
|
|
|
|
|
|
|
|
import { getUploader } from './AliyunUploaderManager'
|
|
|
|
import { getUploader } from './AliyunUploaderManager'
|
|
|
|
import { reducer, initialState } from './VideoReducer'
|
|
|
|
import { reducer, initialState } from './VideoReducer'
|
|
|
@ -23,7 +23,8 @@ function VideoUploadList (props) {
|
|
|
|
// const [videos, setvideos] = useState([]);
|
|
|
|
// const [videos, setvideos] = useState([]);
|
|
|
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
|
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
|
|
const theme = useContext(ThemeContext)
|
|
|
|
const theme = useContext(ThemeContext)
|
|
|
|
const [couldRouteNav, setCouldRouteNav] = useState(false)
|
|
|
|
const [couldRouteNav, setCouldRouteNav] = useState(false);
|
|
|
|
|
|
|
|
const [loading,setLoading] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
setCouldRouteNav(false);
|
|
|
|
setCouldRouteNav(false);
|
|
|
@ -96,13 +97,14 @@ function VideoUploadList (props) {
|
|
|
|
var userData = '{"Vod":{}}'
|
|
|
|
var userData = '{"Vod":{}}'
|
|
|
|
|
|
|
|
|
|
|
|
if (!uploader) {
|
|
|
|
if (!uploader) {
|
|
|
|
|
|
|
|
|
|
|
|
getUploader(username,
|
|
|
|
getUploader(username,
|
|
|
|
// Object.assign(uploaderOptions,
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 重新创建 才会用最新的 dispatch
|
|
|
|
// 重新创建 才会用最新的 dispatch
|
|
|
|
create: !uploader,
|
|
|
|
create: !uploader,
|
|
|
|
addFileSuccess: (uploadInfo) => {
|
|
|
|
addFileSuccess: (uploadInfo) => {
|
|
|
|
const file = uploadInfo.file
|
|
|
|
setLoading(true);
|
|
|
|
|
|
|
|
const file = uploadInfo.file;
|
|
|
|
console.log('addFileSuccess', uploadInfo)
|
|
|
|
console.log('addFileSuccess', uploadInfo)
|
|
|
|
// const newvideos = [...videos, {
|
|
|
|
// const newvideos = [...videos, {
|
|
|
|
// name: file.name,
|
|
|
|
// name: file.name,
|
|
|
@ -121,7 +123,8 @@ function VideoUploadList (props) {
|
|
|
|
dispatch({type: 'addVideo', uploadInfo})
|
|
|
|
dispatch({type: 'addVideo', uploadInfo})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onUploadProgress: (uploadInfo, totalSize, progress) => {
|
|
|
|
onUploadProgress: (uploadInfo, totalSize, progress) => {
|
|
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
|
|
console.log("upload",uploadInfo);
|
|
|
|
var progressPercent = Math.ceil(progress * 100)
|
|
|
|
var progressPercent = Math.ceil(progress * 100)
|
|
|
|
|
|
|
|
|
|
|
|
// let _index = -1;
|
|
|
|
// let _index = -1;
|
|
|
@ -401,7 +404,7 @@ function VideoUploadList (props) {
|
|
|
|
}}>选择您要上传的视频</div>
|
|
|
|
}}>选择您要上传的视频</div>
|
|
|
|
{protocolLine}
|
|
|
|
{protocolLine}
|
|
|
|
</div>}
|
|
|
|
</div>}
|
|
|
|
|
|
|
|
<Spin spinning={loading}>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{state.videos.map((item, vIndex) => {
|
|
|
|
{state.videos.map((item, vIndex) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -414,6 +417,7 @@ function VideoUploadList (props) {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</Spin>
|
|
|
|
{state.videos && state.videos.length === MAX_FILE_COUNT &&
|
|
|
|
{state.videos && state.videos.length === MAX_FILE_COUNT &&
|
|
|
|
<div className="uploadTip">
|
|
|
|
<div className="uploadTip">
|
|
|
|
{/* <i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i> */}
|
|
|
|
{/* <i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i> */}
|
|
|
|