import React, { Component } from 'react'; import {getImageUrl} from 'educoder'; import { Tooltip,Modal,Icon,Spin,message} from 'antd'; import '../../paths/ShixunPaths.css'; import axios from 'axios'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; class YslDetailCards extends Component{ constructor(props){ super(props) this.state={ showparagraph:false, showparagraphkey:"", showparagraphindex:"", shixunsreplace:false, hidestartshixunsreplacevalue:"", shixunsmessage:"", startshixunCombattype:false, isSpin:false, } } showparagraph =(key,index)=>{ this.setState({ showparagraph:true, showparagraphkey:key, showparagraphindex:index }) }; hideparagraph=()=>{ this.setState({ showparagraph:false }) }; startgameid=(id)=>{ // 上面传过来的方法是用来没登入弹出弹框的 try { let {userlogin} = this.props; if (userlogin === undefined) { this.props.Tojoinclass(); return } if (userlogin === "") { this.props.Tojoinclass(); return; } }catch (e) { } try { if(this.props.isNotMember()===true){ //这个是外部传过来的 this.props.Startlearningtwo(); return } }catch (e) { } let url = "/shixuns/" + id + "/shixun_exec.json"; axios.get(url).then((response) => { if (response.data.status === -2) { this.setState({ shixunsreplace:true, hidestartshixunsreplacevalue:response.data.message+".json" }) } else if (response.data.status === -1) { console.log(response) }else if(response.data.status===-3){ this.setState({ shixunsmessage:response.data.message, startshixunCombattype:true, }) } else { console.log("开始学习了"); window.open("/tasks/" + response.data.game_identifier,'_blank'); //这个是传过来 调用刷新 this.props.Myreload(); // window.location.href = path // let path="/tasks/"+response.data.game_identifier; // this.props.history.push(path); } }).catch((error) => { }); }; componentDidMount(){ } hidestartshixunsreplace=(url)=>{ this.setState({ isSpin:true, }) axios.get(url).then((response) => { // debugger if(response.status===200){ // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; // this.props.history.push(path); message.success('重置成功,正在进入实训!'); this.startgameid(response.data.shixun_identifier); this.setState({ shixunsreplace:false, isSpin:false, startbtn:false, }) // message.success('重置成功,正在进入实训!'); // this.startshixunCombat(); }} ).catch((error) => { this.setState({ isSpin:false, shixunsreplace:false, }) }); } hidestartshixunCombattype=()=>{ this.setState({ startshixunCombattype:false }) } render(){ let{showparagraph,showparagraphkey,showparagraphindex,hidestartshixunsreplacevalue} =this.state; let { stages }=this.props; const antIcon = ; return(

本实训的开启时间:{this.state.shixunsmessage}
开启时间之前不能挑战

{/*取消*/} 知道了
{/*

*/} {/*知道了*/} {/*

*/}

实训已经更新了,正在为您重置!

this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了
{ stages && stages.map((item,key)=>{ return(

{item.stage_name}

{item.stage_description}

{ item.shixuns_list && item.shixuns_list.map((line,index)=>{ return(
this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}>
  • { line.complete_status === 1 ? : } {key+1}-{index+1}  {line.shixun_name}
  • { this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?
  • 暂未公开
  • :
  • { showparagraphkey===key&&showparagraphindex===index?:"" }
  • }
    ) }) }
    ) }) }
    ) } } export default YslDetailCards;