You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js

1386 lines
46 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd";
import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn,getUrl ,handleDateString} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import CoursesListType from '../../coursesPublic/CoursesListType';
import PublishModals from "../../coursesPublic/PublishModals";
import HomeworkModal from "../../coursesPublic/HomeworkModal";
import moment from 'moment';
const { Option} = Select;
const CheckboxGroup = Checkbox.Group;
const confirm = Modal.confirm;
let GraduationTasksnewtype=true;
// const $ = window.$;
const Search = Input.Search;
const RadioGroup = Radio.Group;
function range(start, end) {
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
function disabledDateTime() {
return {
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
};
}
class GraduationTaskssettingapp extends Component{
constructor(props){
super(props)
this.state={
coursename:"",
coursesearch:"",
title_num:20,
title_value:"",
fileList: [],
contents: [{val:"",id:1}],
type:true,
taskname:"",
taskid:"",
settingdata:undefined,
baseonproject:false,
minnum:2,
maxnum:5,
publish_time:null,
end_time:null,
allowlate:1,
latepenalty:undefined,
latetime:null,
crosscomment:undefined,
commentstatus:1,
commentnum:0,
opergrade:false,
operworks:false,
commenttime:undefined,
graduationgroups:[],
assigngroups:[],
selecassigngroups:[],
hasproject:false,
hascommit:false,
minnums:0,
max_nums:0,
minnumstype:false,
maxnumstype:false,
edittype:false,
task_type:false,
starttimetype:false,
endtimetype:false,
flagPageEdit:false,
visible:false,
starttime:undefined
}
}
getsettings=()=>{
let task_Id=this.props.match.params.task_Id;
let url ="/graduation_tasks/"+task_Id+"/settings.json"
axios.get(url).then((result)=> {
if(result.status===200){
let assigngroups = []
for (var list of result.data.graduation_groups) {
assigngroups.push({
assign_group_id: list.assign_group_id,
select_name: list.select_name,
})
}
let starttype=false;
let endtype=false;
if(moment(result.data.publish_time)<moment()){
starttype=true
}
if(moment(result.data.end_time)<moment()){
endtype=true
}
this.setState({
starttimetype:starttype,
endtimetype:endtype,
settingdata: result.data,
minnum: result.data.min_num,
minnums: result.data.min_num,
maxnum: result.data.max_num,
max_nums: result.data.max_num,
task_type: result.data.task_type,
baseonproject: result.data.base_on_project,
publish_time:result.data.publish_time===null?"":moment(moment(handleDateString(result.data.publish_time))).format("YYYY-MM-DD HH:mm"),
end_time:result.data.end_time===null?"":moment(moment(handleDateString(result.data.end_time))).format("YYYY-MM-DD HH:mm"),
allowlate: result.data.allow_late,
latepenalty: result.data.late_penalty,
latetime:result.data.late_time===null?"":moment(moment(handleDateString(result.data.late_time))).format("YYYY-MM-DD HH:mm"),
crosscomment: result.data.cross_comment,
taskid: result.data.id,
taskname: result.data.task_name,
coursename: result.data.course_name,
commentstatus: result.data.comment_status,
commentnum: result.data.comment_num,
operworks: result.data.open_work,
opergrade: result.data.open_score,
graduationgroups: result.data.graduation_groups,
hasproject: result.data.has_project,
hascommit: result.data.has_commit,
assigngroups: assigngroups,
commenttime:result.data.comment_time===null?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"),
task_status: result.data.task_status
})
}
}).catch((error)=>{
console.log(error)
})
}
componentDidMount(){
let query=this.props.location.search
const type = query.split('?tab=');
let id=parseInt(type[1])
this.getsettings();
if(this.props.isAdmin()===true&&isNaN(id)){
this.editSetting()
}
}
baseprojectfun=(e)=>{
this.setState({
baseonproject:e.target.checked
})
}
setminnum=(e)=>{
if(isNaN(parseInt(e.target.value))){
this.setState({
minnum:""
})
}else if(parseInt(e.target.value)===0) {
this.setState({
minnum:1
})
}else{
this.setState({
minnum:parseInt(e.target.value)
})
}
}
setmaxnum=(e)=>{
let {minnum}=this.state;
if(isNaN(parseInt(e.target.value))){
this.setState({
maxnum:""
})
}else if(parseInt(e.target.value)===0) {
this.setState({
maxnum:parseInt(minnum)+1
})
}else{
if(parseInt(e.target.value)<=parseInt(minnum)){
this.setState({
maxnum:minnum+1
})
}else{
this.setState({
maxnum:parseInt(e.target.value)
})
}
}
}
onChangeTimepublish= (date, dateString) => {
let endtime;
if(date===null){
this.setState({
publish_time:null,
end_time:null,
latetime:null
})
}else{
endtime= moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm")
let {allowlate}=this.state;
if(allowlate===true||allowlate===1){
this.setState({
publish_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"),
end_time:endtime,
latetime:moment(moment(handleDateString(endtime))).add(1, 'months').format("YYYY-MM-DD HH:mm"),
})
}else{
this.setState({
publish_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"),
end_time:endtime
})
}
}
}
onChangeTimeend= (date, dateString) => {
if(date===null){
this.setState({
end_time:null,
latetime:null
})
}else{
let {allowlate}=this.state;
if(allowlate===true||allowlate===1){
this.setState({
end_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"),
latetime:moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm"),
})
}else{
this.setState({
end_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"),
})
}
}
}
onChangeTimelatetime=(date, dateString)=>{
let {end_time}=this.state;
if(moment(dateString)>moment(end_time)){
this.setState({
latetimetype:false
})
}
this.setState({
latetime:handleDateString(dateString)
})
}
onChangeTimecommenttime=(date, dateString)=>{
let{end_time}=this.state;
if(moment(dateString)>moment(end_time)){
this.setState({
commenttimetype:false,
})
}
this.setState({
commenttime:handleDateString(dateString)
})
}
allowlatefun=(e)=>{
let {end_time}=this.state;
if(e.target.value===true||e.target.value===1){
this.setState({
latepenalty:5,
allowlate:e.target.value,
latetime:end_time===null?"":moment(moment(handleDateString(end_time))).add(1, 'months').format("YYYY-MM-DD HH:mm"),
})
}else{
this.setState({
latepenalty:0,
allowlate:e.target.value,
latetime:""
})
}
}
funlatepenalty=(e)=>{
let value= parseInt(e.target.value);
if(isNaN(value)){
value=0
}
this.setState({
latepenalty:value
})
}
funcrosscomment=(e)=>{
let {latetime,end_time,allowlate}=this.state;
let newtime;
if(e.target.checked===true){
if(allowlate===1||allowlate===true){
if(latetime===null||latetime===""){
let newlatetime=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(new Date()).format("YYYY-MM-DD HH:mm");
this.setState({
latetime:newlatetime,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
}else{
let newlatetime=moment(latetime).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(latetime).format("YYYY-MM-DD HH:mm");
this.setState({
latetime:newlatetime,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
}
}else{
if(end_time===null||end_time===""){
let newend_time=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(new Date()).add(8, 'days').format("YYYY-MM-DD HH:mm");
this.setState({
end_time:newend_time,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
}else{
let newend_time=moment(end_time).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm");
this.setState({
end_time:newend_time,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
}
}
}else{
this.setState({
crosscomment:e.target.checked,
commenttime:undefined
})
}
}
funcommentstatus=(e)=>{
this.setState({
commentstatus:parseInt(e.target.value)
})
}
funcoperworks=(e)=>{
this.setState({
operworks:e.target.checked
})
}
funcopergrade=(e)=>{
this.setState({
opergrade:e.target.checked
})
}
//立即发布
publish=()=>{
let starttime= this.props.getNowFormatDates(1,1);
let endtime=this.props.getNowFormatDates(2,1);
// this.homeworkstart()
this.setState({
modalname:"立即发布",
visibles:true,
Topval:"学生将立即收到毕设任务",
// Botvalleft:"点击修改",
Botval:`本操作只对"未发布"的分班有效`,
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
starttimes:this.props.getNowFormatDates(1),
typs:"start",
endtime:endtime,
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.cancelmodel,
Saves:this.homepublish,
})
}
//立即发布
homeworkstart=()=>{
let coursesId=this.props.match.params.coursesId;
let url="/courses/"+coursesId+"/all_course_groups.json";
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
course_groups:response.data.course_groups,
})
}
}).catch((error) => {
console.log(error)
});
}
homepublish=(ids,endtime)=>{
let task_Id=this.props.match.params.task_Id;
const cid = this.props.match.params.coursesId
// let url = `/courses/${cid}/graduation_tasks/publish_task.json`;
let url="/courses/"+cid+"/graduation_tasks/publish_task.json"
axios.post(url,{
task_ids:[task_Id],
group_ids: this.state.course_groupslist,
end_time:endtime,
}).then((response)=>{
if (response.data.status == 0) {
this.getsettings();
this.cancelmodel();
this.setState({
// Modalstype:true,
// Modalstopval:resulet.data.message,
// ModalSave:this.cancelmodel,
// Loadtype:true
starttime:undefined,
course_groupslist:[],
})
this.props.showNotification(response.data.message);
}
}).catch((error)=>{
})
}
//跳转道描点的地方
scrollToAnchor = (anchorName) => {
if (anchorName) {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView(); }
}
}
saveTaskssetting=()=>{
let {latepenalty,hascommit,minnums,max_nums,publish_time,end_time,crosscomment,latetime,starttimetype}=this.state;
if(isNaN(parseInt(this.state.minnum))){
this.setState({
numtype:true
})
this.scrollToAnchor("publishtimestart");
return
}else{
this.setState({
numtype:false
})
}
if(isNaN(parseInt(this.state.maxnum))){
this.setState({
numtype:true
})
this.scrollToAnchor("publishtimestart");
return
}else{
this.setState({
numtype:false
})
}
if(latepenalty===undefined){
this.setState({
latepenaltytype:true,
latepenaltyvalue:"不能为空"
})
return
}else if(latepenalty===""){
this.setState({
latepenaltytype:true,
latepenaltyvalue:"不能为空"
})
return
}else{
this.setState({
latepenaltytype:false
})
}
if(starttimetype===false) {
if (moment(publish_time) <= moment()) {
this.setState({
publishTimetypes: true,
publishTimetypesval: "发布时间不能早于当前时间",
})
return
} else {
this.setState({
publishTimetypes: false
})
}
}
if(moment(end_time)<moment(publish_time)){
this.setState({
endTimetypes:true,
endTimetypesval:"截止时间不能早于发布时间"
})
return
}else{
this.setState({
endTimetypes:false
})
}
if(moment(latetime)<moment(publish_time)){
this.setState({
latetimetype:true,
latetimetypeval:"结束时间不能早于发布时间"
})
return
}else if(moment(latetime)<moment(end_time)){
this.setState({
latetimetype:true,
latetimetypeval:"结束时间不能早于截止时间"
})
return
}else{
this.setState({
latetimetype:false
})
}
if(crosscomment===true){
if(this.state.commenttime===undefined||this.state.commenttime===null||this.state.commenttime===""){
this.setState({
commenttimetype:true,
commenttimevalue:"不能为空",
})
return
}else{
this.setState({
commenttimetype:false
})
}
if(moment(this.state.commenttime)<moment(publish_time)){
this.setState({
commenttimetype:true,
commenttimevalue:"开始时间不能小于发布时间",
})
return
}else{
this.setState({
commenttimetype:false
})
}
if(moment(this.state.commenttime)<moment(end_time)){
this.setState({
commenttimetype:true,
commenttimevalue:"开始时间不能小于截止时间",
})
return
}else{
this.setState({
commenttimetype:false
})
}
}
if(starttimetype===false){
if(publish_time===null||publish_time=== ""){
this.setState({
publishTimetypes:true,
publishTimetypesval:"发布时间不能为空",
})
this.scrollToAnchor("publishtimestart");
return
}
}
if(end_time===null||end_time=== ""){
this.setState({
endTimetypes:true,
endTimetypesval:"截止时间不能为空"
})
this.scrollToAnchor("publishtimeend");
return
}
if(this.props.isAdmin()) {
this.setState({
edittype: true
})
if (hascommit === true) {
if (parseInt(this.state.minnum) > parseInt(minnums)) {
this.setState({
minnumstype: true
})
return
}else{
this.setState({
minnumstype:false
})
}
if (parseInt(this.state.maxnum) < parseInt(max_nums)) {
this.setState({
maxnumstype: true
})
return
}else{
this.setState({
maxnumstype:false
})
}
}
if (this.state.end_time === "" || this.state.end_time === null) {
this.setState({
end_timetype: true
})
return
}else{
this.setState({
end_timetype:false
})
}
if(publish_time!=null){
this.sethomepublish();
}
}
}
sethomepublish=()=>{
let {assigngroups,starttime}=this.state;
let assigngroupslist=[];
for(var list of assigngroups){
assigngroupslist.push(list.assign_group_id)
}
let {allowlate,baseonproject,crosscomment,opergrade,operworks,commentstatus,latepenalty,end_time,latetime}=this.state;
let task_Id=this.props.match.params.task_Id;
let url="/graduation_tasks/"+task_Id+"/update_settings.json";
axios.post(url,{
min_num: this.state.minnum,
max_num: this.state.maxnum,
base_on_project:baseonproject===true?1:0,
publish_time:this.state.publish_time===null?"":this.state.publish_time,
end_time: this.state.end_time===null?this.props.getNowFormatDates(2,1):this.state.end_time,
allow_late:allowlate===true||allowlate===1?1:undefined,
late_time: this.state.latetime===null?this.props.getNowFormatDates(3,1):this.state.latetime,
late_penalty: latepenalty,
cross_comment: crosscomment===true?1:undefined,
comment_status: crosscomment===true?this.state.commentstatus===0?2:this.state.commentstatus===1?2:this.state.commentstatus:undefined,
comment_num: commentstatus===4?this.state.commentnum:undefined,
comment_time: crosscomment===true?this.state.commenttime:undefined,
comment_group: commentstatus===4?assigngroupslist:undefined,
open_work: opergrade===true?1:undefined,
open_score: operworks===true?1:undefined,
group_ids:this.state.course_groupslist
}).then((resulet)=>{
if(resulet.status===200){
if(resulet.data.status===0){
this.getsettings();
this.cancelmodel();
this.isgoback()
this.setState({
// Modalstype:true,
// Modalstopval:resulet.data.message,
// ModalSave:this.cancelmodel,
// Loadtype:true
starttime:undefined,
course_groupslist:[],
})
this.props.showNotification(resulet.data.message);
}
}
}).catch((error)=>{
console.log(error)
})
}
selectassigngroups=(e,index)=>{
let {assigngroups}=this.state;
let newassigngroups=assigngroups;
for(var i=0; i<newassigngroups.length; i++){
if(i===parseInt(index.key)){
newassigngroups[i].assign_group_id=index.props.id;
newassigngroups[i].select_name=index.props.value;
}
}
//
// console.log(assigngroups)
// console.log(newassigngroups)
// assigngroups.push({
// assign_group_id:list.assign_group_id,
// select_name:list.select_name,
// })
this.setState({
assigngroups:newassigngroups,
})
}
goback=()=>{
let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id;
window.location.href="/courses/"+courseId+"/graduation_tasks/"+category_id;
}
isgoback=()=>{
this.setState({
flagPageEdit: false,
})
}
end=()=>{
this.setState({
modalname:"立即截止",
visibles:true,
Topval:"学生将不能再提交作品",
// Botvalleft:"暂不截止",
Botval:`本操作只对"提交中"的分班有效`,
Cancelname:"暂不截止",
Savesname:"立即截止",
Cancel:this.cancelmodel,
Saves:this.coursetaskend,
typs:"end",
})
// this.homeworkstart()
}
cancelmodel=()=>{
this.setState({
Modalstype:false,
Loadtype:false,
visible:false,
visibles:false,
Modalstopval:"",
ModalCancel:"",
ModalSave:"",
starttime:undefined
})
}
coursetaskend=()=>{
const coursesId = this.props.match.params.coursesId;
const task_Id = this.props.match.params.task_Id;
let url = `/courses/${coursesId}/graduation_tasks/end_task.json`;
axios.post(url,{
task_ids:[task_Id],
group_ids:this.state.course_groupslist
}).then((response)=>{
if (response.data.status == 0) {
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.cancelmodel,
// Loadtype:true,
// checkBoxValues:[],
// checkAllValue:false
// })
this.getsettings();
this.props.showNotification(response.data.message);
this.cancelmodel();
this.setState({
course_groupslist:[],
// Modalstopval:resulet.data.message,
// ModalSave:this.cancelmodel,
// Loadtype:true
})
}
}).catch((error)=>{
})
}
setcommentnum=(e)=>{
this.setState({
commentnum:parseInt(e.target.value)
})
}
scrollToAnchor = (anchorName) => {
if (anchorName) {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); }
}
}
skipTop=()=>{
this.scrollToAnchor("starttime")
this.cancelmodel()
}
getcourse_groupslist=(id)=>{
this.setState({
course_groupslist:id
})
}
//编辑
editSetting = () => {
if (this.state.settingdata&&this.state.settingdata.is_end === true) {
// this.setState({
// modalsType: true,
// modalsTopval: "课堂已结束不能再修改!",
// loadtype: true,
// modalSave: this.cancelBox
// })
this.props.showNotification("课堂已结束不能再修改!");
} else {
this.setState({
flagPageEdit: true,
})
}
}
render(){
const { getFieldDecorator } = this.props.form;
const dateFormat = 'YYYY-MM-DD HH:mm';
let {coursename,taskname,settingdata,baseonproject,Modalstype,Modalstopval,operworks,opergrade,graduationgroups,Loadtype,task_type,end_timetype,
ModalCancel,ModalSave,publish_time,end_time,allowlate,latepenalty,latetime,crosscomment,commentstatus,commentnum,commenttime,numtype,
minnum,maxnum,modalname,task_status,
visible,
Topval,
Topvalright,
Botvalleft,
Botval,
starttime,
endtime,
Cancelname,
Savesname,
Cancel,
Saves,
course_groups,hasproject,hascommit,minnumstype,maxnumstype,
latepenaltytype,
latepenaltyvalue,
latetimetype,
starttimetype,
endtimetype,
commenttimetype,
commenttimevalue,
flagPageEdit
} =this.state;
let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id;
let task_Id=this.props.match.params.task_Id;
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
};
//
// console.log(moment(publish_time))
// console.log(this.props.isSuperAdmin())
return(
<React.Fragment>
{settingdata&&settingdata? <div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype={Loadtype}
/>
{/*/!*立即发布*!/*/}
{/*<PublishModals*/}
{/*modalname={modalname}*/}
{/*visible={visible}*/}
{/*Topval={Topval}*/}
{/*Topvalright={Topvalright}*/}
{/*Botvalleft={Botvalleft}*/}
{/*Botval={Botval}*/}
{/*starttime={starttime}*/}
{/*endtime={endtime}*/}
{/*Cancelname={Cancelname}*/}
{/*Savesname={Savesname}*/}
{/*Cancel={Cancel}*/}
{/*Saves={Saves}*/}
{/*course_groups={course_groups}*/}
{/*skipTop={this.skipTop}*/}
{/*/>*/}
<HomeworkModal
starttimes={this.state.starttimes}
typs={this.state.typs}
modalname={modalname}
visible={this.state.visibles}
Topval={Topval}
Topvalright={Topvalright}
Botvalleft={Botvalleft}
Botval={Botval}
starttime={starttime}
endtime={endtime}
Cancelname={Cancelname}
Savesname={Savesname}
Cancel={Cancel}
Saves={Saves}
course_groups={course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
<style>
{`
.ant-input{
height:40px;
}
.linbox{
height: 26px;
}
`
}</style>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<Link to={"/courses/"+courseId+"/students"} className="color-grey-9 fl">{coursename}</Link>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<Link to={"/courses/"+courseId+"/graduation_tasks/"+settingdata.graduation_id} className="color-grey-9 fl">毕设任务</Link>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
{/*{taskname===""?"":*/}
{/*<WordsBtn style="grey" className="fl">*/}
{/*<Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"} className="color-grey-6">{taskname}</Link>*/}
{/*<span className="color-grey-c ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
{/*}*/}
<span className="color-grey-6">任务详情</span>
</p>
<div className="clearfix mt20 mb20 lineh-25 linbox">
<p className=" fl color-black lineh-25 summaryname">
<Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"} className="color-grey-3">{taskname}</Link>
</p>
<CoursesListType
typelist={task_status}
/>
<a className="color-grey-3 fr font-16 ml30 mr20" onClick={this.goback}>返回</a>
</div>
<div className="stud-class-set bor-bottom-greyE" id={"publishtimestart"}>
<div className="mt10 clearfix edu-back-white poll_list pl20" id={"publishtimeend"}>
<Link to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/list"}>任务列表</Link>
<Link to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/questions"}>任务问答</Link>
<Link className="active"
style={{paddingLeft:'38px'}}
to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting?tab=3"}>设置</Link>
{/*<a className={"fr color-blue font-16"}>导出</a>*/}
<style>
{ `
.drop_down_menu{
height: 118px;
left:0px;
width: 121px;
}
.drop_down_menu li {
overflow: visible;
width: 121px;
}
.drop_down_menu li a{
padding: 0px;
font-size: 14px;
}
.mt19{
margin-top:19px;
}
.drop_down_menu, .drop_down_normal{
padding-top: 10px;
padding-bottom: 8px;
}
`}
</style>
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr20 mt20" style={{"paddingLeft":"0px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.xlsx"} calssName="color-dark">导出成绩</a></li>
<li><a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.zip"} calssName="color-dark">导出作品附件</a></li>
</ul>
</li>:""}
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.xls"} className={"fr color-blue font-16"}>导出成绩</a>:""}*/}
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.zip"} className={"fr color-blue font-16"}>导出作品附件</a>:""}*/}
{/*<a className={"fr color-blue font-16"}>项目在线质量检测</a>*/}
{this.props.isAdmin()?settingdata.status===1?<a className={"fr color-blue font-16 mr20"} onClick={() => { this.end()} }>立即截止</a>:"":""}
{this.props.isAdmin()?settingdata.status===0?<a className={"fr color-blue font-16 mr20"} onClick={() => { this.publish()} }>立即发布</a>:"":""}
{this.props.isAdmin()?<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+task_Id+"/edit"}>编辑任务</a>:""}
</div>
</div>
<Form labelCol={{ span: 5 }} wrapperCol={{ span: 12 }} id={"starttime"}>
{
!flagPageEdit && this.props.isAdmin() === true ?
<a className="fr mt20 mr40" onClick={this.editSetting}><Tooltip title="编辑"><i
className="iconfont icon-bianjidaibeijing font-20 color-green "></i></Tooltip></a>
: ""
}
{/*内容*/}
{task_type===2?<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white pl30" >
<div className={"xingrequired font-16 color-dark h20 mb20"}>分组设置 <span className={"font-14 color-grey-c"}>提交作品时需要关联同组成员组内成员作品共享</span></div>
<div className={"mb30 h20 ml40"}>
<Input className={numtype===true?"noticeTip mr20":"mr20"} style={{ width:"100px" }} value={minnum} onInput={this.setminnum} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}/>
<span className="mr20">~</span>
<Input className={numtype===true?"noticeTip mr20":"mr20"} style={{width:"100px" }} value={maxnum} onInput={this.setmaxnum} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}/>
<span className="mr10"></span>
<span className={"font-14 color-grey-c"}>学生提交作品时需要关联同组成员组内成员作品共享</span>
</div>
{minnumstype===true?<div className={"color-red ml40"}>已有提交作品最小人数不能变大</div>:""}
{maxnumstype===true?<div className={"color-red ml40"}>已有提交作品最大人数不能变小</div>:""}
{numtype===true?<div className={"color-red ml40"}>不能为空</div>:""}
<div>
<Tooltip placement="bottom" title={hascommit===true?"已有关联项目或作品,不能修改":""}>
<Checkbox className="ml40 " checked={baseonproject} disabled={this.props.isAdmin()===true?hascommit===true||hasproject===true?true:flagPageEdit===true?false:true:true} onChange={this.baseprojectfun}>基于项目实施</Checkbox>
</Tooltip>
<span className={"font-14 color-grey-c"}>选中则必须在本平台创建项目项目管理员可以提交作品不选中无需在平台创建项目任意小组成员均可以提交作品</span>
</div>
</div>:""}
<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white pl36" >
<div className={" font-16 color-dark h20 mb20"} >发布设置 </div>
<div className={"h20 mb30 ml30"} >
<span>发布时间</span>
<Tooltip placement="bottom" title={this.props.isAdmin()===true?starttimetype===true?"时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
format={dateFormat}
placeholder="请选择发布时间"
id={"startime"}
width={"210px"}
value={publish_time===null||publish_time===""?"":moment(publish_time, dateFormat)}
onChange={this.onChangeTimepublish}
disabledTime={disabledDateTime}
disabled={this.props.isAdmin()===true?starttimetype===true?true:flagPageEdit===true?false:true:true}
className={ this.state.publishTimetypes===true?"noticeTip":""}
/>
</span>
</Tooltip>
<span className={"font-14 color-grey-c ml10"}>学生收到作业的时间</span>
</div>
<style>
{
`
.ml102{
margin-left: 102px;
}
`
}
</style>
{this.state.publishTimetypes===true?<div className={"color-red ml102"}>
{this.state.publishTimetypesval}
</div>:""}
<div className={"h20 mb30 ml30"} >
<span>截止时间</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()===true?"":this.props.isAdmin()===true?endtimetype===true?"时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
format={dateFormat}
placeholder="请选择截止时间"
id={"endTime"}
width={"210px"}
value={end_time===null||end_time===""?"":moment(end_time, dateFormat)}
onChange={this.onChangeTimeend}
disabledTime={disabledDateTime}
disabled={this.props.isSuperAdmin()===true?flagPageEdit===true?false:true:this.props.isAdmin()===true?endtimetype===true?true:flagPageEdit===true?false:true:true}
className={this.state.endTimetypes===true||end_timetype===true?"noticeTip":""}
/>
</span>
</Tooltip>
<span className={"font-14 color-grey-c ml10"}>学生按时提交作品的时间截点</span>
</div>
<style>
{
`
.ml102{
margin-left: 102px;
}
`
}
</style>
{this.state.endTimetypes===true?<div className={"color-red ml102"}>{this.state.endTimetypesval}
</div>:""}
{end_timetype===true?<div className={"color-red ml40"}>不能为空</div>:""}
</div>
<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white pl36">
<div className={" font-16 color-dark h20 mb20"}>补交设置 </div>
<RadioGroup onChange={this.allowlatefun} value={allowlate===true||allowlate===1?1:2} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}>
<Radio style={radioStyle} value={1}>开启补交<span className={"font-14 color-grey-c "}>选中则允许学生延时提交作品</span></Radio>
<div className={"h21 mb30 ml30 mt20"}>
<span>迟交扣分</span>
<Input className="mr10" style={{width:"100px" }} value={latepenalty} disabled={this.props.isAdmin()===true?allowlate===true||allowlate===1?flagPageEdit===true?false:true:true:true} onInput={this.funlatepenalty}/>
<span className={"font-14 color-grey-c "}>延时提交作品时学生成绩将被扣减的分值</span>
{latepenaltytype===true?<div className={"color-red ml40"}>{latepenaltyvalue}</div>:""}
</div>
<div className={"h20 mb30 ml30"}>
<span>结束时间</span>
<DatePicker
showToday={false}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
format={dateFormat}
placeholder="请选择结束时间"
id={"enTime"}
width={"210px"}
value={latetime===null||latetime===""?"":moment(latetime, dateFormat)}
disabledTime={disabledDateTime}
onChange={this.onChangeTimelatetime}
disabled={this.props.isAdmin()===true?allowlate===true||allowlate===1?flagPageEdit===true?false:true:true:true}
className={ latetimetype===true?"noticeTip":""}
/>
<span className={"font-14 color-grey-c ml10"}>学生延时提交作品的时间截点</span>
<style>
{
`
.ml70{
margin-left: 71px;
}
`
}
</style>
{latetimetype===true?<div className={"color-red ml70"}>{this.state.latetimetypeval}</div>:""}
</div>
<Radio style={radioStyle} value={2}>禁止补交</Radio>
</RadioGroup>
</div>
{/*<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white pl36">*/}
{/*<div className={" font-16 color-dark h20 mb20"}>项目质量检测 </div>*/}
{/*</div>*/}
<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white pl36">
<div className={" font-16 color-dark h20 mb20"}>评分设置 </div>
<div className={"font-16 h20 mb20"}>最终成绩组成 <span className={"font-14 color-grey-c"}>取各教师最终评分的平均分</span></div>
<Checkbox className="ml40 font-16" checked={crosscomment} onChange={this.funcrosscomment} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true} >启用交叉评阅 <span className={"font-14 color-grey-c"}>给老师分配其他指导老师的学生作品</span>
</Checkbox>
{crosscomment===true?<div>
<div className={"h20 mb30 ml30 mt20 ml87"}>
<span>开始时间</span>
<DatePicker
showToday={false}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}
format={dateFormat}
placeholder="请选择发布时间"
id={"endTime"}
width={"210px"}
value={commenttime===null||commenttime===""?"":moment(commenttime, dateFormat)}
disabledTime={disabledDateTime}
onChange={this.onChangeTimecommenttime}
disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}
className={ commenttimetype===true?"noticeTip":""}
/>
<span className={"font-14 color-grey-c ml10"}>交叉评阅开始时间之前提交的作品参与交叉评阅</span>
<style>
{
`
.ml70{
margin-left:70px;
}
`
}
</style>
{crosscomment===true&&commenttimetype===true?<div className={"color-red ml70"}>{commenttimevalue}</div>:""}
</div>
<div className={"mb20 ml30 ml87 ml87"}>
<span className={"fl mt6"}>评阅方式</span>
<span>
<RadioGroup onChange={this.funcommentstatus} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true} value={crosscomment===false?undefined:commentstatus===0?2:commentstatus===2?2:commentstatus===4?4:undefined}>
<Radio style={radioStyle} value={2}>指导老师手动分配 <span className={"font-14 color-grey-c ml10"}>由指导老师在作品列表中手动选择每个作品被分配的评阅老师</span></Radio>
<Radio style={radioStyle} value={4}>答辩组间老师互评 <span className={"font-14 color-grey-c ml10"}>由系统按照设置在答辩组之间自动分配:
<a href={"/courses/"+courseId+"/teachers"} target="_blank">
<span className={"color-blue"}>答辩组设置</span></a>
</span></Radio>
</RadioGroup>
</span>
</div>
<div style={{display:crosscomment===false?"none":commentstatus===0?"none":commentstatus===2?"none":commentstatus===4?"":"none"}}>
<div className={"h20 mb30 ml30 ml87"}>
<span>评阅数</span>
<Input className="mr20" style={{width:"200px" }} value={commentnum} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true} onInput={this.setcommentnum} />
<span className={"font-14 color-grey-c "}>单个作品将被分配互评的次数</span>
</div>
{graduationgroups.map((item,key)=>{
return(
<div className={"clearfix"} key={key}>
<div className={"h20 mb30 ml30 ml87 fl mt20"} style={{width:'140px'}}>
<span id={item.group_id} key={key}>{item.group_name}{item.member_count} 个教师</span>
</div>
<div className={"h20 mb30 fl mt20"} style={{width:'10px'}}>
<Icon className={" mr10"} type="arrow-right" key={key}/>
</div>
<div className={"h20 mb30 fl ml25 mt14"} style={{width:'100px'}}>
<Select style={{ width: 120 }}
defaultValue={item.select_name}
disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}
onChange={(e,index)=>this.selectassigngroups(e,index)}>
{graduationgroups.map((list,index)=>{
if(index!=key){
return(
<Option value={list.group_name} id={list.group_id} name={list.member_count} key={key}>{list.group_name}</Option>
)
}
})}
</Select>
</div>
</div>
)
})}
</div>
</div>:""}
<div className={"both"}></div>
</div>
{/*open_score: true*/}
{/*open_work: true*/}
<div className="stud-class-set pd20 edu-back-white pl36">
<div className={" font-16 color-dark h20 mb20"}>公开设置 </div>
<div className={"mb20"}>
<Checkbox className="ml40" checked={operworks} onChange={this.funcoperworks} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}>公开作品</Checkbox>
<span className={"font-14 color-grey-c"}>选中则在作业截止/补交结束时间之后已提交作品的学生可以查看其它学生的作品否则只能查看自己的作品</span>
</div>
<div>
<Checkbox className="ml40" checked={opergrade} onChange={this.funcopergrade} disabled={this.props.isAdmin()===true?flagPageEdit===true?false:true:true}>公开成绩</Checkbox>
<span className={"font-14 color-grey-c"}>选中则在作业截止/补交结束时间之后已提交作品的学生可以查看其它学生的成绩否则只能查看自己的成绩</span>
</div>
</div>
</Form>
{this.props.isAdmin()===true?flagPageEdit===true?<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20"
onClick={this.saveTaskssetting}
>提交</Button>
{/*<Link to={"/courses/"+courseId+"/graduation_tasks/"+position+"/"+category_id+coursesearch} className="defalutCancelbtn fl">取消</Link>*/}
<a onClick={this.isgoback} className="defalutCancelbtn fl">取消</a>
</div>:"":""}
</div>
</div>
</div>:""}
</React.Fragment>
)
}
}
const GraduationTaskssetting = Form.create({ name: 'coursesNew' })(GraduationTaskssettingapp);
export default GraduationTaskssetting;