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(
{/* */} { mainList && mainList.homeworks && mainList.homeworks.length>0 && mainList.homeworks.map((item,index)=>{ let canNotLink = !isAdminOrStudent && item.private_icon == true return(
{ mainList && isAdmin && }
this.props.onItemClick(Object.assign({}, item, {id: item.homework_id})) }>

{canNotLink? {item.name} : {} : () => this.onItemClick(item)} title={item.name} >{item.name}} {/* 只有非课堂成员且作业是私有的情况下才会为true */} { item.private_icon===true ? ( ) : "" } {/* { mainList && isAdmin &&

    • { this.props.toEditPage(this.props.match.params, item.homework_id) }}> 编辑
    • { this.props.toWorkSettingPage(this.props.match.params, item.homework_id) }}> 设置
  • } */}

    { item && item.upper_category_name && // 22 }>
    所属目录:{item.upper_category_name}
    //
    }

    { item.author && {item.author} } {item.commit_count===undefined?"":{item.commit_count} 已交} {item.uncommit_count===undefined?"":{item.uncommit_count} 未交} { item.status_time!="" && {item.status_time} } {/**/} {/**/} {isAdmin &&

    {} : () => this.onItemClick(item)} >查看详情 { this.props.toEditPage(this.props.match.params, item.homework_id) }}>编辑 { this.props.toWorkSettingPage(this.props.match.params, item.homework_id) }}>设置
    } { // isStudent &&
  • {} : () => this.onItemClick(item)} >查看详情 { // item.work_status && item.work_status.indexOf('关联项目') != -1 && this.props.toCreateProject(item)}>创建项目 this.props.openConnectionProject(item)}>关联项目 } { // item.work_status && item.work_status.indexOf('取消关联') != -1 && this.props.cancelConnectionProject(item)}>取消关联 } { // item.work_status && item.work_status.indexOf('提交作品') != -1 && this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品 } { // item.work_status && item.work_status.indexOf('补交作品') != -1 && this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>补交作品 } { // item.work_status && item.work_status.indexOf('修改作品') != -1 && this.props.toWorkPostPage(this.props.match.params, item.homework_id, true, item.work_id)}>修改作品 } { // item.work_status && item.work_status.indexOf('补交附件') != -1 && this.addAccessory(item)}>补交附件 } { // item.work_status && item.work_status.indexOf('查看作品') != -1 && this.props.toWorkDetailPage(this.props.match.params, item.homework_id, item.work_id)}>查看作品 }
  • }

    ) }) }
    ) } } export default CommonWorkItem;