import React,{ Component } from "react"; import CoursesListType from '../../coursesPublic/CoursesListType'; import { WordsBtn } from 'educoder'; import {Tooltip} from 'antd'; import {Link} from 'react-router-dom'; import axios from 'axios'; import Modals from '../../../modals/Modals'; import Associationmodel from '../../coursesPublic/Associationmodel'; import AccessoryModal from "../../coursesPublic/AccessoryModal"; class GraduateTaskItem extends Component{ constructor(props){ super(props); this.state = { modalname:"关联项目", visible:false } } componentDidMount() { // let url="/graduation_tasks/"+this.props.taskid+"/graduation_works/check_project.json"; // axios.get(url).then((result)=>{ // // console.log(result) // }).catch((error)=>{ // console.log(error) // }) // // let is_relate=false // // this.setState({ // isrelate:is_relate // }) } cannelAssociation=()=>{ this.setState({ Modalstype:true, Modalstopval:"确定要取消该项目关联?", cardsModalcancel:this.cannerassocition, cardsModalsavetype:this.savetassociton }) } cannerassocition=()=>{ this.setState({ Modalstype:false, Modalstopval:"", cardsModalcancel:"", cardsModalsavetype:"", loadtype:false }) } savetassociton=()=>{ this.cannerassocition(); let taskid=this.props.taskid; let url = "/graduation_tasks/"+taskid+"/graduation_works/cancel_relate_project.json"; axios.get(url).then((result)=>{ if(result.data.status===0){ // this.setState({ // Modalstype:true, // Modalstopval:result.data.message, // cardsModalsavetype:this.cannerassocition, // loadtype:true // }) this.props.funlist() } }).catch((error)=>{ console.log(error) }) } saveAssociationItems=()=>{ let coursesId=this.props.coursesId; let taskid=this.props.taskid; let url="/courses/"+coursesId+"/graduation_tasks/relate_project.json"; axios.post(url,{ project_id:taskid }).then((result)=>{ // console.log(result) if(result.data.status===0){ this.setState({ Modalstype:true, Modalstopval:result.data.message, cardsModalsavetype:this.cannerassocition, loadtype:true }) } }).catch((error)=>{ console.log(error) }) } AssociationItems=()=>{ this.setState({ visible:true }) // this.setState({ // Modalstype:true, // // Modalstopval:"确定要关联该项目关联?", // cardsModalcancel:this.cannerassocition, // cardsModalsavetype:this.saveAssociationItems // }) } addAccessory=()=>{ this.setState({ visibles:true }) } Cancel=()=>{ this.setState({ visible:false }) } Cancelvisible=()=>{ this.setState({ visibles:false }) } setupdate=()=>{ this.props.funlist } 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 { Modalstype, Modalstopval, Modalsbottomval, cardsModalcancel, cardsModalsavetype, loadtype, modalname, visible } = this.state; const { checkBox, discussMessage, onItemClick, coursesId, categoryid, taskid, index, isAdmin } = this.props; return(
{/* {discussMessage.author.name} */}
{ discussMessage.author && {discussMessage.author} }
{discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已交}
{discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未交}
{/*{discussMessage.replies_count} 3 未评*/}