diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index ea241b479..e10eb6161 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -13,7 +13,7 @@ import { getImageUrl ,markdownToHTML, configShareForCustom} from 'educoder' import { CircularProgress } from 'material-ui/Progress'; import { Modal, Spin, Tooltip ,message,Icon} from 'antd'; - +import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; import '../shixunchildCss/Challenges.css' @@ -69,28 +69,47 @@ class Challengesjupyter extends Component { } axios.get(ChallengesURL, {params: datas}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + setTimeout(() => { + this.setState({ + booljupyterurls:true, + }) + }, 600) }else{ if(response.data.status===0){ - this.setState({ - jupyter_url:response.data.url, - jupyter_port:response.data.port, - }) + + setTimeout(() => { + this.setState({ + jupyter_url:response.data.url, + jupyter_port:response.data.port, + booljupyterurls:true, + }) + }, 800) + }else{ + setTimeout(() => { + this.setState({ + booljupyterurls:true, + }) + }, 600) + } } + + + }).catch((error) => { + setTimeout(() => { this.setState({ booljupyterurls:true, }) - }).catch((error) => { - this.setState({ - booljupyterurls:true, - }) + }, 600) + }); } updatamakedowns = () => { this.setState({ loading:true, + booljupyterurls:false }) let id = this.props.match.params.shixunId; let ChallengesURL = `/jupyters/get_info_with_tpm.json`; @@ -99,38 +118,43 @@ class Challengesjupyter extends Component { } axios.get(ChallengesURL, {params: datas}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + setTimeout(() => { + this.setState({ + booljupyterurls:true, + }) + }, 600) }else{ if(response.data.status===0){ + setTimeout(() => { + this.setState({ + jupyter_url:response.data.url, + jupyter_port:response.data.port, + booljupyterurls:true, + }) + }, 800) this.setState({ - jupyter_url:response.data.url, - jupyter_port:response.data.port, + }) }else{ + setTimeout(() => { + this.setState({ + booljupyterurls:true, + }) + }, 600) } } - this.setState({ - booljupyterurls:true, - loading:false, - }) }).catch((error) => { - this.setState({ - booljupyterurls:true, - loading:false, - }) + setTimeout(() => { + this.setState({ + booljupyterurls:true, + }) + }, 600) + }); } - - - - - - - - - modifyjupyter=()=>{ let id=this.props.match.params.shixunId; var jupyter_port=""; @@ -165,7 +189,6 @@ class Challengesjupyter extends Component { return ( <React.Fragment> <div className="mt30 pl20 pr20" > - <Spin spinning={this.state.loading}> <p className="clearfix mb20"> <span className="font-16 fl">简介</span> <Tooltip placement="bottom" title={"编辑"}> @@ -272,7 +295,11 @@ class Challengesjupyter extends Component { <div className="pb47"> { this.state.jupyter_url===null || this.state.jupyter_url===undefined? - "" + ( + booljupyterurls===false? + <LoadingSpin></LoadingSpin> + :"" + ) : <iframe src={this.state.jupyter_url} sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" @@ -284,7 +311,6 @@ class Challengesjupyter extends Component { :"" } </div> - </Spin> </div> </React.Fragment>