From 4c1de925add462fcd1bb71f85cece807620e3724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Mar 2020 19:17:56 +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 --- .../courses/exercise/ExerciseListItem.js | 35 +++++++++------ .../courses/exercise/Exercisesetting.js | 20 +++++++++ .../exercise/Studentshavecompletedthelist.js | 38 ++++++++++------ .../exercise/Testpapersettinghomepage.js | 43 +++++++++++++++++-- public/react/src/modules/tpm/TPMIndexHOC.js | 5 +++ 5 files changed, 111 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index f9f3288e8..a4bdc5c29 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -75,7 +75,9 @@ class ExerciseListItem extends Component{ let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); - const IsStudent =this.props.isStudent(); + const isAssistant=this.props.isAssistant(); + + const IsStudent =this.props.isStudent(); return(
window.$(`.exerciseitem${index} input`).click() }> @@ -188,24 +190,31 @@ class ExerciseListItem extends Component{ { IsAdmin &&
- - { - item&&item.assistant_auth===true? - this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + isAssistant===true? + ( + item&&item.assistant_auth===true? + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + : + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 + ) : - this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 - + this.toDetailPage(`/classrooms/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 } + { - item&&item.assistant_auth===true? - 编辑 + isAssistant===true? + ( + item&&item.assistant_auth===true? + 编辑 + : + "" + ) : - "" + 编辑 } - 设置
} diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 504c73456..ed3db102c 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -97,6 +97,8 @@ class Exercisesetting extends Component{ assistant_auth:this.props.assistant_auth, }) + + this.getSettingInfo(); // window.addEventListener('click', this.handleClick); @@ -113,6 +115,24 @@ class Exercisesetting extends Component{ if(this.props.isAdmin() === false){ this.cancelEdit() } + + try { + //是否为助教 + if(this.props.isAssistant()===true){ + //如果是助教是否有权限 + if(this.props.assistant_auth===true){ + this.setState({ + flagPageEdit:true + }) + }else{ + this.setState({ + flagPageEdit:false + }) + } + } + }catch (e) { + + } } componentDidUpdate = (prevProps) => { if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){ diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index b0a337645..12e3f4235 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1158,12 +1158,17 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - ( - this.props.assistant_auth&&this.props.assistant_auth===true? - ( - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - this.Adjustment(record.user_id)}>评阅 + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) : -- ) @@ -1178,7 +1183,7 @@ class Studentshavecompletedthelist extends Component { : -- } - + ) }, ], @@ -1387,12 +1392,17 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - ( - this.props.assistant_auth&&this.props.assistant_auth===true? - ( - this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? - this.Adjustment(record.user_id)}>评阅 + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) : -- ) @@ -1407,7 +1417,7 @@ class Studentshavecompletedthelist extends Component { : -- } - + ) }, ],//columnsystwo 也会被columnsys当作参数接收 diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 17f95b352..88d1755f0 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -297,7 +297,9 @@ class Testpapersettinghomepage extends Component{ render(){ let {tab,visible,Commonheadofthetestpaper,exercise_status,assistant_auth}=this.state; const isAdmin =this.props.isAdmin(); - const isStudent = this.props.isStudent(); + const isAssistant=this.props.isAssistant(); + + const isStudent = this.props.isStudent(); // TODO //console.log(Commonheadofthetestpaper.exercise_status); @@ -361,7 +363,26 @@ class Testpapersettinghomepage extends Component{
- {this.props.isAdmin()===true? + {isAssistant===true? + ( + assistant_auth===true? + + 答题列表 + 统计结果 + 试卷预览 + 设置 + + : + + 答题列表 + {Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true? + Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status===3? + 统计结果:"":""} + 设置 + + ) + : + this.props.isAdmin()===true? 答题列表 统计结果 @@ -445,7 +466,23 @@ class Testpapersettinghomepage extends Component{ getsetdata={this.getsetdata} > :"":""} - {isAdmin === true? 编辑试卷:""} + {/*const isAdminOrTeacher*/} + {/*assistant_auth===true*/} + {/**/} + {isAdmin === true? + ( + isAssistant===true? + ( + assistant_auth===true? + 编辑试卷 + : + "" + ) + + : + 编辑试卷 + ) + :""} {isAdmin === false && this.props.current_user !== undefined? Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status===2? diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 27ed40437..1731a55fa 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -276,6 +276,10 @@ export function TPMIndexHOC(WrappedComponent) { isAdminOrTeacher = () => { return this.state.coursedata&&this.state.coursedata.course_identity < 4 } + // 助教===4 + isAssistant=()=>{ + return this.state.coursedata&&this.state.coursedata.course_identity ===4 + } // 超管、运维、课堂管理、老师、助教0-4 isAdmin = () => { return this.state.coursedata&&this.state.coursedata.course_identity < 5 @@ -711,6 +715,7 @@ export function TPMIndexHOC(WrappedComponent) { isAdmin: this.isAdmin, isAdminOrTeacher: this.isAdminOrTeacher, + isAssistant:this.isAssistant, isStudent: this.isStudent, isAdminOrStudent: this.isAdminOrStudent, isNotMember: this.isNotMember,