import React,{ Component } from "react"; import { Input,Checkbox, Modal,Menu, Tooltip, Pagination } from "antd"; import '../css/members.css' import '../css/busyWork.css' import CoursesListType from '../coursesPublic/CoursesListType' import { WordsBtn } from 'educoder' import AccessoryModal2 from '../coursesPublic/AccessoryModal2' import AccessoryModal from '../coursesPublic/AccessoryModal' import axios from 'axios' class CommonWorkItem extends Component{ constructor(props){ super(props); this.state = { aModalVisible: false } } onItemClick = (item) => { 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 // } const isStudent = this.props.isStudent() if (isStudent) { this.props.toWorkQuestionPage(this.props.match.params, item.homework_id) } else { this.props.toWorkListPage(this.props.match.params, item.homework_id) } } sendMoreAttachment = (item) => { this.handleItem = item; const url = `/student_works/${item.work_id}/supply_attachments.json` axios.get(url, { }) .then((response) => { if (response.data.revise_attachments) { // response.data.revise_attachments = [ // { // "id": 8686, // "title": "lasdl", // "filesize": 12323, // "description": "1原因3", // "url": "/attachments/:id/download", // "delete": true // } // ] // response.data.revise_reason = 'qweqweqweqe'; // revise_reason revise_attachments 传给modal // attach to fileList const fileList = response.data.revise_attachments.map(item => { return { id: item.id, uid: item.id, name: item.title, url: item.url, status: 'done', description: item.description, delete: item.delete, filesize: item.filesize, } }) this.setState({ aModalVisible: true, fileList, revise_reason: response.data.revise_reason }) } }) .catch(function (error) { console.log(error); }); } toProductPage = (item) => { } // Cancelvisible = () => { // this.setState({ aModalVisible: false }) // } onAccessoryModalSaves = (newfileList, description) => { const url = `/student_works/${this.handleItem.work_id}/revise_attachment.json` axios.post(url, { "description": description, "attachment_ids": newfileList }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('提交成功') } }) .catch(function (error) { console.log(error); }); } // 补交附件 Cancelvisible=()=>{ this.setState({ accessoryVisible:false }) } addAccessory=()=>{ this.setState({ accessoryVisible:true }) } setupdate = () => { } render(){ let { mainList,workType }=this.props; const { aModalVisible, fileList, revise_reason } = this.state let coursesId = this.props.match.params.coursesId; const isStudent = this.props.isStudent() const isAdmin = this.props.isAdmin() const isAdminOrStudent = this.props.isAdminOrStudent() return(
{canNotLink?
{item.name}
: {} : () => this.onItemClick(item)}
title={item.name}
>{item.name}}
{/* 只有非课堂成员且作业是私有的情况下才会为true */}
{
item.private_icon===true ?
(
{ item.author && {item.author} }
{item.commit_count===undefined?"":{item.commit_count} 已交}
{item.uncommit_count===undefined?"":{item.uncommit_count} 未交}
{
item.status_time!="" &&
{item.status_time}
}
{/*