权限调整

video_transcode
杨树明 5 years ago
parent 518ed32727
commit f9fa865f77

@ -19,7 +19,7 @@ const MAX_FILE_SIZE = 500
let noUploads = true
function VideoUploadList (props) {
// const [videos, setvideos] = useState([]);
const [state, dispatch] = useReducer(reducer, initialState);
const theme = useContext(ThemeContext)
@ -54,7 +54,7 @@ function VideoUploadList (props) {
const username = props.match.params.username || props.CourseUser;
const { showNotification, history } = props;
const uploaderOptions = {
}
function onUploadChange (e) {
var file = e.target.files[0]
@ -63,18 +63,21 @@ function VideoUploadList (props) {
return
}
// avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm
if (file.name
&& file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1
&& file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1
&& file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1
&& file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1
&& file.name.indexOf('.webm') == -1
if (file.name
&& file.name.indexOf('.avi') == -1 && file.name.indexOf('.flv') == -1
&& file.name.indexOf('.f4v') == -1 && file.name.indexOf('.m4v') == -1
&& file.name.indexOf('.mov') == -1 && file.name.indexOf('.mp4') == -1
&& file.name.indexOf('.rmvb') == -1 && file.name.indexOf('.swf') == -1
&& file.name.indexOf('.webm') == -1
) {
showNotification(`不支持的视频格式`)
clearInput()
return;
}
if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
if(props&&props.user.admin===true||props&&props.user.business===true){
}else if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
// 超过500m TODO
clearInput()
showNotification(`视频大小超过${MAX_FILE_SIZE}M`)
@ -95,11 +98,11 @@ function VideoUploadList (props) {
var Title = file.name
var userData = '{"Vod":{}}'
if (!uploader) {
getUploader(username,
{
getUploader(username,
{
// 重新创建 才会用最新的 dispatch
create: !uploader,
addFileSuccess: (uploadInfo) => {
@ -174,7 +177,7 @@ function VideoUploadList (props) {
},
onUploadError: (uploadInfo) => {
},
// 可能需要等lib加载完毕才能执行
gotUploader: (_uploader) => {
@ -204,9 +207,9 @@ function VideoUploadList (props) {
} else {
// uploader.cancelFile(index)
}
clearInput()
dispatch({type: 'removeVideo', index})
dispatch({type: 'removeVideo', index})
// setvideos([...videos.splice(index, 1)])
}
// uploader.deleteFile(index);
@ -219,7 +222,7 @@ function VideoUploadList (props) {
doDelete(index, isSuccess)
}
})
}
function onPublish() {
// 下列这些参数只有是课堂里面上传视频才会有
@ -259,13 +262,13 @@ function VideoUploadList (props) {
}
// login
const { flag , CourseId } = props;
const urls =
flag ?
const urls =
flag ?
<Link to={`/users/${username}/videos/protocol?course=${CourseId}`} target="_blank" style={{color: theme.foreground_select}}>上传内容协议</Link>
:
<Link to={`/users/${username}/videos/protocol`} style={{color: theme.foreground_select}}>上传内容协议</Link>
const protocolLine = <div>上传视频即表示您已同意{urls}不得上传未经他人授权的作品</div>
return (
<div className={flag?"edu-back-white pb100 videoUploadList":"educontent videoUploadList"} style={{ marginBottom: `${flag?"0px":"200px"}` }}>
<Prompt
@ -391,7 +394,7 @@ function VideoUploadList (props) {
</div>
</React.Fragment>
}
<div className="section">
{/* noUploads */}
{noUploads && <div className="noUploads" style={{paddingTop: '72px'}} >
@ -400,7 +403,7 @@ function VideoUploadList (props) {
<img className="uploadHoverIcon" src={uploadHoverIcon} ></img>
</div>
<div style={{
color: '#000000',
fontSize: '18px',
@ -423,10 +426,10 @@ function VideoUploadList (props) {
})}
</div>
</Spin>
{state.videos && state.videos.length === MAX_FILE_COUNT &&
{state.videos && state.videos.length === MAX_FILE_COUNT &&
<div className="uploadTip">
{/* <i className="iconfont icon-tishi" style={{color: '#FF6F6F', verticalAlign: 'text-bottom'}}></i> */}
<span>提示单次最多支持3个视频文件上传</span>
<span>提示单次最多支持3个视频文件上传</span>
</div>}
{(!noUploads && state.videos.length < MAX_FILE_COUNT) && <ActionBtn className="publishBtn" onClick={() => document.getElementById('fileUpload').click()}
@ -446,7 +449,7 @@ function VideoUploadList (props) {
>
添加更多视频
</Button>} */}
<div style={{}} className="publishRow">
<ActionBtn className="publishBtn" onClick={() => onPublish()}
>立即发布</ActionBtn>

Loading…
Cancel
Save