From b977353a78c050995bf663ad3c7ff3f437253dd1 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Sun, 9 Feb 2020 18:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9B=B4=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/Live.js | 49 +++ .../src/modules/courses/Video/LiveItem.js | 52 ++++ .../src/modules/courses/Video/LiveNew.js | 79 +++++ .../react/src/modules/courses/Video/Video.js | 222 ++++++++++++++ .../src/modules/courses/Video/VideoIndex.js | 290 ++++++++---------- .../src/modules/courses/Video/VideoItem.js | 45 --- .../react/src/modules/courses/Video/video.css | 77 ++++- .../user/usersInfo/video/VideoUploadList.js | 3 +- 8 files changed, 605 insertions(+), 212 deletions(-) create mode 100644 public/react/src/modules/courses/Video/Live.js create mode 100644 public/react/src/modules/courses/Video/LiveItem.js create mode 100644 public/react/src/modules/courses/Video/LiveNew.js create mode 100644 public/react/src/modules/courses/Video/Video.js delete mode 100644 public/react/src/modules/courses/Video/VideoItem.js diff --git a/public/react/src/modules/courses/Video/Live.js b/public/react/src/modules/courses/Video/Live.js new file mode 100644 index 000000000..b903b38bd --- /dev/null +++ b/public/react/src/modules/courses/Video/Live.js @@ -0,0 +1,49 @@ +import React,{ Component } from "react"; +import { Switch , Pagination } from 'antd'; +import { NoneData } from 'educoder'; + +import LiveItem from './LiveItem'; +import './video.css'; +class Live extends Component{ + + render(){ + const { liveData , lives , successFunc , admin , business , is_teacher , pageSize , changePage } = this.props; + const operation = admin || business || (is_teacher && this.props.checkIfProfessionalCertification()) + + return( +
+ { + lives && lives.length > 0 ? + +

{liveData && liveData.total_count} 个视频

+
+ { + lives.map((item,key)=>{ + return( + successFunc()} + operation={operation} + > + ) + }) + } +
+ { + liveData && liveData.total_count > pageSize && +
+ changePage(page,'live')}> +
+ } +
+ : + + } + +
+ ) + } +} +export default Live; \ No newline at end of file diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js new file mode 100644 index 000000000..10586cdd7 --- /dev/null +++ b/public/react/src/modules/courses/Video/LiveItem.js @@ -0,0 +1,52 @@ +import React,{ Component } from "react"; +import { Switch } from 'antd'; +import { getImageUrl } from 'educoder'; + +import axios from 'axios'; +class LiveItem extends Component{ + + changeStatus=(flag,event,id)=>{ + const url = `/live_links/${id}.json`; + axios.put(url,{ + on_status:flag?1:0 + }).then(result=>{ + if(result){ + this.props.showNotification(`直播已${flag?"开启":"关闭"}!`); + const { successFunc } = this.props; + successFunc && successFunc(1); + } + }).catch(error=>{ + console.log(error); + }) + } + render(){ + const { item , operation } = this.props; + return( +
+
+ + {`${item.author_name}`} + + {item.on_status?'已开播':'未开播'} + + { + operation && + this.changeStatus(flag,event,item.id)}> + } +
+
+
+

{item.description}

+
+ { + item.on_status? + 进入 + : + 进入 + } +
+
+ ) + } +} +export default LiveItem; \ No newline at end of file diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js new file mode 100644 index 000000000..0663525b2 --- /dev/null +++ b/public/react/src/modules/courses/Video/LiveNew.js @@ -0,0 +1,79 @@ +import React,{ Component } from "react"; +import { Modal , Form , Input } from 'antd'; + +import './video.css'; +import axios from 'axios'; +const { TextArea } = Input; + +class LiveNew extends Component{ + constructor(props){ + super(props); + this.state={ + + } + } + + handleSubmit=()=>{ + this.props.form.validateFields((err, values) => { + if(!err){ + const CourseId=this.props.match.params.coursesId; + const url = `/courses/${CourseId}/live_links.json`; + axios.post(url,{ + ...values + }).then(result=>{ + if(result){ + this.props.showNotification("添加成功!"); + const { setliveVisibel } = this.props; + setliveVisibel && setliveVisibel(false); + } + }).catch(error=>{ + console.log(error); + }) + } + }) + } + + render(){ + const {getFieldDecorator} = this.props.form; + const { visible , setliveVisibel } = this.props; + return( + +
+
+ + {getFieldDecorator('url', { + rules: [{required: true, message: "请输入第三方直播链接"}], + })( + + )} + + + {getFieldDecorator('description', { + rules: [], + })( +