diff --git a/public/react/src/modules/courses/Video/VideoLink.js b/public/react/src/modules/courses/Video/VideoLink.js
new file mode 100644
index 000000000..784d5a971
--- /dev/null
+++ b/public/react/src/modules/courses/Video/VideoLink.js
@@ -0,0 +1,86 @@
+import React,{ Component } from "react";
+import { Modal , Form , Input , Spin , Select , AutoComplete , DatePicker , InputNumber } from 'antd';
+import axios from 'axios';
+
+class VideoLink extends Component{
+
+ cancelNew=()=>{
+ const { setVisible } = this.props;
+ setVisible && setVisible(false);
+ }
+ validateDesc= (rule, value, callback) => {
+ if(!value){
+ callback();
+ }
+ if (value.length > 60) {
+ callback("视频名称不能超过60个字!");
+ }else{
+ callback();
+ }
+ }
+ // 提交
+ handleSubmit=()=>{
+ this.props.form.validateFields((err, values) => {
+ if(!err){
+ const { coursesId } = this.props;
+ const url = `/courses/${coursesId}/course_videos.json`;
+ axios.post(url,{
+ ...values
+ }).then(result=>{
+ if(result){
+ const { notification , setVisible } = this.props;
+ notification && notification('视频外链新增成功!');
+ setVisible && setVisible(false,true);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+ })
+ }
+ render(){
+ const {getFieldDecorator} = this.props.form;
+
+ const { visible } = this.props;
+ const layout = {
+ labelCol: { span: 5 },
+ wrapperCol: { span: 19 },
+ }
+ return(
+
+
+
+ )
+ }
+}
+const WrappedVideoLink = Form.create({name: 'VideoLink'})(VideoLink);
+export default WrappedVideoLink;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
index 999ae4e15..75b788e16 100644
--- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
+++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
@@ -61,6 +61,8 @@ class Coursesleftnav extends Component{
sandiantypes:undefined,
antIcon:false,
chapterupdate:false,
+
+ successFunc:undefined
}
}
@@ -138,61 +140,68 @@ class Coursesleftnav extends Component{
off('shixun_homeworkadd',this.addshixunchild)
off('editshixunname',this.editshixunchild)
off('editshixunmainname',this.editshixunmainname)
+ off('videoAdd',this.addVideo)
+ off('editVideo',this.editVideo)
}
addshixunchild=(e, data)=>{
- this.Navmodalnames(e,1,"shixun_homework",data)
+ this.Navmodalnames(e,1,"shixun_homework",data);
}
editshixunchild=(e, data)=>{
- this.Navmodalnames(e,4,"editSecondname",data.id,data.name)
+ this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
}
editshixunmainname=(e, data)=>{
- this.Navmodalnames(e,3,"editname",data.id,data.name)
+ this.Navmodalnames(e,3,"editname",data.id,data.name);
}
boardAddListener = (e, data) => {
- this.Navmodalnames(e,6,"board", data)
+ this.Navmodalnames(e,6,"board", data);
+ }
+ addVideo=(e,id)=>{
+ this.Navmodalnames(e,1,"video",id);
+ }
+ editVideo=(e,data)=>{
+ this.setState({
+ successFunc:data.update
+ })
+ this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
}
boardRenameListener = (e, data) => {
- this.Navmodalnames(e,7,"editSecondname", data.category_id, data.category_name)
+ this.Navmodalnames(e,7,"editSecondname", data.category_id, data.category_name);
}
groupAddListener = (e, data) => {
- this.Navmodalnames(e,2,"course_group", data)
+ this.Navmodalnames(e,2,"course_group", data);
}
groupRenameListener = (e, data) => {
- this.Navmodalnames(e,5,"editSecondname", data.id, data.name)
+ this.Navmodalnames(e,5,"editSecondname", data.id, data.name);
}
attachmentAddlog=(e,data)=>{
- this.Navmodalnames(e,1,"attachment",data)
+ this.Navmodalnames(e,1,"attachment",data);
}
flieseditDir=(e, data)=>{
- this.Navmodalnames(e,4,"editSecondname",data.id,data.name)
+ this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
}
componentDidMount() {
-
this.setState({
url:this.props.match.url
})
- on('boardAdd', this.boardAddListener)
- on('boardRename', this.boardRenameListener)
- on('groupAdd', this.groupAddListener)
- on('groupRename', this.groupRenameListener)
- on('attachmentAddlog', this.attachmentAddlog)
- on('flieseditDir', this.flieseditDir)
- on('shixun_homeworkadd',this.addshixunchild)
- on('editshixunname',this.editshixunchild)
- on('editshixunmainname',this.editshixunmainname)
+ on('boardAdd', this.boardAddListener);
+ on('boardRename', this.boardRenameListener);
+ on('groupAdd', this.groupAddListener);
+ on('groupRename', this.groupRenameListener);
+ on('attachmentAddlog', this.attachmentAddlog);
+ on('flieseditDir', this.flieseditDir);
+ on('shixun_homeworkadd',this.addshixunchild);
+ on('editshixunname',this.editshixunchild);
+ on('editshixunmainname',this.editshixunmainname);
+ on('videoAdd',this.addVideo);
+ on('editVideo',this.editVideo)
- // this.props.updataleftNavfun();
- // this.props.getleftNavid && this.props.getleftNavid("shixun_homework");
- // const position =parseInt(this.props.match.params.position);
let courstype=this.props.match.url;
- courstype = courstype.split('/');
-
- courstype=courstype[3];
+ courstype = courstype.split('/');
- // console.log(courstype)
+ courstype=courstype[3];
const query =this.props.location.search;
@@ -520,7 +529,9 @@ class Coursesleftnav extends Component{
// loadtype:true,
// NavmodalValue:""
// })
- navidtype=true
+ navidtype=true;
+ const { successFunc } = this.state;
+ successFunc && successFunc(1);
}
saveNavmodapost=(url,value,positiontype,coursesId)=>{
@@ -658,32 +669,28 @@ class Coursesleftnav extends Component{
updatadeleteSecondary=(url)=>{
this.props.updataleftNavfun();
- // this.setState({
- // ModalsType:true,
- // Modalstopval:"删除成功",
- // loadtype:true,
- // })
- // notification.open({
- // message: "删除成功",
- // });
-
- // this.props.history.replace(url);
- window.location.href = url;
+ this.setState({
+ ModalsType:false,
+ Modalstopval:"",
+ loadtype:false,
+ })
+ notification.open({
+ message: "删除成功",
+ });
+
+ this.props.history.replace(url);
+
+ // window.location.href = url;
}
deletenavchilds=(url,mainurl)=>{
- this.setState({
- antIcon:true
- })
+ console.log(this.props);
+ this.setState({
+ antIcon:true
+ })
axios.delete(url).then((result)=>{
if(result.data.status===0){
-
- if(mainurl===undefined){
- this.updatadeleteSecondary(result.data.right_url)
- }else{
- this.updatadeleteSecondary(mainurl)
- }
-
+ this.updatadeleteSecondary(mainurl || result.data.right_url);
}
}).catch((error)=>{
console.log(error)
@@ -698,8 +705,8 @@ class Coursesleftnav extends Component{
ModalsType:true,
Modalstopval:"该目录下的内容将被移动到父目录,",
ModalsBottomval:"是否确认删除?",
- ModalSave:()=>this.deletenavchilds(url),
-
+ ModalSave:()=>this.deletenavchilds(url,mainurl),
+ loadtype:false
})
}else if(type===2){
@@ -709,7 +716,7 @@ class Coursesleftnav extends Component{
Modalstopval:"该分班的学生将被移动到“未分班”,",
ModalsBottomval:"是否确认删除?",
ModalSave:()=>this.deletenavchilds(url),
-
+ loadtype:false
})
}else if(type===3){
let url="/boards/"+id+".json"
@@ -718,7 +725,7 @@ class Coursesleftnav extends Component{
Modalstopval:"该目录下的内容将被移动到父目录,",
ModalsBottomval:"是否确认删除?",
ModalSave:()=>this.deletenavchilds(url,mainurl),
-
+ loadtype:false
})
}
@@ -838,6 +845,8 @@ class Coursesleftnav extends Component{
{item.type==="shixun_homework"?this.Navmodalnames(e,1,"shixun_homework",item.id)}>新建目录
:""}
{/*资源*/}
{item.type==="attachment"?this.Navmodalnames(e,1,"attachment",item.id)}>新建目录
:""}
+ {/* 视频 */}
+ {item.type==="video"?this.Navmodalnames(e,1,"video",item.id)}>新建目录
:""}
{/*毕业设计*/}
{/*{item.type==="graduation"?this.Navmodalnames(1,"attachment",item.id)}>添加目录
:""}*/}
{/*讨论区*/}
@@ -872,6 +881,9 @@ class Coursesleftnav extends Component{
{/*讨论区*/}
{item.type==="board"?this.Navmodalnames(e,7,"editSecondname",iem.category_id,iem.category_name)}>重命名
:""}
{item.type==="board"?this.deleteSecondary(e,3,iem.category_id,item.category_url)}>删除
:""}
+ {/*视频*/}
+ {item.type==="video"?this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名
:""}
+ {item.type==="video"?this.deleteSecondary(e,1,iem.category_id,item.category_url)}>删除
:""}