diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index e5d9fc495..73bd07954 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -399,7 +399,7 @@ class ExercisesController < ApplicationController choice_random = params[:choice_random] ? true : false score_open = params[:score_open] ? true : false #分数是否公开 answer_open = params[:answer_open] ? true : false #答案是否公开 - assistant_auth = params[:assistant_auth] ? true : false # 助教权限 + assistant_auth = params[:assistant_auth] # 助教权限 # 统一设置或者分班为0,则更新试卷,并删除试卷分组 if unified_setting || (course_group_ids.size == 0) @@ -532,7 +532,8 @@ class ExercisesController < ApplicationController :answer_open => answer_open, :exercise_status => exercise_status, :publish_time => p_time, - :end_time => e_time + :end_time => e_time, + :assistant_auth => assistant_auth } @exercise.update!(exercise_params) if @exercise.exercise_status == Exercise::PUBLISHED @@ -773,10 +774,11 @@ class ExercisesController < ApplicationController ex_group_setting = exercise.exercise_group_settings old_exercise_groups = ex_group_setting.find_in_exercise_group("course_group_id", g_course) #试卷的分组设置 left_course_groups = teacher_course_group_ids - g_course + all_left_groups = all_course_group_ids - g_course left_exercise_groups = ex_group_setting.find_in_exercise_group("course_group_id", left_course_groups) if left_exercise_groups.blank? && exercise.unified_setting - if left_course_groups.size > 0 #开始为统一设置,但是立即截止为分班。则创建没有立即截止的班级的exercise_group_setting - left_course_groups.each do |g| + if all_left_groups.size > 0 #开始为统一设置,但是立即截止为分班。则创建没有立即截止的班级的exercise_group_setting + all_left_groups.each do |g| ex_group_options = { :exercise_id => exercise.id, :course_group_id => g, diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 0e3771e61..faea30242 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -359,6 +359,9 @@ class HomeworkCommonsController < ApplicationController def new tip_exception("type参数有误") if params[:type].blank? || ![1, 3].include?(params[:type].to_i) @homework_type = params[:type].to_i + module_type = params[:type].to_i == 1 ? "common_homework" : "group_homework" + @main_category = @course.course_modules.find_by(module_type: module_type) + @category = @main_category.course_second_categories.find_by(id: params[:category]) if params[:category].present? end def create @@ -376,6 +379,11 @@ class HomeworkCommonsController < ApplicationController @homework.user_id = current_user.id @homework.course_id = @course.id + if params[:category].present? + category = @course.course_second_categories.find_by(id: params[:category]) + @homework.course_second_category_id = category&.id.to_i + end + homework_detail_manual = HomeworkDetailManual.new @homework.homework_detail_manual = homework_detail_manual homework_detail_manual.te_proportion = 0.7 @@ -404,7 +412,12 @@ class HomeworkCommonsController < ApplicationController end def edit - + if @homework.course_second_category_id == 0 + module_type = @homework.homework_type == "normal" ? "common_homework" : "group_homework" + @main_category = @course.course_modules.find_by(module_type: module_type) + else + @category = @homework.course_second_category + end end def update diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index bcb88ad85..af6305a64 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -212,6 +212,11 @@ class QuestionBanksController < ApplicationController homework_type: homework.homework_type, course_id: course.id, homework_bank_id: homework.id, reference_answer: homework.reference_answer) + if params[:category].present? + category = course.course_second_categories.find_by(id: params[:category]) + new_homework.course_second_category_id = category&.id.to_i + end + # 作业的基本设置复制 new_homework.homework_detail_manual = HomeworkDetailManual.new new_homework_detail_manual = new_homework.homework_detail_manual diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a6a919981..58a420581 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -69,17 +69,18 @@ class HomeworkCommon < ApplicationRecord # 作业对应的子目录/父目录名称 def category_info - case self.homework_type - when 'normal' - {category_id: course.common_course_modules.first.try(:id), category_name: course.common_course_modules.first.try(:module_name), main: 1} - when 'group' - {category_id: course.group_course_modules.first.try(:id), category_name: course.group_course_modules.first.try(:module_name), main: 1} - when 'practice' - if self.course_second_category.present? - {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0} - else - {category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name), main: 1} - end + if self.course_second_category.present? + {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0} + else + course_module = case homework_type + when 'normal' + course.common_course_modules.take + when 'group' + course.group_course_modules.take + when 'practice' + course.shixun_course_modules.take + end + {category_id: course_module.try(:id), category_name: course_module.try(:module_name), main: 1} end end diff --git a/app/views/exercises/exercise_setting.json.jbuilder b/app/views/exercises/exercise_setting.json.jbuilder index 25c6fa588..84cd31c55 100644 --- a/app/views/exercises/exercise_setting.json.jbuilder +++ b/app/views/exercises/exercise_setting.json.jbuilder @@ -1,7 +1,7 @@ json.exercise do json.extract! @exercise, :id,:exercise_name, :exercise_status,:time,:publish_time, :end_time,:score_open,:answer_open,:question_random,:choice_random, - :unified_setting,:show_statistic + :unified_setting,:show_statistic,:assistant_auth json.course_id @course.id json.published_count @exercise_publish_count json.unpublish_count @exercise_unpublish_count diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder index 0002cf299..e7805c0d8 100644 --- a/app/views/files/index.json.jbuilder +++ b/app/views/files/index.json.jbuilder @@ -14,6 +14,7 @@ json.data do json.partial! "users/user_simple", user: attachment.author end # json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings + json.category_id attachment.course_second_category_id if @course_second_category_id.to_i == 0 json.category_name attachment.course_second_category&.name end diff --git a/app/views/homework_commons/edit.json.jbuilder b/app/views/homework_commons/edit.json.jbuilder index 49dc11dd8..d2eb865ac 100644 --- a/app/views/homework_commons/edit.json.jbuilder +++ b/app/views/homework_commons/edit.json.jbuilder @@ -1,6 +1,16 @@ json.course_id @course.id json.course_name @course.name -json.category @homework.category_info +# json.category @homework.category_info + +json.category do + if @category.present? + json.category_id @category.id + json.category_name @category.name + else + json.category_id @main_category&.id + json.category_name @main_category&.module_name + end +end json.(@homework, :id, :name, :description, :reference_answer) diff --git a/app/views/homework_commons/new.json.jbuilder b/app/views/homework_commons/new.json.jbuilder index 82a5d78fa..9a703d40f 100644 --- a/app/views/homework_commons/new.json.jbuilder +++ b/app/views/homework_commons/new.json.jbuilder @@ -1,3 +1,11 @@ json.course_id @course.id json.course_name @course.name -json.category @course.category_info(@homework_type == 1 ? "common_homework" : "group_homework") \ No newline at end of file +json.category do + if @category.present? + json.category_id @category.id + json.category_name @category.name + else + json.category_id @main_category&.id + json.category_name @main_category&.module_name + end +end \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 98c56ff37..f54c99978 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -130,16 +130,17 @@ class CoursesBanner extends Component { axios.get(url,{params: dataqueryss }).then((result) => { - if(result.data.status===-2){ - // this.setState({ - // AccountProfiletype:true, - // content:result.data.message, - // okText:"立即认证", - // cannelText:"稍后认证", - // okHref:`/account/certification`, - // Accounturltype:true - // }) - }else{ + try { + if(result.data.status===-2){ + // this.setState({ + // AccountProfiletype:true, + // content:result.data.message, + // okText:"立即认证", + // cannelText:"稍后认证", + // okHref:`/account/certification`, + // Accounturltype:true + // }) + }else{ if( result!=undefined){ let data = result.data; this.setState({ @@ -150,8 +151,12 @@ class CoursesBanner extends Component { }else{ this.onloadupdatabanner() } + } + }catch (e) { + } + }) }; foo=(url)=> { diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js index 7c6e6cf6e..4950d10d0 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js @@ -42,8 +42,8 @@ class ModulationModal_exercise extends Component { } componentDidMount = () => { - console.log("ModulationModal_exercise"); - console.log(this.props); + // console.log("ModulationModal_exercise"); + // console.log(this.props); this.setState({ subjective_score: this.props.subjective_score, objective_score: this.props.objective_score, diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 52f05bb6d..a4bdc5c29 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -75,9 +75,10 @@ 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(); - // console.log(this.props.current_user.user_id) return(
window.$(`.exerciseitem${index} input`).click() }> { @@ -189,8 +190,31 @@ class ExerciseListItem extends Component{ { IsAdmin &&
- 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`)}>查看详情 + } + + { + 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 0e613a554..0bd596c35 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -75,10 +75,11 @@ class Exercisesetting extends Component{ limit:10, searchtext:"", order: "end_at", + assistant_auth:false } - console.log("Exercisesetting"); - console.log("69"); - console.log(props); + // console.log("Exercisesetting"); + // console.log("69"); + // console.log(props); } _getRequestParams() { const { order, exercise_group_id,searchtext, page ,limit} = this.state @@ -92,6 +93,12 @@ class Exercisesetting extends Component{ } //加载 componentDidMount=()=>{ + this.setState({ + assistant_auth:this.props.assistant_auth, + }) + + + this.getSettingInfo(); // window.addEventListener('click', this.handleClick); @@ -108,11 +115,34 @@ 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){ this.editSetting() } + if(prevProps.assistant_auth!= this.props.assistant_auth){ + this.setState({ + assistant_auth:this.props.assistant_auth, + }) + } } _getRequestParams() { @@ -348,10 +378,16 @@ class Exercisesetting extends Component{ this.commitSetting((result)=>{ console.log(result) - if(result.status==200){ + if(result.status===200){ this.props.showNotification(`${result.data.message}`); this.getSettingInfo(1); this.cancelEdit(); + try { + this.props.assistantauthoritys(this.state.assistant_auth); + + }catch (e) { + + } } }) } @@ -371,6 +407,12 @@ class Exercisesetting extends Component{ this.props.showNotification(`${result.data.message}`); this.cancelEdit(); this.getSettingInfo(1); + try { + this.props.assistantauthoritys(this.state.assistant_auth); + + }catch (e) { + + } } }); @@ -386,11 +428,12 @@ class Exercisesetting extends Component{ publish_time:this.state.publish_time, end_time:this.state.end_time, show_statistic:this.state.show_statistic, - choice_random:this.state.choice_random, + choice_random:this.state.choice_random, score_open:this.state.score_open, answer_open:this.state.answer_open, question_random:this.state.question_random, time:this.state.time, + assistant_auth:this.state.assistant_auth, } }else{ let list=this.state.rules; @@ -403,7 +446,6 @@ class Exercisesetting extends Component{ } lists.push(newlist) }) - params={ unified_setting:this.state.unified_setting, show_statistic:this.state.show_statistic, @@ -413,6 +455,7 @@ class Exercisesetting extends Component{ answer_open:this.state.answer_open, publish_time_groups:lists, time:this.state.time, + assistant_auth:this.state.assistant_auth, } } axios.post((url),params).then((result)=>{ @@ -491,6 +534,12 @@ class Exercisesetting extends Component{ }) } + assistantauthority=(e)=>{ + this.setState({ + assistant_auth:e.target.checked + }) + } + onChangeTimepublish=(date, dateString)=>{ if(date===null){ this.setState({ @@ -555,9 +604,33 @@ class Exercisesetting extends Component{ modalSave:this.cancelBox }) }else{ - this.setState({ - flagPageEdit:true - }) + if(this.props.isAdmin()===true){ + try { + //是否为助教 + if(this.props.isAssistant()===true){ + //如果是助教是否有权限 + if(this.props.assistant_auth===true){ + this.setState({ + flagPageEdit:true + }) + }else{ + this.setState({ + flagPageEdit:false + }) + } + }else{ + //是老师 + this.setState({ + flagPageEdit:true + }) + } + }catch (e) { + this.setState({ + flagPageEdit:true + }) + } + } + } } //取消编辑 @@ -608,7 +681,9 @@ class Exercisesetting extends Component{ // console.log("asdasdasda"); // console.log(this.props); // console.log(this.props.Commonheadofthetestpaper); - return( + + + return(
发布设置 { !flagPageEdit&&this.props.isAdmin()===true ? - - 编辑设置 - {/**/} - {/**/} - {/**/} - - :"" + ( + this.props.isAssistant()===true? + ( + this.props.assistant_auth===true? + + 编辑设置 + + : + "" + ) + : + + 编辑设置 + + ) + :"" }

@@ -769,7 +853,7 @@ class Exercisesetting extends Component{
-

公开设置

+

属性设置

@@ -790,7 +874,7 @@ class Exercisesetting extends Component{ (选中,则在试卷截止时间之后,已提交答题的学生可以查看试卷题目的答案,否则不能查看)

-

+

{getFieldDecorator('show_statistic') ( @@ -799,6 +883,15 @@ class Exercisesetting extends Component{ (选中,则在试卷截止时间之后,已提交答题的学生可以查看答题统计,否则不能查看)

+

+ + {getFieldDecorator('assistantauthority') + ( + 助教权限 + )} + + (选中,则允许助教查看答案) +

@@ -808,7 +901,10 @@ class Exercisesetting extends Component{
取消 -
:"" +
+ + + :"" } @@ -820,70 +916,3 @@ const WrappedExercisesetting = Form.create({ name: 'exercisesetting' })(Exercise export default WrappedExercisesetting; -// //提交form表单 -// handleSubmit = (e) => { -// -// let{unified_setting,answer_open}=this.state; -// e.preventDefault(); -// let exercise_id=this.props.match.params.Id; -// -// this.props.form.validateFieldsAndScroll((err, values) => { -// debugger -// if(!err){ -// // 第一次进行问卷设置或者勾选了统一设置 -// if(unified_setting==true){ -// if(this.state.p_flag == false && this.state.e_flag == true){ -// // 选择了发布时间但截至时间没有选择 -// this.setState({ -// modalsType:true, -// modalsTopval:"请选择截止时间", -// loadtype:true, -// modalSave:this.cancelBox -// }) -// return; -// }else if(this.state.p_flag == true && this.state.e_flag == true){ -// // 如果两个时间都没有填写则弹出立即发布弹框 -// let{publish_time,end_time}=this.state -// if(publish_time==undefined && end_time ==undefined){ -// -// }else{ -// // 否则就是选择的时间错误 -// this.setState({ -// modalsType:true, -// modalsTopval:"请选择正确的发布时间和截止时间", -// loadtype:true, -// modalSave:this.cancelBox -// }) -// } -// return; -// } -// } -// -// let url=`/exercises/${exercise_id}/commit_setting.json`; -// let params=[]; -// if(values.unitSet){ -// params={ -// unified_setting:values.unitSet, -// publish_time:this.state.publish_time, -// end_time:this.state.end_time, -// show_result:values.public, -// un_anonymous:values.real -// } -// }else{ -// params={ -// unified_setting:values.unitSet, -// show_result:values.public, -// un_anonymous:values.real, -// publish_time_groups:this.state.rules -// } -// } -// axios.post((url),{params}).then((result)=>{ -// if(result.status==200){ -// this.props.showNotification(`${result.data.message}`); -// } -// }).catch((error)=>{ -// console.log(error); -// }) -// } -// }) -// } diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 9c6e8a87b..c3d4bf465 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -28,6 +28,7 @@ const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; const {Option} = Select; //学生老师页面 +let columnsystwo=[]; class Studentshavecompletedthelist extends Component { // http://localhost:3007/courses/1309/exercises/722/exercises/student_exercise_list?debug=s constructor(props) { @@ -1158,237 +1159,56 @@ class Studentshavecompletedthelist extends Component { { record.submitstate === "未提交"||record.commit_method===5? - this.Adjustment(record.user_id)}>评阅 + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + this.Adjustment(record.user_id)}>评阅 + : + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + this.Adjustment(record.user_id)}>评阅 + : + -- + ) + ) + : + this.Adjustment(record.user_id)}>评阅 + ) :record.submitstate === "已提交"? - {record.finalscore} + (//是否助教 + this.props.isAssistant()&&this.props.isAssistant()===true? + (//助教是否有权限 + this.props.assistant_auth&&this.props.assistant_auth===true? + {record.finalscore} + : + (//是否截止 + this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? + {record.finalscore} + : + -- + ) + ) + : + {record.finalscore} + ) : -- } - + ) }, ], - columnsystwo: [ - { - title: '序号', - dataIndex: 'number', - key: 'number', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.number === "--" ? - -- - : - {record.number} - } - - ) - }, - { - title: '姓名', - dataIndex: 'name', - key: 'name', - align: 'center', - className: "edu-txt-center font-14", - - render: (text, record) => ( - - {record.name==="--"? - {record.name} - : - {record.name} - } - - ) - }, - { - title: '学号', - dataIndex: 'stduynumber', - key: 'stduynumber', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - - {record.stduynumber === "--" ? - {record.stduynumber} - : - {record.stduynumber} - } - - ), - }, - { - title: '分班', - key: 'classroom', - dataIndex: 'classroom', - align: 'center', - className: "edu-txt-center font-14 maxnamewidth260 ", - width:'260px', - render: (text, record) => ( - - {record.classroom==="--"? - {record.classroom} - : - {record.classroom} - } - - ) - }, - { - title: '提交状态', - dataIndex: 'submitstate', - key: 'submitstate', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.submitstate} - - - ) - - }, - { - title: '提交时间', - dataIndex: 'updatetime', - key: 'updatetime', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - defaultSortOrder: 'descend', - sortDirections: sortDirections, - render: (text, record) => ( - - {record.updatetime==="--"? - -- - : - {record.updatetime} - } - - ), - }, - { - title: '客观题得分', - dataIndex: 'completion', - key: 'completion', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.completion=== "--"? - -- - : - {record.completion} - } - - ) - }, - { - title: '主观题得分', - dataIndex: 'levelscore', - key: 'levelscore', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - {record.levelscore==="--"? - -- - : - {record.levelscore} - } - - ) - }, - { - title: '最终成绩', - dataIndex: 'efficiencyscore', - key: 'efficiencyscore', - align: 'center', - className: "edu-txt-center font-14", - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - - {record.efficiencyscore === "--" ? - -
未评分
-
}> - -- - - : - record.commit_method===5? - -
最终调整成绩:{record.efficiencyscore}分
- }> - 90 ? { - color: '#DD1717', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 90 ? { - color: '#FF6800', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 60 ? { - color: '#747A7F', - textAlign: "center", - } : { - color: '#747A7F', - textAlign: "center", - }}>{record.efficiencyscore} -
- : - 90 ? { - color: '#DD1717', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 90 ? { - color: '#FF6800', - textAlign: "center", - } : parseInt(record.efficiencyscore) <= 60 ? { - color: '#747A7F', - textAlign: "center", - } : { - color: '#747A7F', - textAlign: "center", - }}>{record.efficiencyscore} - } - - ) - }, - { - title: '操作', - dataIndex: 'finalscore', - key: 'finalscore', - align: 'center', - className: "edu-txt-center font-14", - render: (text, record) => ( - - { - record.submitstate === "未提交"||record.commit_method===5? - this.Adjustment(record.user_id)}>评阅 - :record.submitstate === "已提交"? - {record.finalscore} - : - -- - } - - ) - }, - ],//columnsystwo 也会被columnsys当作参数接收 + // 也会被columnsys当作参数接收 exercise_status:0, order_type: "desc", exeuserid: 0, @@ -1449,20 +1269,23 @@ class Studentshavecompletedthelist extends Component { } componentDidMount() { - // if(this.props.isAdmin() === true){ - // this.Teacherliststudentlistsy(); - // //console.log("1111111111111111"); - // //console.log(this.props.isAdmin()); - // }else { + //被columnsys当作参数接收 + // console.log("componentDidMount"); + // console.log(columnsystwo); + try { + columnsystwo=this.state.columnsys; + }catch (e) { + + } + // console.log(columnsystwo); this.Teacherliststudentlist(); - // //console.log("2222222222222"); - // //console.log(this.props.isAdmin()); - // } + try { this.props.triggerRef(this); }catch (e) { } + } componentWillReceiveProps = (nextProps) => { @@ -2163,7 +1986,7 @@ class Studentshavecompletedthelist extends Component { course_groups: response.data.course_groups, mylistansum:response.data.exercise_types.answer_users+response.data.exercise_types.unanswer_users, loadingstate: false, - columnsys: this.state.columnsystwo, + columnsys: columnsystwo, subjective: response.data.exercise_types.subjective, objective_score: response.data.exercise_types.objective_score, subjective_score: response.data.exercise_types.subjective_score, @@ -2772,8 +2595,16 @@ class Studentshavecompletedthelist extends Component { } // 调分 Adjustment = (e) => { - console.log("Adjustment"); - console.log(e); + // console.log("Adjustment"); + // console.log(e); + if(this.state.objective_score===0&&this.state.subjective_score===0){ + this.props.showNotification('试卷题型分被限制为0分,不能调分,请点击编辑试卷修改题型分数'); + + return + } + + + this.setState({ testpapergradingboll: true, exeuserid: e, @@ -2828,8 +2659,8 @@ class Studentshavecompletedthelist extends Component { // //console.log("this.props.Commonheadofthetestpaper.exercise_status"); // //console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status); // //console.log(exercise_status); - console.log("Studentshavecompletedthelis123123t"); - console.log(columnss); + // console.log("Studentshavecompletedthelis123123t"); + // console.log(columnss); return ( isAdmin === true ? ( diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index ce63ca526..88d1755f0 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -35,6 +35,7 @@ class Testpapersettinghomepage extends Component{ DownloadMessageval:undefined, donwloading:false, exercise_status:3, + assistant_auth:false, //设置助教 } } //切换tab @@ -72,6 +73,7 @@ class Testpapersettinghomepage extends Component{ Commonheadofthetestpaper:response.data, current_status:response.data.user_permission.current_status, exercise_status:response.data.exercise_status, + assistant_auth:response.data.assistant_auth, }) // console.log(JSON.stringify(response.data.show_statistic)); @@ -85,6 +87,12 @@ class Testpapersettinghomepage extends Component{ } + assistantauthoritys=(bool)=>{ + this.setState({ + assistant_auth:bool, + }) + } + Ecerciseacallagain=()=>{ this.setState({ visible:true @@ -287,9 +295,11 @@ class Testpapersettinghomepage extends Component{ this.props.history.goBack() } render(){ - let {tab,visible,Commonheadofthetestpaper,exercise_status}=this.state; + 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); @@ -353,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? 答题列表 统计结果 @@ -437,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? @@ -461,22 +506,22 @@ class Testpapersettinghomepage extends Component{ /> { // 教师列表 - parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}>:"" + parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} yslstustate={[`${polls_status[Commonheadofthetestpaper && Commonheadofthetestpaper.exercise_status]}`]}>:"" } {/*统计结果*/} { - parseInt(tab[0])==1 ? :"" + parseInt(tab[0])==1 ? :"" } { - parseInt(tab[0])==2 ? :"" + parseInt(tab[0])==2 ? :"" } { - parseInt(tab[0])==3 ? :"" + parseInt(tab[0])==3 ? this.assistantauthoritys(bool)}>:"" }
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,