import React,{ Component } from "react"; import Tooltip from 'material-ui/Tooltip'; import {Link} from 'react-router-dom'; import moment from 'moment'; import CoursesListType from '../coursesPublic/CoursesListType'; import { WordsBtn,formatDuring } from 'educoder'; import '../css/members.css'; import '../css/busyWork.css'; const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} const dataformat="YYYY-MM-DD HH:mm"; class PollListItem extends Component{ constructor(props){ super(props); } render(){ let{item,checkBox,courseType,index}=this.props; let {coursesId}=this.props.match.params; const IsAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); const isNotMember = this.props.isNotMember(); const isAdminOrStudent = this.props.isAdminOrStudent(); let t= item.end_time ? moment(item.end_time) - moment() : 0; let canNotLink = !isAdminOrStudent && item.lock_status == 0 return(
window.$(`.pollitem${index} input`).click() }> { IsAdmin && {checkBox} }

{ canNotLink ? {item.polls_name} : {item.polls_name} } { item.lock_status === 0 ? :"" } { isStudent && ((item.polls_status == 1 && (item.current_status ==0 ||item.current_status ==2)) || (item.polls_status==3 && item.current_status==2)) ? 未提交:"" }

{ item.polls_status !=1 && {item.poll_answer} 已答 {item.poll_unanswer} 未答 } { item.polls_status ==1 && item.publish_time ==null && item.created_at && 创建于{moment(item.created_at).fromNow()} } { item.polls_status ==1 && item.publish_time !=null && 将发布于{moment(item.publish_time).format(dataformat)} } { item.polls_status ==2 && item.publish_time !=null && {formatDuring(t)} } { isStudent ? { item.current_status == 0 && "继续答题" } { item.current_status == 1 && "查看答题" } { item.current_status == 2 && "开始答题" } :"" } { IsAdmin &&

}

) } } export default PollListItem