import React,{ Component } from "react"; import {Tooltip} from 'antd'; 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); } 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,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(
{ canNotLink ?
{item.polls_name}
:
this.toDetailPage(`/courses/${coursesId}/polls/${item.id}/detail`)} className="fl font-16 font-bd mt2 color-grey-3 task-hide pointer" style={{"maxWidth":"600px"}} title={item.polls_name}>{item.polls_name}
}
{
item.lock_status === 0 ?
{ item.author && {item.author} }
{
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 &&