import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn} from 'educoder'; import axios from 'axios'; import { notification, Spin } 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"; import Modals from "../../modals/Modals"; class ShixunHomeworkPage extends Component { constructor(props) { super(props); // this.answerMdRef = React.createRef(); this.state = { tab: ["0"], jobsettingsdatapage: undefined, teacherdatapage: undefined, code_review: false, view_report: false, visible: false, showmodel:false, child:undefined, yslpros:false, Modalstopval:"你在该实训的学习记录将被清空,无法恢复", ModalsBottomval:"是否确认重做?", ModalsType:false, mylistisSpin:false, Showupdateinstructions:false, } } //切换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("ShixunHomeworkPage56"); // console.log(jobsettingsdata); // console.log(teacherdata); this.setState({ jobsettingsdatapage: jobsettingsdata.data.message===undefined?jobsettingsdata:undefined, teacherdatapage: teacherdata.message===undefined?teacherdata:undefined, code_review: teacherdata.code_review===undefined?false :teacherdata.code_review, view_report: teacherdata.view_report!==undefined? false:teacherdata.view_report, }) } componentDidMount() { // console.log("父组件加载框"); 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,i) { if(i===1){ child.daochushixunbaogao(); } if(i===2){ child.daochuzuoye(); } } homeworkendss(child){ child.homeworkends(); } homeworkstarts(child){ child.homeworkstart(); } workshowmodels(child){ child.workshowmodel(); } /// 重做的确认 ModalSaves=()=>{ this.setState({ ModalsType:false, Modalstopval:"" }); if(this.state.teacherdatapage){ this.resetshixunCombat(this.state.teacherdatapage.myshixun_identifier); } try { console.log("this.child"); console.log(this.child); }catch (e) { } }; //取消重做 ModalCancels=()=>{ this.setState({ ModalsType:false, Modalstopval:"" }) }; //打开重做弹框 Modalcancelss=()=>{ this.setState({ Modalstopval:"你在该实训的学习记录将被清空,无法恢复", ModalsBottomval:"是否确认重做?", ModalsType:true, }) } //重置按钮 resetshixunCombat=(id)=>{ this.setState({ mylistisSpin:true, }) let zrl=`/myshixuns/${id}/reset_my_game.json`; axios.get(zrl).then((response) => { // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; this.setState({ mylistisSpin:false, }) this.child.Isupdatass(); this.props.showNotification("已清空本实训的学习记录\n" + "\n" + "请点击“开启挑战”重做实训作业"); }).catch((error) => { this.setState({ mylistisSpin:false, }) console.log(error) }); } bindRef = ref => { this.child = ref } ///////////////教师截止 //编辑作业 Showupdateinstructionsboolfalse (bool) { this.setState({ Showupdateinstructions:bool }) } //开始编辑作业 edenwork = ()=>{ this.setState({ Showupdateinstructions:true }) } gotohome=()=>{ // console.log(this.props) let {jobsettingsdatapage}=this.state this.props.history.replace(`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_id === undefined ? "" : jobsettingsdatapage.data.category.category_id}`); } render() { let {tab, teacherdatapage, jobsettingsdatapage} = this.state; const isAdmin = this.props.isAdmin(); // console.log(119) // console.log(jobsettingsdatapage); document.title=jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name; return (
{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name}
>
{jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_name}
>