import React,{ Component } from "react"; import {Link} from 'react-router-dom'; import moment from 'moment'; import {Tooltip} from 'antd'; import Modals from '../../modals/Modals'; import CoursesListType from '../coursesPublic/CoursesListType'; import { formatDuring ,handleDateString} from 'educoder'; import '../css/members.css'; import '../css/busyWork.css'; import CourseLayoutcomponent from "./Exercise"; const dataformat="YYYY-MM-DD HH:mm"; const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} class ExerciseListItem extends Component{ constructor(props){ super(props); this.state={ Modalstype:false } } setgameexercise=(url)=>{ let{item}=this.props; if(item.time>0){ this.setState({ Modalstype:true, ModalSave:()=>this.props.history.push(url), Modalstopval:`答题时长限制${item.time}分钟,从首次答题开始实行不间断计时方法`, modalsBottomval:'请确认是否有充足的答题时间?', }); }else{ this.setState({ Modalstype:true, ModalSave:()=>this.props.history.push(url), Modalstopval:"是否确认开始答题?", modalsBottomval:' ', }) } } cancelmodel=()=>{ this.setState({ Modalstype:false, ModalSave:' ', Modalstopval:' ', modalsBottomval:' ', Loadtype:false }) } toDetailPage=(url)=>{ if(this.props.checkIfLogin()===false){ this.props.showLoginDialog() return } // if(this.props.checkIfProfileCompleted()===false){ // this.setState({ // AccountProfiletype:true // }) // return // } // if(this.props.checkIfProfessionalCertification()===false){ // this.props.showProfileCompleteDialog() // return // } this.props.history.push(url); } render(){ let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params const IsAdmin =this.props.isAdmin(); const IsStudent =this.props.isStudent(); // console.log(this.props.current_user.user_id) return(
{/*{item.exercise_name}*/}
{
this.props.isAdmin()? this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:""
}
{
this.props.isStudent()?
this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:""
}
{
this.props.isNotMember()? item.lock_status === 0 ?
{item.exercise_name}
: this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:""
}
{
item.lock_status === 0 ?
{ item.author && {item.author} }
{item.exercise_status===1?"":{item.exercise_answer} 已答}
{item.exercise_status===1?"":{item.exercise_unanswer} 未答}
{item.unreview_count===null||item.exercise_status===1?"":{item.unreview_count} 未评数 }
{
item.exercise_status ===1? item.publish_time ===null?
创建于{moment(item.created_at).fromNow()}
: 将发布于{
moment(item.publish_time).format('YYYY-MM-DD HH:mm')
} :""
}
{
item.exercise_status ===2?