From 8c3bf79c23a62e147211f6538021a55539c372e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 17 Mar 2020 23:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/Video.js | 2 +- .../src/modules/courses/Video/VideoIndex.js | 40 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/Video/Video.js b/public/react/src/modules/courses/Video/Video.js index e90156a56..befdc50be 100644 --- a/public/react/src/modules/courses/Video/Video.js +++ b/public/react/src/modules/courses/Video/Video.js @@ -258,7 +258,7 @@ class Video extends Component { console.log(course_identity > 2 && item.user_id === user_id) return ( this.props.Setmyktid(id)} + Setmyktid={(id,title)=>this.props.Setmyktid(id,title)} mykt={this.props.mykt} {...this.props} {...this.state} diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js index ef0b93ead..f5a3ae95b 100644 --- a/public/react/src/modules/courses/Video/VideoIndex.js +++ b/public/react/src/modules/courses/Video/VideoIndex.js @@ -42,6 +42,7 @@ class VideoIndex extends Component { liveVisible: false, statistics: false, myktid:null, + mytitle:'' } } @@ -56,10 +57,23 @@ class VideoIndex extends Component { this.getLiveList(page); } } - Setmyktid=(id)=>{ - this.setState({ - myktid:id - }) + Setmyktid=(id,title)=>{ + const isAdmin = this.props&& this.props.isAdmin(); + if(isAdmin===true){ + this.setState({ + myktid:id, + statistics:true, + mytitle:title, + }) + }else{ + this.setState({ + statistics:true, + myktid:null, + mytitle:"", + + }) + } + } componentDidMount = () => { const {search} = this.props.location; @@ -84,6 +98,8 @@ class VideoIndex extends Component { if(this.props.homedirectory ===true){ this.setState({ statistics:false, + myktid:null, + mytitle:"", }) } } @@ -260,12 +276,14 @@ class VideoIndex extends Component { this.setState({ statistics: bool, + myktid:null, + mytitle:"", }) } render() { - const {videos, upload, videoData, type, liveData, lives, page, liveVisible, isSpining, liveId, otherLinkVisible, statistics} = this.state; + const {videos, upload, videoData, type, liveData, lives, page, liveVisible, isSpining, liveId, otherLinkVisible, statistics,myktid} = this.state; const {coursesId, videoId} = this.props.match.params; let {course_identity} = this.props && this.props.coursedata; let is_teacher = this.props && this.props.user && this.props.user.is_teacher; @@ -382,8 +400,16 @@ class VideoIndex extends Component { : + ( + myktid===null||myktid===undefined? + this.statisticsy(b)}> + : + + this.tisticsbools(b,id,t)}> + + ) + - this.statisticsy(b)}> } @@ -394,7 +420,7 @@ class VideoIndex extends Component { type === "video" ? this.Setmyktid(id)} + Setmyktid={(id,title)=>this.Setmyktid(id,title)} upload={upload} videos={videos} page={page}