import React from 'react'; import Modals from "../../modals/Modals"; import axios from 'axios'; class Chongzuomodel extends React.Component { constructor(props) { super(props); this.state = { ModalsType:false, antIcon:false } } componentDidMount(){ this.setState({ ModalsType:this.props.Chongzuomodeltype, Modalstopval:`该作业将被打回重做,学生实训记录将被清空!`, ModalsBottomval:`确定打回?`, }) } ModalSaves=()=>{ this.setState({ antIcon:true }) let zrl=`/myshixuns/${this.props.chongzuoId}/reset_my_game.json?course_id=${this.props.match.params.coursesId}`; axios.get(zrl).then((response) => { this.setState({ antIcon:false }) this.props.showNotification("操作成功"); this.props.hideChongzuomodeltype() this.props.Isupdatass(); }).catch((error) => { this.setState({ antIcon:false }) }); } ModalCancels=()=>{ this.props.hideChongzuomodeltype() } render() { //console.log(this.props) // Chongzuomodeltype:undefined, // chongzuoId:undefined, return ( this.ModalSaves()} modalCancel={()=>this.ModalCancels()} loadtype={false} antIcon={this.state.antIcon} > ); } } export default Chongzuomodel;