import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn} from 'educoder'; import axios from 'axios'; import { notification } from "antd"; import '../css/members.css'; import "../common/formCommon.css"; import '../css/Courses.css'; import './style.css'; import '../css/busyWork.css'; import '../poll/pollStyle.css'; import Listofworksstudentone from './Listofworksstudentone'; import Trainingjobsetting from './Trainingjobsetting'; import Workquestionandanswer from './Workquestionandanswer'; import CoursesListType from '../coursesPublic/CoursesListType'; import ShixunStudentWork from "./ShixunStudentWork"; import Startshixuntask from "../coursesPublic/Startshixuntask"; import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; import DownloadMessageysl from "../../modals/DownloadMessageysl"; class ShixunHomeworkPage extends Component { constructor(props) { super(props); // this.answerMdRef = React.createRef(); this.state = { tab: ["0"], jobsettingsdata: undefined, teacherdata: undefined, code_review: false, view_report: false, visible: false, showmodel:false, child:undefined, DownloadType:false, DownloadMessageval:undefined, } } //切换tab ChangeTab = (e) => { // console.log(e); this.setState({ tab: e }) try { var currenturl = window.location.href; var newUrl = (currenturl.split("?"))[0]; window.history.pushState('','',newUrl+'?tab='+e); }catch (e) { console.log(e); console.log("44"); } } Getdataback = (jobsettingsdata, teacherdata) => { console.log("56"); console.log(jobsettingsdata); console.log(teacherdata); this.setState({ jobsettingsdata: jobsettingsdata, teacherdata: teacherdata, code_review: teacherdata.code_review, view_report: teacherdata.view_report, }) } componentDidMount() { const query = this.props.location.search; const type = query.split('?tab='); // let sum = [] // sum.push(type[1]) // console.log("componentDidMountcomponentDidMount"); console.log(type); this.setState({ tab: type[1], }) let querys = this.props.location.pathname; const types = querys.split('/'); console.log(types); this.setState({ shixuntypes: types[3] }) } // confirmysl(child,url) { // confirmysl(url); // } homeworkendss(child){ child.homeworkends(); } homeworkstarts(child){ child.homeworkstart(); } workshowmodels(child){ child.workshowmodel(); } /// 确认是否下载 confirmysl(url){ axios.get(url).then((response) => { if(response.data.status&&response.data.status===-1){ }else if(response.data.status&&response.data.status===-2){ if(response.data.messages === "100"){ // 已超出文件导出的上限数量(100 ),建议: this.setState({ DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ DownloadType:true, DownloadMessageval:500 }) } }else { this.props.showNotification(`正在下载中`); window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) }); } Downloadcal=()=>{ this.setState({ DownloadType:false, DownloadMessageval:undefined }) } bindRef = ref => { this.child = ref } ///////////////教师截止 render() { let {tab, teacherdata, jobsettingsdata} = this.state; const isAdmin = this.props.isAdmin(); return (

{jobsettingsdata === undefined ? "" : jobsettingsdata.data.course_name} > {jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name} > 作业详情

{teacherdata === undefined ? "" : teacherdata.homework_name}

返回 实训详情
this.ChangeTab(0)}>作品列表 this.ChangeTab(1)}>作业问答 {this.props.isAdmin() ? this.state.code_review === true || jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0] === "未发布" ? "" : this.ChangeTab(2)}> 代码查重 : ""} {parseInt(tab) === 3? :""} this.ChangeTab(3)} >设置 {/*{this.props.isAdmin() ? 导出 : ""}*/} {this.props.isAdmin() ?
  • 导出
  • : ""} {this.props.isAdmin() ? teacherdata && teacherdata.end_immediately === true ? this.homeworkendss(this.child)}>立即截止 : "" : ""} {this.props.isAdmin() ? teacherdata && teacherdata.publish_immediately === true ? this.homeworkstarts(this.child)}>立即发布 : "" : ""} {this.props.isAdmin() ? teacherdata && teacherdata.code_review === true ? this.workshowmodels(this.child)}>代码查重 : "" : ""} {this.state.view_report === true ? 查看实训报告 : ""} { teacherdata === undefined ? "" : teacherdata.commit_des === null || teacherdata.commit_des === undefined ? "" : {teacherdata.commit_des} } {teacherdata === undefined ? "" : }
    {parseInt(tab) === 0 && this.Getdataback(jobsettingsdata, teacherdata)}>} {parseInt(tab) === 1 && this.Getdataback(jobsettingsdata, teacherdata)}>} {parseInt(tab) === 2 && this.Getdataback(jobsettingsdata, teacherdata)}>} {parseInt(tab) === 3 && this.Getdataback(jobsettingsdata, teacherdata)}>}
    ) } } export default ShixunHomeworkPage; //
    //
    //
    //
    // {this.props.isAdmin() === true ? // // this.changeTab(e)}> // 作品列表 // 作业回答 // 代码查重 // 设置 // // : // this.changeTab(e)}> // 作品列表 // 作业回答 // 代码查重 // // } // //
    //
    {/*
    */ } {/*
    */ }