import React,{Component} from "React"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd"; import {Link} from 'react-router-dom'; import { WordsBtn,markdownToHTML} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; import HomeworkModal from "../../coursesPublic/HomeworkModal"; import CoursesListType from '../../coursesPublic/CoursesListType'; import moment from 'moment'; import GraduationTaskssettingReply from './GraduationTaskssettingReply'; let GraduationTasksnewtype=true; class GraduationTasksquestions extends Component{ constructor(props){ super(props) this.state={ coursename:"", coursesearch:"", title_num:20, title_value:"", fileList: [], contents: [{val:"",id:1}], type:true, questionslist:undefined } } componentDidMount(){ this.getdatas() } getdatas=()=>{ const task_Id = this.props.match.params.task_Id; let url="/graduation_tasks/"+task_Id+".json"; axios.get(url).then((result)=>{ if(result.status===200){ this.setState({ questionslist:result.data }) } }).catch((error)=>{ console.log(error) }) } 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; } end=()=>{ // this.homeworkstart() this.setState({ modalname:"立即截止", visible:true, Topval:"本操作只对“提交中”的对象生效", Botvalleft:"暂不截止", Botval:"则将根据已设置的截止时间,定时截止", Cancelname:"暂不截止", Savesname:"立即截止", Cancel:this.cancelmodel, Saves:this.coursetaskend, typs:"end", }) } //立即发布 publish=()=>{ let starttime= this.props.getNowFormatDates(1,1); let endtime=this.props.getNowFormatDates(2,1); // this.homeworkstart() this.setState({ modalname:"立即发布", visible:true, Topval:"发布设置均可修改", Botvalleft:"点击修改", Botval:"此设置将对所有分班生效", starttime:moment(new Date()).format('YYYY-MM-DD 00:00'), 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)=>{ this.cancelmodel(); 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.getdatas() this.props.showNotification(response.data.message); this.searchValue(); this.setState({ // Modalstopval:response.data.message, // ModalSave:this.cancelmodel, // Loadtype:true, course_groupslist:[], checkAllValue:false }) } }).catch((error)=>{ }) } cancelmodel=()=>{ this.setState({ Modalstype:false, Loadtype:false, visible:false, Modulationtype:false, Allocationtype:false, Modalstopval:"", ModalCancel:"", ModalSave:"", }) } coursetaskend=()=>{ this.cancelmodel(); 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.getdatas() this.props.showNotification(response.data.message); this.setState({ // Modalstopval:response.data.message, // ModalSave:this.cancelmodel, // Loadtype:true, course_groupslist:[], checkAllValue:false }) } }).catch((error)=>{ }) } getcourse_groupslist=(id)=>{ this.setState({ course_groupslist:id }) } render(){ let { Modalstype,Modalstopval,ModalCancel,ModalSave,questionslist} =this.state; // console.log(this.props) 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; //console.log(questionslist&&questionslist) return(
{/*提示*/} {/*提示*/} {/**/} this.getcourse_groupslist(id)} /> {questionslist&&questionslist?

{questionslist.course_name} > {questionslist.graduation_name} > {/**/} {/*{questionslist.task_name}*/} {/*>*/} {/**/} 任务详情

{questionslist.task_name}

返回
任务列表 任务问答 设置 {/*导出成绩*/} {/*{this.props.isAdmin()?导出成绩:""}*/} {/*{this.props.isAdmin()?导出作品附件:""}*/} {this.props.isAdmin()?
  • 导出
  • :""} {/*项目在线质量检测*/} {this.props.isAdmin()?questionslist.status===1? { this.end()} }>立即截止:"":""} {this.props.isAdmin()?questionslist.status===0? { this.publish()} }>立即发布:"":""} {this.props.isAdmin()?编辑任务:""}

    {questionslist&&questionslist?
    :"" }
    {questionslist&&questionslist.attachments.map((item,key)=>{ return(
    {item.title} {item.filesize}
    ) })}
    {questionslist&&questionslist.group_info?
    分组要求: (提交作品时需要关联同组成员,组内成员作品共享)
    分组人数:{questionslist.group_info.min_number} - {questionslist.group_info.max_number} 人 {questionslist.group_info.base_on_project===true? (基于项目,项目管理员角色的成员可以提交作品) : (非基于项目,任意小组成员可以提交作品)}
    {questionslist.group_info.base_on_project===true?
    基于项目实施 (各小组必须在educoder平台创建项目)
    :
    不基于项目实施
    }
    :""}

    {/*
    */} {/*{this.clickPraise()}}*/} {/*>*/} {/**/} {/*
    */} {/*/!*{memo.praise_count}*!/*/} {/*

    */} {/*
    */}
    {/*讨论区*/}
    :""}
    ) } } export default GraduationTasksquestions;