diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 39401d079..6dcbea254 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -478,16 +478,15 @@ class StudentWorksController < ApplicationController ActiveRecord::Base.transaction do challenge = @homework.shixuns.first&.challenges.find_by(id: params[:challenge_id]) unless params[:challenge_id].blank? if challenge.present? - comment = @work.shixun_work_comments.find_by(challenge_id: challenge.id) || + @comment = @work.shixun_work_comments.find_by(challenge_id: challenge.id) || ShixunWorkComment.new(student_work_id: @work.id, user_id: current_user.id, challenge_id: challenge.id) else - comment = @work.shixun_work_comments.find_by(challenge_id: 0) || + @comment = @work.shixun_work_comments.find_by(challenge_id: 0) || ShixunWorkComment.new(student_work_id: @work.id, user_id: current_user.id, challenge_id: 0) end - comment.comment = params[:comment] - comment.hidden_comment = params[:hidden_comment] - comment.save! - normal_status("评阅成功") + @comment.comment = params[:comment] + @comment.hidden_comment = params[:hidden_comment] + @comment.save! end end diff --git a/app/views/student_works/shixun_work_comment.json.jbuilder b/app/views/student_works/shixun_work_comment.json.jbuilder new file mode 100644 index 000000000..f9f47cba5 --- /dev/null +++ b/app/views/student_works/shixun_work_comment.json.jbuilder @@ -0,0 +1,3 @@ +json.comment_id @comment.id +json.status 0 +json.message "评阅成功" \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js index 9d1efa5b0..a78e5be62 100644 --- a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js +++ b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js @@ -72,8 +72,9 @@ class AppraiseModal extends Component{ challenge_id:challenge_id }).then((response) => { if(response.data.status===0){ + debugger this.props.showNotification(response.data.message) - this.props.showCancel(comment,hidden_comment,challenge_id) + this.props.showCancel(comment,hidden_comment,response.data.comment_id) }else{ this.props.showNotification(response.data.message) } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 374aef8d4..e1b6590b5 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -157,7 +157,7 @@ class ShixunWorkReport extends Component { showAppraiseModal=(type,id,show,hidden)=>{ let{data}=this.state; - debugger + if(type==="child"){ data.stage_list.forEach((item,key)=>{ if(item.challenge_id===id){ @@ -192,12 +192,13 @@ class ShixunWorkReport extends Component { let{data,showAppraisetype}=this.state; - debugger + if(showAppraisetype==="child"){ data.stage_list.forEach((item,key)=>{ if(item.challenge_id===id){ item.challenge_comment=show; item.challenge_comment_hidden=hidden; + item.challenge_id=id; } }) this.setState({ @@ -205,10 +206,12 @@ class ShixunWorkReport extends Component { data:data }) }else{ + data.comment_id=id this.setState({ showAppraiseModaltype:false, work_comment:show, - work_comment_hidden:hidden + work_comment_hidden:hidden, + data:data }) } diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js index 0cb75dee3..be99c7035 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js @@ -15,31 +15,7 @@ class OfficialAcademicTranscript extends Component { } componentDidMount() { - let {data}=this.props; - - let datas=[]; - if(data!=undefined){ - data.stage_list===undefined?"":data.stage_list.forEach((item,key)=>{ - datas.push({ - customs: key+1, - taskname:{name:item.name,complete_status:item.complete_status}, - openingtime:item.open_time, - evaluating: item.evaluate_count, - finishtime:item.finished_time, - elapsedtime:item.time_consuming, - empvalue:{myself:item.myself_experience,experience:item.experience}, - game_scores:{game_score:item.game_score,game_score_full:item.game_score_full}, - challenge_id:{id:item.challenge_id}, - challenge_comment: item.challenge_comment, - challenge_comment_hidden: item.challenge_comment_hidden, - // adjustmentminute:asdasd - }) - }) - this.setState({ - datas:datas - }) - } } myjumptopic=(e)=>{ console.log("获取到值"); @@ -98,7 +74,28 @@ class OfficialAcademicTranscript extends Component { } render() { - let {datas,customsids}=this.state; + let {customsids}=this.state; + let {data}=this.props; + + let datas=[]; + if(data!=undefined){ + data.stage_list===undefined?"":data.stage_list.forEach((item,key)=>{ + datas.push({ + customs: key+1, + taskname:{name:item.name,complete_status:item.complete_status}, + openingtime:item.open_time, + evaluating: item.evaluate_count, + finishtime:item.finished_time, + elapsedtime:item.time_consuming, + empvalue:{myself:item.myself_experience,experience:item.experience}, + game_scores:{game_score:item.game_score,game_score_full:item.game_score_full}, + challenge_id:{id:item.challenge_id}, + challenge_comment: item.challenge_comment, + challenge_comment_hidden: item.challenge_comment_hidden, + // adjustmentminute:asdasd + }) + }) + } let columns=[{ title: '关卡',