Merge branches 'dev_aliyun' and 'dev_video' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_video

dev_video
杨树明 5 years ago
commit d39285f202

@ -1,8 +1,7 @@
class LiveLinksController < ApplicationController class LiveLinksController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_course, only: [:index, :create] before_action :find_course, only: [:index, :create]
before_action :user_course_identity before_action :user_course_identity, :teacher_allowed, only: [:create]
before_action :teacher_allowed, only: [:create]
def index def index
lives = @course.live_links.order("id desc") lives = @course.live_links.order("id desc")

@ -1,5 +1,6 @@
json.lives @lives do |live| json.lives @lives do |live|
json.(live, :id, :url, :description, :on_status) json.(live, :id, :description, :on_status)
json.url live.on_status ? live.url : ""
json.author_name live.user.show_real_name json.author_name live.user.show_real_name
json.author_login live.user.login json.author_login live.user.login
json.author_img url_to_avatar(live.user) json.author_img url_to_avatar(live.user)

@ -7,11 +7,9 @@ import './video.css';
class Live extends Component{ class Live extends Component{
render(){ render(){
const { liveData , lives , successFunc , pageSize , changePage } = this.props; const { liveData , lives , successFunc , pageSize , changePage } = this.props;
const { admin , business , is_teacher } = this.props.user; return(
const operation = admin || business || (is_teacher && this.props.checkIfProfessionalCertification())
return(
<div className="livePanel"> <div className="livePanel">
{ {
lives && lives.length > 0 ? lives && lives.length > 0 ?
@ -26,7 +24,6 @@ class Live extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
successFunc={()=>successFunc()} successFunc={()=>successFunc()}
operation={operation}
></LiveItem> ></LiveItem>
) )
}) })
@ -42,7 +39,6 @@ class Live extends Component{
: :
<NoneData style={{width: '100%'}}></NoneData> <NoneData style={{width: '100%'}}></NoneData>
} }
</div> </div>
) )
} }

@ -20,7 +20,7 @@ class LiveItem extends Component{
}) })
} }
render(){ render(){
const { item , operation } = this.props; const { item } = this.props;
return( return(
<div className="liveItem"> <div className="liveItem">
<div className="lineMiddle livesMain"> <div className="lineMiddle livesMain">
@ -30,7 +30,7 @@ class LiveItem extends Component{
<span className={item.on_status?"labels living":"labels lived"}>{item.on_status?'已开播':'未开播'}</span> <span className={item.on_status?"labels living":"labels lived"}>{item.on_status?'已开播':'未开播'}</span>
</span> </span>
{ {
operation && item.op_auth &&
<Switch checkedChildren="on" unCheckedChildren="off" defaultChecked={item.on_status} onChange={(flag,event)=>this.changeStatus(flag,event,item.id)}></Switch> <Switch checkedChildren="on" unCheckedChildren="off" defaultChecked={item.on_status} onChange={(flag,event)=>this.changeStatus(flag,event,item.id)}></Switch>
} }
</div> </div>

Loading…
Cancel
Save