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'; import LoginDialog from '../../login/LoginDialog'; const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} const dataformat="YYYY-MM-DD HH:mm"; class PollListItem extends Component{ constructor(props){ super(props); this.state={ isRender:false, } } Modifyloginvalue=()=>{ this.setState({ isRender:false, }) }; showfiles =(url)=>{ // console.log("ShixunhomeWorkItemshowfiles"); // console.log( this.props.current_user.username); try { if(this.props.current_user.username==="游客"){ this.setState({ isRender:true, match:"", }); return } }catch (e) { } this.props.history.push(url); // this.props.current_user }; render(){ let{isRender}=this.state; 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 ? this.showfiles(`/courses/${coursesId}/polls/${item.id}/detail`)} style={{"maxWidth":"600px", "cursor": "default"}} title={item.polls_name}>{item.polls_name} :
this.showfiles(`/courses/${coursesId}/polls/${item.id}/detail`)}
className="fl font-16 font-bd mt2 color-grey-3 task-hide" 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 &&