权限调整

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

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

Loading…
Cancel
Save