newyslclassrooms
caicai8 5 years ago
parent 4b890b0650
commit bb056d657d

@ -184,6 +184,8 @@ class Video extends Component {
render() {
const { visible, videoVisible, videoId , moveVisible , moveVideoId } = this.state;
const CourseId = this.props.match.params.coursesId;
const VID=this.props.match.params.videoId;
const login = this.props.user && this.props.user.login;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
@ -224,7 +226,7 @@ class Video extends Component {
<div className="videoPanel">
{
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>
{

@ -73,6 +73,9 @@ class VideoIndex extends Component{
}
componentDidUpdate = (prevProps) => {
if(this.props.match.params.videoId !== prevProps.match.params.videoId ){
this.setState({
upload:false
})
const { page } = this.state;
this.checkType("video",page);
}
@ -246,6 +249,7 @@ class VideoIndex extends Component{
<React.Fragment>
<VideoLink
coursesId={coursesId}
videoId={videoId}
visible={otherLinkVisible}
notification={this.props.showNotification}
setVisible={this.setLinkeVisible}
@ -283,7 +287,7 @@ class VideoIndex extends Component{
videoData && videoData.category_name && type === "video" ?
<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.Item key="video">视频</Menu.Item>
<Menu.Item key="live">直播</Menu.Item>
@ -301,11 +305,9 @@ class VideoIndex extends Component{
videoId ?
<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.setLinkeVisible(true)}>增加外链</WordsBtn>:""
</React.Fragment>
<WordsBtn style="blue" className="mr30 font-16" onClick={this.addDir}>新建目录</WordsBtn>
}
<WordsBtn style="blue" className="mr30 font-16" onClick={()=>this.setLinkeVisible(true)}>增加外链</WordsBtn>
</span>:""
}
{
@ -321,7 +323,7 @@ class VideoIndex extends Component{
}
</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>
</div>

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

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

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

Loading…
Cancel
Save