newyslclassrooms
caicai8 5 years ago
parent 4b890b0650
commit bb056d657d

@ -184,6 +184,8 @@ class Video extends Component {
render() { render() {
const { visible, videoVisible, videoId , moveVisible , moveVideoId } = this.state; const { visible, videoVisible, videoId , moveVisible , moveVideoId } = this.state;
const CourseId = this.props.match.params.coursesId; const CourseId = this.props.match.params.coursesId;
const VID=this.props.match.params.videoId;
const login = this.props.user && this.props.user.login; const login = this.props.user && this.props.user.login;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url); const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
@ -224,7 +226,7 @@ class Video extends Component {
<div className="videoPanel"> <div className="videoPanel">
{ {
upload ? upload ?
<VideoUploadList {...this.props} flag={true} CourseId={CourseId} CourseUser={login} successFunc={() => uploadVideo()}></VideoUploadList> <VideoUploadList {...this.props} flag={true} CourseId={CourseId} videoId={VID} CourseUser={login} successFunc={() => uploadVideo()}></VideoUploadList>
: :
<React.Fragment> <React.Fragment>
{ {

@ -73,6 +73,9 @@ class VideoIndex extends Component{
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if(this.props.match.params.videoId !== prevProps.match.params.videoId ){ if(this.props.match.params.videoId !== prevProps.match.params.videoId ){
this.setState({
upload:false
})
const { page } = this.state; const { page } = this.state;
this.checkType("video",page); this.checkType("video",page);
} }
@ -246,6 +249,7 @@ class VideoIndex extends Component{
<React.Fragment> <React.Fragment>
<VideoLink <VideoLink
coursesId={coursesId} coursesId={coursesId}
videoId={videoId}
visible={otherLinkVisible} visible={otherLinkVisible}
notification={this.props.showNotification} notification={this.props.showNotification}
setVisible={this.setLinkeVisible} setVisible={this.setLinkeVisible}
@ -283,7 +287,7 @@ class VideoIndex extends Component{
videoData && videoData.category_name && type === "video" ? videoData && videoData.category_name && type === "video" ?
<span className="font-18 fl color-dark-21 mt20 mb20">{videoData.category_name}</span> <span className="font-18 fl color-dark-21 mt20 mb20">{videoData.category_name}</span>
: :
<div className="task_menu_ul fl mt2"> <div className="task_menu_ul fl mt2" style={{width:"400px"}}>
<Menu mode="horizontal" selectedKeys={[type]} onClick={this.changeType}> <Menu mode="horizontal" selectedKeys={[type]} onClick={this.changeType}>
<Menu.Item key="video">视频</Menu.Item> <Menu.Item key="video">视频</Menu.Item>
<Menu.Item key="live">直播</Menu.Item> <Menu.Item key="live">直播</Menu.Item>
@ -301,11 +305,9 @@ class VideoIndex extends Component{
videoId ? videoId ?
<WordsBtn style="blue" onClick={()=>this.editDir(videoData && videoData.category_name,videoId)} className={"mr30 font-16"}>目录重命名</WordsBtn> <WordsBtn style="blue" onClick={()=>this.editDir(videoData && videoData.category_name,videoId)} className={"mr30 font-16"}>目录重命名</WordsBtn>
: :
<React.Fragment> <WordsBtn style="blue" className="mr30 font-16" onClick={this.addDir}>新建目录</WordsBtn>
<WordsBtn style="blue" className="mr30 font-16" onClick={this.addDir}>新建目录</WordsBtn>
<WordsBtn style="blue" className="mr30 font-16" onClick={()=>this.setLinkeVisible(true)}>增加外链</WordsBtn>:""
</React.Fragment>
} }
<WordsBtn style="blue" className="mr30 font-16" onClick={()=>this.setLinkeVisible(true)}>增加外链</WordsBtn>
</span>:"" </span>:""
} }
{ {
@ -321,7 +323,7 @@ class VideoIndex extends Component{
} }
</React.Fragment> </React.Fragment>
: :
<WordsBtn style="blue" className="font-16 ml30" onClick={()=>this.setLinkeVisible(true)}>添加直播</WordsBtn> <WordsBtn style="blue" className="font-16 ml30" onClick={this.liveSetting}>添加直播</WordsBtn>
} }
</li> </li>
</div> </div>

@ -4,6 +4,14 @@ import axios from 'axios';
class VideoLink extends Component{ class VideoLink extends Component{
componentDidUpdate=(prevProps)=>{
if(prevProps.visible !== this.props.visible){
this.props.form.setFieldsValue({
name:undefined,
link:undefined
})
}
}
cancelNew=()=>{ cancelNew=()=>{
const { setVisible } = this.props; const { setVisible } = this.props;
setVisible && setVisible(false); setVisible && setVisible(false);
@ -22,10 +30,11 @@ class VideoLink extends Component{
handleSubmit=()=>{ handleSubmit=()=>{
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if(!err){ if(!err){
const { coursesId } = this.props; const { coursesId , videoId } = this.props;
const url = `/courses/${coursesId}/course_videos.json`; const url = `/courses/${coursesId}/course_videos.json`;
axios.post(url,{ axios.post(url,{
...values ...values,
category_id:videoId
}).then(result=>{ }).then(result=>{
if(result){ if(result){
const { notification , setVisible } = this.props; const { notification , setVisible } = this.props;
@ -53,6 +62,7 @@ class VideoLink extends Component{
title={'添加外链'} title={'添加外链'}
footer={null} footer={null}
closable={false} closable={false}
centered={true}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<Form onSubmit={this.handleSubmit} {...layout}> <Form onSubmit={this.handleSubmit} {...layout}>

@ -73,7 +73,7 @@ function doCreateUploader (options) {
const _random = '' // Math.random().toString().substring(3, 6)+'-' const _random = '' // Math.random().toString().substring(3, 6)+'-'
axios.post(createUrl, { axios.post(createUrl, {
title: _random+fileName, title: _random+fileName,
file_name: _random+fileName file_name: _random+fileName,
}).then((response) => { }).then((response) => {
// if (response.data.status == ) // if (response.data.status == )
if(response){ if(response){

@ -226,7 +226,7 @@ function VideoUploadList (props) {
} }
function onPublish() { function onPublish() {
// 下列这些参数只有是课堂里面上传视频才会有 // 下列这些参数只有是课堂里面上传视频才会有
const { CourseId , CourseUser ,flag , successFunc } = props; const { CourseId , CourseUser ,flag , successFunc , videoId } = props;
if (state.videos.length == 0) { if (state.videos.length == 0) {
showNotification('请先上传视频') showNotification('请先上传视频')
return; return;
@ -238,7 +238,8 @@ function VideoUploadList (props) {
video_id: item.videoId, video_id: item.videoId,
// todo // todo
title: item.title, title: item.title,
course_id:CourseId course_id:CourseId,
category_id:videoId
} }
}) })
}).then((response) => { }).then((response) => {
@ -268,7 +269,6 @@ function VideoUploadList (props) {
: :
<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

Loading…
Cancel
Save