diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 28b5d84ef..0943f69fb 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -842,23 +842,27 @@ class ExercisesController < ApplicationController exercise_users = exercise.exercise_users exercise.update_attributes(:exercise_status => 3, :end_time => Time.now,:unified_setting => true) end - exercise_users.each do |user| - if user.commit_status == 0 && user.start_at.present? - objective_score = calculate_student_score(exercise,user.user)[:total_score] - user_sub_score = user.subjective_score - subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score - total_score = objective_score + subjective_score - commit_option = { - :status => 1, - :commit_status => 1, - :end_at => Time.now, - :objective_score => objective_score, - :score => total_score, - :subjective_score => user_sub_score - } - user.update_attributes(commit_option) - end - end + + ex_user_ids = exercise_users.pluck(:id) + + EndExerciseCalculateJob.perform_later(ex_user_ids,exercise) + # exercise_users.each do |user| + # if user.commit_status == 0 && user.start_at.present? + # objective_score = calculate_student_score(exercise,user.user)[:total_score] + # user_sub_score = user.subjective_score + # subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score + # total_score = objective_score + subjective_score + # commit_option = { + # :status => 1, + # :commit_status => 1, + # :end_at => Time.now, + # :objective_score => objective_score, + # :score => total_score, + # :subjective_score => user_sub_score + # } + # user.update_attributes(commit_option) + # end + # end end end normal_status(0, "试卷截止成功!") diff --git a/app/controllers/users/courses_controller.rb b/app/controllers/users/courses_controller.rb index c7e957e1a..2c5e29d2b 100644 --- a/app/controllers/users/courses_controller.rb +++ b/app/controllers/users/courses_controller.rb @@ -3,7 +3,7 @@ class Users::CoursesController < Users::BaseController courses = Users::CourseService.new(observed_user, query_params).call @count = courses.count - @courses = paginate(courses.includes(teacher: { user_extension: :school }), special: true) + @courses = paginate(courses.includes(teacher: { user_extension: :school }), special: observed_user.is_teacher?) end private diff --git a/app/controllers/users/projects_controller.rb b/app/controllers/users/projects_controller.rb index 07f4d5cac..8ffa8fa85 100644 --- a/app/controllers/users/projects_controller.rb +++ b/app/controllers/users/projects_controller.rb @@ -5,7 +5,7 @@ class Users::ProjectsController < Users::BaseController projects = Users::ProjectService.new(observed_user, query_params).call @count = projects.count - @projects = paginate(projects.includes(:project_score, owner: { user_extension: :school }), special: true) + @projects = paginate(projects.includes(:project_score, owner: { user_extension: :school }), special: observed_user.is_teacher?) end def search diff --git a/app/controllers/users/shixuns_controller.rb b/app/controllers/users/shixuns_controller.rb index 7b840a0a1..5d8da9684 100644 --- a/app/controllers/users/shixuns_controller.rb +++ b/app/controllers/users/shixuns_controller.rb @@ -3,7 +3,7 @@ class Users::ShixunsController < Users::BaseController shixuns = Users::ShixunService.new(observed_user, query_params).call @count = shixuns.count - @shixuns = paginate(shixuns.includes(:first_tag_repertoire), special: true) + @shixuns = paginate(shixuns.includes(:first_tag_repertoire), special: observed_user.is_teacher?) ids = @shixuns.map(&:id) @finished_challenges_count_map = Game.joins(:myshixun).where(user_id: observed_user.id, status: 2) diff --git a/app/controllers/users/subjects_controller.rb b/app/controllers/users/subjects_controller.rb index 2a4a7975f..2f8f308df 100644 --- a/app/controllers/users/subjects_controller.rb +++ b/app/controllers/users/subjects_controller.rb @@ -3,7 +3,7 @@ class Users::SubjectsController < Users::BaseController subjects = Users::SubjectService.new(observed_user, query_params).call @count = subjects.count - @subjects = paginate(subjects.includes(:user, :repertoire), special: true) + @subjects = paginate(subjects.includes(:user, :repertoire), special: observed_user.is_teacher?) end private diff --git a/app/jobs/end_exercise_calculate_job.rb b/app/jobs/end_exercise_calculate_job.rb new file mode 100644 index 000000000..39d8bb1db --- /dev/null +++ b/app/jobs/end_exercise_calculate_job.rb @@ -0,0 +1,29 @@ +class EndExerciseCalculateJob < ApplicationJob + + include ExercisesHelper + include GitHelper + + queue_as :default + + def perform(ex_user_ids,exercise) + exercise_users = ExerciseUser.where(id: ex_user_ids) + exercise_users.each do |user| + if user.commit_status == 0 && user.start_at.present? + objective_score = calculate_student_score(exercise,user.user)[:total_score] + user_sub_score = user.subjective_score + subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score + total_score = objective_score + subjective_score + commit_option = { + :status => 1, + :commit_status => 1, + :end_at => Time.now, + :objective_score => objective_score, + :score => total_score, + :subjective_score => user_sub_score + } + user.update_attributes(commit_option) + end + end + end + +end diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index aabcd8fb7..7990f9557 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - // devtool: "eval-source-map", // 开启调试 + // devtool: "eval-source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/App.css b/public/react/src/App.css index 1c8ce15e1..07d3d718d 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -92,6 +92,10 @@ html, body { .formItemInline .ant-form-item-control-wrapper { flex: 1; } +/* AutoComplete placeholder 不显示的问题 */ +.ant-select-auto-complete.ant-select .ant-select-selection__placeholder { + z-index: 2; +} /* 兼容性 */ diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 025db7f5c..d402da0ec 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -33,6 +33,7 @@ if (isDev) { } window._debugType = debugType; export function initAxiosInterceptors(props) { + initOnlineOfflineListener() // TODO 避免重复的请求 https://github.com/axios/axios#cancellation // https://github.com/axios/axios/issues/1497 @@ -203,4 +204,28 @@ export function initAxiosInterceptors(props) { }); // ----------------------------------------------------------------------------------- +} + + +function initOnlineOfflineListener() { + const $ = window.$ + $(window).bind("online", () => { + notification.destroy() + notification.success({ + duration: null, + message: '网络恢复正常', + description: + '网络恢复正常,感谢使用。', + }) + }); + $(window).bind("offline", () => { + notification.destroy() + + notification.warning({ + duration: null, + message: '网络异常', + description: + '网络异常,请检测网络后重试。', + }) + }); } \ No newline at end of file diff --git a/public/react/src/modules/comment/CommentItemMDEditor.js b/public/react/src/modules/comment/CommentItemMDEditor.js index 98afa4228..8c49d356f 100644 --- a/public/react/src/modules/comment/CommentItemMDEditor.js +++ b/public/react/src/modules/comment/CommentItemMDEditor.js @@ -110,7 +110,7 @@ class CommentItemMDEditor extends Component { 0?1442652658 -
diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index 6d1c402ce..b1ada5bb5 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -116,6 +116,7 @@ class Boards extends Component{ this.setState({ isSpin:true }) + this.clearAllCheck() this.fetchAll(null, 1) } } diff --git a/public/react/src/modules/courses/common/ModalWrapper.js b/public/react/src/modules/courses/common/ModalWrapper.js index e92a508d6..8b7e87692 100644 --- a/public/react/src/modules/courses/common/ModalWrapper.js +++ b/public/react/src/modules/courses/common/ModalWrapper.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Modal,Input, Checkbox} from "antd"; +import { Modal,Input, Checkbox, Spin} from "antd"; import '../css/members.css' class ModalWrapper extends Component{ @@ -23,7 +23,7 @@ class ModalWrapper extends Component{ } render(){ let {flag, visible}=this.state - let { onOk, cancelText, okText, title, width, className, bottomRender}=this.props; + let { onOk, cancelText, okText, title, width, className, bottomRender, loading}=this.props; return( :"" } +
{this.props.children} {this.props.checkBoxValuestype===true?
@@ -59,6 +60,7 @@ class ModalWrapper extends Component{
{ bottomRender }
+
) } diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index bae89a7ba..062390f1e 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -19,19 +19,30 @@ class NewShixunModel extends Component{ order:'desc', diff:0, limit:15, + sort:"myshixuns_count" } } componentDidMount() { - let{page,type,keyword,order,diff,limit,status}=this.state; - this.getdatalist(page,type,status,keyword,order,diff,limit) + let{page,type,keyword,order,diff,limit,status,sort}=this.state; + if(this.props.type==='shixuns'){ + this.getdatalist(page,type,status,keyword,order,diff,limit) + }else{ + this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort); + } + } - getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype)=>{ + getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{ this.setState({ isspinning:true }) let status=this.props.statustype===undefined?newstatus:'published'; - let url="/shixun_lists.json" + let url; + if(this.props.type==='shixuns'){ + url="/shixun_lists.json"; + }else{ + url="/subject_lists.json"; + } axios.get(url,{params:{ page, type, @@ -39,20 +50,21 @@ class NewShixunModel extends Component{ keyword, order, diff, - limit + limit, + sort }}).then((response) => { if(response.data){ if(pagetype===undefined){ this.setState({ - shixun_list:response.data.shixun_list, - shixuns_count:response.data.shixuns_count, + shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list, + shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count, Grouplist:[], isspinning:false }) }else if(pagetype==="pagetype"){ this.setState({ - shixun_list:response.data.shixun_list, - shixuns_count:response.data.shixuns_count, + shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list, + shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count, isspinning:false }) } @@ -127,8 +139,13 @@ class NewShixunModel extends Component{ newallGrouplist.push({page:pageNumber,list:[]}) } - let{type,status,keyword,order,diff,limit}=this.state; - this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype") + let{type,status,keyword,order,diff,limit,sort}=this.state; + if(this.props.type==='shixuns'){ + this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype") + }else{ + this.getdatalist(pageNumber,type,undefined,keyword,order,undefined,limit,"pagetype",sort); + } + this.setState({ page:pageNumber, allGrouplist:newallGrouplist @@ -142,8 +159,14 @@ class NewShixunModel extends Component{ keyword:undefined, page:1 }) - let{status,order,diff,limit}=this.state; - this.getdatalist(1,value,status,undefined,order,diff,limit) + let{status,order,diff,limit,sort}=this.state; + if(this.props.type==='shixuns'){ + this.getdatalist(1,value,status,undefined,order,diff,limit) + }else{ + this.getdatalist(1,value,undefined,undefined,order,undefined,limit,undefined,sort) + } + + } updatedlist=(order)=>{ @@ -205,7 +228,7 @@ class NewShixunModel extends Component{ this.setState({ hometypepvisible:false }) - this.showNotification("请先选择实训") + this.showNotification(this.props.type==='shixuns'?"请先选择实训":"请先选择课程") return } @@ -231,33 +254,64 @@ class NewShixunModel extends Component{ this.props.pathShixun(Grouplist) return; } - let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; - axios.post(url, { - category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), - shixun_ids:Grouplist, - } - ).then((response) => { - if(response.data.status===-1){ - // this.props.showNotification(response.data.message) - - }else{ - // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) - this.showNotification("操作成功") - this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); - this.props.hideNewShixunModelType() - - } - this.setState({ - hometypepvisible:false + if(this.props.type==='shixuns'){ + let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; + axios.post(url, { + category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), + shixun_ids:Grouplist, + } + ).then((response) => { + if(response.data.status===-1){ + // this.props.showNotification(response.data.message) + + }else{ + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.showNotification("操作成功") + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); + this.props.hideNewShixunModelType() + this.props.updataleftNavfun() + } + this.setState({ + hometypepvisible:false + }) + // category_id: 3 + // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] + }).catch((error) => { + console.log(error) + this.setState({ + hometypepvisible:false + }) }) - // category_id: 3 - // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] - }).catch((error) => { - console.log(error) - this.setState({ - hometypepvisible:false + }else{ + let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json"; + axios.post(url, { + category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), + subject_ids:Grouplist, + } + ).then((response) => { + if(response.data.status===-1){ + // this.props.showNotification(response.data.message) + + }else{ + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.showNotification("操作成功") + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); + this.props.hideNewShixunModelType() + this.props.updataleftNavfun() + } + this.setState({ + hometypepvisible:false + }) + // category_id: 3 + // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] + }).catch((error) => { + console.log(error) + this.setState({ + hometypepvisible:false + }) }) - }) + } + } poststatus=(status)=>{ @@ -268,9 +322,37 @@ class NewShixunModel extends Component{ this.getdatalist(page,type,status,keyword,order,diff,limit) } + updatepathlist=(sorts,orders)=>{ + let{page,type,keyword,order,diff,limit,status,sort}=this.state; + let seartorders; + if(sort===sorts){ + if(orders==="desc"){ + this.setState({ + sort:sorts, + order:"asc" + }) + seartorders="asc" + }else{ + this.setState({ + sort:sorts, + order:"desc" + }) + seartorders="desc" + } + }else{ + this.setState({ + sort:sorts, + order:"desc" + }) + seartorders=orders + } + + this.getdatalist(page,type,undefined,keyword,seartorders,undefined,limit,undefined,sorts) + + } render() { - let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state; + let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order,sort}=this.state; // let {visible,patheditarry}=this.props; // console.log(Grouplist) // console.log(allGrouplist) @@ -331,7 +413,7 @@ class NewShixunModel extends Component{ ); - + console.log(shixun_list) return(
@@ -355,7 +437,7 @@ class NewShixunModel extends Component{ closable={true} destroyOnClose={true} onClose={()=>this.props.hideNewShixunModelType()} - visible={this.props.NewShixunModelType} + visible={this.props.type==='shixuns'?this.props.NewShixunModelType:this.props.shixunpath} height={'100%'} > @@ -380,7 +462,7 @@ class NewShixunModel extends Component{ 搜索} onInput={(e)=>this.setdatafunsval(e)} @@ -391,34 +473,50 @@ class NewShixunModel extends Component{
- 已选 {Grouplist.length} 个实训 - {shixuns_count===undefined?"":shixuns_count} 个实训 + 已选 {Grouplist.length} 个{this.props.type==='shixuns'?'实训':'课程'} + {shixuns_count===undefined?"":shixuns_count} 个{this.props.type==='shixuns'?'实训':'课程'} - + {this.props.type==='shixuns'?"": + this.updatepathlist("shixuns_count",order)}>实训数 + + + + + } + + {this.props.type==='shixuns'?"": + this.updatepathlist("myshixuns_count",order)}>使用人数 + + + + + } + + {this.props.type==='shixuns'? this.updatedlist(order)}>学习人数 - + :""} - {this.props.statustype===undefined? + {this.props.type==='shixuns'?this.props.statustype===undefined? {status==='all'?"发布状态":status==='published'?"已发布":status==="unpublished"?"未发布":""} - :""} + :"":""} - + {this.props.type==='shixuns'? {diff===0?"难度":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""} - + :""}
{/*this.props.hideNewShixunModelType()}>返回*/} - this.belongto("mine")}>我的实训 - this.belongto("all")}>全部实训 + this.belongto("mine")}>我的{this.props.type==='shixuns'?'实训':"课程"} + this.belongto("all")}>全部{this.props.type==='shixuns'?'实训':"课程"}
@@ -461,7 +559,7 @@ class NewShixunModel extends Component{ {JSON.stringify(item.description) == "{}"?"":
} - {item.challenge_names.length===0?"":
+ {item.challenge_names===undefined?"":item.challenge_names.length===0?"":
{item.challenge_names.map((item,key)=>{ return( 第{key+1}关:{item} @@ -498,7 +596,7 @@ class NewShixunModel extends Component{
- {item.subjects.length===0?"":this.ItsCourse(item.subjects)}> + {item.subjects===undefined?"":item.subjects.length===0?"":this.ItsCourse(item.subjects)}> 所属课程 diff --git a/public/react/src/modules/courses/graduation/style.css b/public/react/src/modules/courses/graduation/style.css index c704a9c93..cf438a6a4 100644 --- a/public/react/src/modules/courses/graduation/style.css +++ b/public/react/src/modules/courses/graduation/style.css @@ -43,3 +43,14 @@ .TopicDetailTable .bottomBody li{border-bottom: 1px solid #eee;clear: both;} .TopicDetailTable .bottomBody li:last-child{border-bottom: none;} +.acrossSureBtn{ + width: 40px; + height: 24px; + line-height: 18px; + /* border: 1px solid rgba(76,172,255,1); */ + /* color: #4CACFF!important; */ + float: left; + /* border-radius: 4px; */ + text-align: center; +} + diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js b/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js new file mode 100644 index 000000000..98cb883d8 --- /dev/null +++ b/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js @@ -0,0 +1,543 @@ +import React, { Component } from 'react'; + +import { Modal , Radio , Table , Pagination , Select ,Divider ,Icon , Input,Checkbox } from "antd"; +import {Link} from 'react-router-dom' +import axios from 'axios'; + +import '../style.css' + + +const RadioGroup = Radio.Group; + +const { Option } = Select; +const $ = window.$; + +const bindTableColumn=(that)=>{ + let { course_groups }=that.state + const filter=course_groups && course_groups.map((i,key)=>{ + let list={ + value: i.id, + text: i.name + } + return list; + }) + const columns = [ + { + title: '序号', + dataIndex: 'index', + key: 'index', + width:"50px", + className:"edu-txt-center", + render: (id, student, index) => { + return (that.state.page - 1) * that.state.limit + index + 1 + } + }, + { + title: '姓名', + dataIndex: 'user_name', + key: 'user_name', + render: (user_name, line, index) => { + return( + {user_name} + ) + } + },{ + title: '学号', + dataIndex: 'student_id', + key: 'student_id', + render: (student_id, line, index) => { + return( + {student_id} + ) + } + },{ + title: '分班', + dataIndex: 'course_group_name', + key: 'course_group_name', + filters:filter, + render: (course_group_name, line, index) => { + return( + {course_group_name} + ) + } + } + ]; + if(that.state.comment_status == 2){ + columns.push({ + title: '交叉评阅老师', + dataIndex: 'cross_teachers', + key: 'cross_teachers', + width:"200px", + render: (cross_teachers, line, index) => { + return( + {cross_teachers} + ) + } + }) + }else{ + columns.push({ + title: '答辩组', + dataIndex: 'cross_groups', + key: 'cross_groups', + width:"200px", + render: (cross_groups, line, index) => { + return( + {cross_groups} + ) + } + }) + } + + if(course_groups&&course_groups.length===0){ + columns.some((item,key)=> { + if (item.title === "分班") { + columns.splice(key, 1) + return true + } + } + ) + } + return columns; +} +class GraduationAcross extends Component{ + constructor(props){ + super(props); + this.state={ + comment_status:2, + page:1, + limit:7, + group_ids:undefined, + users:undefined, + user_count:undefined, + graduation_groups:undefined, + course_groups:undefined, + teachers:undefined, + tableLoading:false, + chooseCount:0, + chooseId:undefined, + AcrossTeamIds:undefined, + searchValue:undefined, + showflag:false + } + } + + + + // 根据分班筛选 + filterByGroup=(value,record)=>{ + console.log(value); + console.log(record) + } + + // 切换分配方式 + funcommentstatus = (e) =>{ + this.setState({ + comment_status:e.target.value, + chooseCount:0, + chooseId:[], + AcrossTeamIds:undefined, + searchValue:undefined, + showflag:false, + page:1 + }) + let { group_ids }=this.state; + this.getList(1,group_ids,e.target.value); + } + + componentDidMount =()=>{ + let { comment_status }=this.props; + let { page,group_ids }=this.state; + this.setState({ + comment_status + }) + + this.getList(page,group_ids,comment_status); + + window.addEventListener('click', this.clickOther) + } + + clickOther = (e) =>{ + if(e.target && e.target.matches('#acrossContent') || e.target.matches(".ant-modal-body") + || e.target.matches(".acrossfoot") || e.target.matches(".acrossHead") || e.target.matches ('.ant-radio-wrapper') || + e.target.matches("th") || e.target.matches("td")) { + this.setState({ + showflag:false + }) + } + } + + componentWillUnmount() { + window.removeEventListener('click', this.clickOther); + } + + getList=(page,group_ids,comment_status)=>{ + let { limit }=this.state; + let { task_Id }=this.props; + this.setState({ + tableLoading:true + }) + let url=`/graduation_tasks/${task_Id}/cross_comment_setting.json`; + axios.get((url),{params:{ + page,limit,group_ids,comment_status + }}).then((result)=>{ + if(result){ + this.setState({ + users:result.data.work_users && result.data.work_users.map((item,key)=>{ + let list = { + key:item.work_id, + course_group_name:item.course_group_name, + cross_teachers: item.cross_teachers, + student_id:item.student_id, + user_name:item.user_name, + work_id:item.work_id + } + return list; + }), + user_count:result.data.user_count, + graduation_groups:result.data.graduation_groups, + course_groups:result.data.course_groups, + teachers:result.data.teachers, + tableLoading:false, + // AcrossTeamIds:result.data + }) + } + }).catch((error)=>{ + this.setState({ + tableLoading:false + }) + console.log(error); + }) + } + + // 切换分页 + onPageChange=(page)=>{ + this.setState({ + page, + showflag:false + }) + let{group_ids,comment_status}=this.state; + this.getList(page,group_ids,comment_status); + } + + // 下拉切换 + changeSelect = (AcrossTeamIds) =>{ + console.log(AcrossTeamIds) + this.setState({ + AcrossTeamIds + }) + } + + // 重置 + clearSelect =()=>{ + this.setState({ + AcrossTeamIds:undefined, + searchValue:undefined + }) + } + + // 确定分配 + sureAcross=()=>{ + let { AcrossTeamIds , chooseId , group_ids , comment_status,page }=this.state; + let { task_Id }=this.props; + + let type = comment_status == 2 ? "user_ids" : "graduation_group_ids"; + + let url=`/graduation_tasks/${task_Id}/assign_works.json`; + if(!AcrossTeamIds || (AcrossTeamIds && AcrossTeamIds.length==0)){ + this.props.showNotification(`请先选择${ comment_status == 2 ? "老师": "答辩组" }!`); + return; + } + if(!chooseId || (chooseId && chooseId.length==0)){ + this.props.showNotification("请先选择毕设作品!"); + return; + } + axios.post((url),{ + [type]:AcrossTeamIds, + work_ids:chooseId + }).then((result)=>{ + if(result){ + this.props.showNotification(result.data.message); + this.getList(page,group_ids,comment_status); + this.setState({ + showflag:false, + AcrossTeamIds:undefined, + chooseCount:0, + chooseId:[] + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + // 筛选 + handleTableChange =(pagination, filters, sorter)=>{ + console.log(filters.course_group_name) + // if(filters.course_group_name.length > 0){ + this.setState({ + page:1, + group_ids:filters.course_group_name + }) + let { comment_status }= this.state; + this.getList(1,filters.course_group_name,comment_status); + // } + } + + // 下拉搜索 + changeSearchValue=(e)=>{ + + this.setState({ + searchValue:e.target.value + }) + } + // 显示下拉 + changeFlag=(flag)=>{ + this.setState({ + showflag:flag + }) + } + + checkonChange=(e,list)=>{ + let newlist=[] + // AcrossTeamIds + let {comment_status}=this.state; + if(e.target.checked===true){ + if(comment_status===2){ + list.map((item,key)=>{ + newlist.push(String(item.user_id)) + }) + this.setState({ + AcrossTeamIds:newlist + }) + }else{ + list.map((item,key)=>{ + newlist.push(String(item.id)) + }) + this.setState({ + AcrossTeamIds:newlist + }) + } + }else{ + this.setState({ + AcrossTeamIds:undefined + }) + } + } + render(){ + let { + comment_status, + users, + user_count, + graduation_groups, + course_groups, + teachers, + page, + limit, + tableLoading, + chooseCount, + chooseId, + AcrossTeamIds, + searchValue,showflag + } = this.state; + let { modalVisible } = this.props; + let courseId = this.props.match.params.coursesId; + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + marginRight:'0px' + }; + + + + const rowSelection = { + // 选中行的key,选中行 + onChange: (selectedRowKeys, selectedRows) => { + this.setState({ + chooseId:selectedRowKeys, + chooseCount:selectedRowKeys.length, + showflag:false + }) + console.log(selectedRowKeys); + }, + selectedRowKeys:chooseId, + getCheckboxProps: record => ({ + disabled: record.name === 'Disabled User', // Column configuration not to be checked + name: record.name, + }), + }; + + + // 筛选下拉列表 + const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers; + const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups; + return( + + {modalVisible===true?:""} +
this.props.modalCloss()}> + +
+ +
+ 评阅分配方式: + + + 手动分配评阅(逐一指定每个学生的交叉评阅老师) + 答辩组分配评阅(将老师加入不同答辩组,指定每个学生的交叉评阅答辩组, + + 立即设置答辩组 + + + +
+
+ 已选 { chooseCount == 0 ? 0 : {chooseCount}} 个 + + 分配给{ comment_status && comment_status == 2 ? "老师":"答辩组"}: + + +
:""} + {comment_status != 2 &&course_groups&&course_groups.length>10?
+ +
:""} + {comment_status == 2 &&teacherList&&teacherList.length>2? this.checkonChange(e,teacherList)}>全选:""} + {comment_status != 2 &&course_groupsList&&course_groupsList.length>2? this.checkonChange(e,course_groupsList)}>全选:""} + {menu} + +
+ 提交 + 重置 +
+
+ )} + > + { comment_status == 2 ? + teacherList && teacherList.map((i,key)=>{ + return + }): + course_groupsList && course_groupsList.map((i,key)=>{ + return + }) + } + + + +
+
+
+
+ { + user_count > limit ? + :"" + } +
+ {/*
*/} + {/*关闭*/} + {/*确认*/} + {/*
*/} +
+ + ) + } +} +export default GraduationAcross; \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js index 0aff1a1bd..abd40784a 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js @@ -10,6 +10,7 @@ import HomeworkModal from "../../coursesPublic/HomeworkModal"; import AccessoryModal from "../../coursesPublic/AccessoryModal"; import Associationmodel from '../../coursesPublic/Associationmodel'; import CoursesListType from '../../coursesPublic/CoursesListType'; +import GraduationAcross from "./GraduationAcross"; import moment from 'moment'; import "../../css/members.css" import "../../css/Courses.css" @@ -58,7 +59,8 @@ class GraduationTaskDetail extends Component{ Modalstype:undefined, Modalstopval:undefined, ModalCancel:undefined, - ModalSave:undefined + ModalSave:undefined, + acrossVisible:undefined } } componentDidMount(){ @@ -80,6 +82,21 @@ class GraduationTaskDetail extends Component{ }) } + + // 交叉评阅设置弹框 + openAcross=()=>{ + this.setState({ + acrossVisible:true + }) + } + closeAcross=()=>{ + this.setState({ + acrossVisible:false + }) + } + + + //返回 goback=()=>{ // let courseId=this.props.match.params.coursesId; @@ -190,7 +207,6 @@ class GraduationTaskDetail extends Component{ } // 取消 cancelmodel=()=>{ - debugger this.setState({ Modalstype:false, Loadtype:false, @@ -291,11 +307,13 @@ class GraduationTaskDetail extends Component{ Modalstype, Modalstopval, ModalCancel, - ModalSave + ModalSave, + acrossVisible } = this.state const commom = { - setTab:this.setTab + setTab:this.setTab, + getdatas:this.getdatas } return(
@@ -353,6 +371,20 @@ class GraduationTaskDetail extends Component{ destroyOnClose={true} centered={true} /> + + { + acrossVisible && + + } +

{questionslist.course_name} > @@ -436,7 +468,7 @@ class GraduationTaskDetail extends Component{ {/*项目在线质量检测*/} { this.props.isAdmin() ? questionslist.status===1 ? { this.end()} }>立即截止 : "" : "" } { this.props.isAdmin() ? questionslist.status===0 ? { this.publish()} }>立即发布 : "" : "" } - + { this.props.isAdmin() && questionslist.cross_comment ? 交叉评阅设置 : "" } { this.props.isAdmin() ? 编辑任务 : "" }

diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js index 9222d3af2..5494ba05f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js @@ -209,7 +209,7 @@ class GraduationTasksappraiseMainEditor extends Component{ `} {this.props.title && {this.props.title}} + watch={false} height={160} className={errorMessage ? 'editorInputError' : ''} imageExpand={true}> { showSameScore == true &&
整组同评 (选中,则本次评阅对象指小组全部成员,否则仅评阅此成员1人 ) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 5ca6ee537..ff7564b8f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -343,6 +343,7 @@ class GraduationTaskssettingapp extends Component{ } updatesfuncrosscomment=(types,newlatetime,newcommenttime)=>{ + debugger let {endtimetype}=this.state; if(types===1){ this.setState({ @@ -372,7 +373,7 @@ class GraduationTaskssettingapp extends Component{ funcrosscomment=(e)=>{ let {latetime,end_time,allowlate,commenttime,commenttimeone}=this.state; let commenttimetype=commenttime===null||commenttime===""; - +debugger let newlatetimea=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); let newcommenttimea=moment(new Date()).format("YYYY-MM-DD HH:mm"); @@ -386,7 +387,7 @@ class GraduationTaskssettingapp extends Component{ let newcommenttimed=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm"); if(e.target.checked===true){ - if(commenttimetype===true){ + debugger if(allowlate===1||allowlate===true){ if(latetime===null||latetime===""){ @@ -401,12 +402,6 @@ class GraduationTaskssettingapp extends Component{ this.updatesfuncrosscomment(2,newend_timed,newcommenttimed) } } - }else{ - this.setState({ - crosscomment:e.target.checked, - commenttime:commenttimeone, - }) - } }else{ this.setState({ @@ -545,25 +540,29 @@ class GraduationTaskssettingapp extends Component{ endTimetypes:false }) } - + debugger if(moment(latetime)<=moment(publish_time)){ + + debugger this.setState({ latetimetype:true, latetimetypeval:"结束时间必须晚于发布时间" }) return }else if(moment(latetime)<=moment(end_time)){ + debugger this.setState({ latetimetype:true, latetimetypeval:"结束时间必须晚于截止时间" }) return }else{ + debugger this.setState({ latetimetype:false }) } - + debugger if(crosscomment===true){ if(this.state.commenttime===undefined||this.state.commenttime===null||this.state.commenttime===""){ @@ -726,7 +725,9 @@ class GraduationTaskssettingapp extends Component{ starttime:undefined, course_groupslist:[], }) - this.props.showNotification(resulet.data.message); + this.props.showNotification(resulet.data.message); + //调用父组件方法,刷新按钮 + this.props.getdatas(); } } }).catch((error)=>{ @@ -948,9 +949,7 @@ class GraduationTaskssettingapp extends Component{ // // console.log(moment(publish_time)) - // console.log(this.props.isSuperAdmin()) - - + console.log(commenttime) return( @@ -1206,7 +1205,7 @@ class GraduationTaskssettingapp extends Component{ {crosscomment===true&&commenttimetype===true?
{commenttimevalue}
:""}
-
+ {/*
评阅方式: @@ -1221,10 +1220,10 @@ class GraduationTaskssettingapp extends Component{ -
+
*/} -
+ {/*
评阅数: @@ -1261,7 +1260,7 @@ class GraduationTaskssettingapp extends Component{ ) })} -
+
*/}
:""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 0720d7240..30dd831bd 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -847,28 +847,28 @@ class GraduationTaskssettinglist extends Component{ ), - }, { + }, { title: '操作', key: 'operation', width:'100px', dataIndex: 'operation', className:'edu-txt-center', render: operation => ( -
+
{this.props.isAdmin()?operation.map((tag,key) => { return( { tag.name && - 调整学生最终成绩
其它历史评分将全部失效:""}> - {tag.name==="评阅"? + 调整学生最终成绩
其它历史评分将全部失效:""}> + {tag.name==="评阅"?

{tag.name} - +

: - this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}> - {tag.name} - +

this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":()=>this.showAllocationModal(tag.id):""}> + {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":tag.name:tag.name} +

}
} @@ -971,9 +971,8 @@ class GraduationTaskssettinglist extends Component{ white-space: nowrap; } .ant-table-tbody>tr>td, .ant-table-thead>tr>th{ - padding: 16px 10px + padding:16px 8px; } - ` } diff --git a/public/react/src/modules/courses/members/modal/AddStudentModal.js b/public/react/src/modules/courses/members/modal/AddStudentModal.js index ddd1164ea..efa801182 100644 --- a/public/react/src/modules/courses/members/modal/AddStudentModal.js +++ b/public/react/src/modules/courses/members/modal/AddStudentModal.js @@ -68,7 +68,7 @@ class AddStudentModal extends Component{ if (response.data.course_groups && response.data.course_groups.length) { this.setState({ course_groups: response.data.course_groups, - courseGroup: response.data.course_groups[0].id + courseGroup: '0' // response.data.course_groups[0].id }) } else { // showNotification('') @@ -268,6 +268,7 @@ class AddStudentModal extends Component{ {course_groups && course_groups.length &&
所选学生分班至(选填):