|
|
|
@ -105,9 +105,9 @@ class Challengesjupyter extends Component {
|
|
|
|
|
setTimeout(this.ChallengesList(), 1000);
|
|
|
|
|
let id = this.props.match.params.shixunId;
|
|
|
|
|
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
|
|
|
|
|
let datas={
|
|
|
|
|
identifier:id,
|
|
|
|
|
}
|
|
|
|
|
let datas={
|
|
|
|
|
identifier:id,
|
|
|
|
|
}
|
|
|
|
|
axios.get(ChallengesURL, {params: datas}).then((response) => {
|
|
|
|
|
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
@ -115,26 +115,29 @@ class Challengesjupyter extends Component {
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
})
|
|
|
|
|
}, 600)
|
|
|
|
|
}else{
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
}else{
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
jupyter_url:response.data.url,
|
|
|
|
|
jupyter_port:response.data.port,
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
})
|
|
|
|
|
}, 800)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
})
|
|
|
|
|
}, 600)
|
|
|
|
|
var url=response.data.url;
|
|
|
|
|
var url2=url.replace("http://","https://");
|
|
|
|
|
this.setState({
|
|
|
|
|
jupyter_url:url2,
|
|
|
|
|
jupyter_port:response.data.port,
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
})
|
|
|
|
|
}, 800)
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
})
|
|
|
|
|
}, 600)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -148,15 +151,19 @@ class Challengesjupyter extends Component {
|
|
|
|
|
setTimeout(this.getjianjiesize(), 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('message', (e) => {
|
|
|
|
|
console.log("触发了jupytermessage");
|
|
|
|
|
console.log(e);
|
|
|
|
|
if(e){
|
|
|
|
|
if(e.data){
|
|
|
|
|
if(e.data==="jupytermessage"){
|
|
|
|
|
that.modifyjupyter();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener('jupytermessage', (e) => {
|
|
|
|
|
console.log("触发了jupytermessage");
|
|
|
|
|
console.log("触发了jupytermessage");
|
|
|
|
|
that.modifyjupyter();
|
|
|
|
|
});
|
|
|
|
|
setTimeout(this.getjianjiesize(), 1000);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatamakedowns = () => {
|
|
|
|
@ -210,13 +217,13 @@ class Challengesjupyter extends Component {
|
|
|
|
|
|
|
|
|
|
modifyjupyter=()=>{
|
|
|
|
|
let id=this.props.match.params.shixunId;
|
|
|
|
|
var jupyter_port="";
|
|
|
|
|
try{
|
|
|
|
|
jupyter_port= parseInt(this.state.jupyter_port);
|
|
|
|
|
}catch (e) {
|
|
|
|
|
jupyter_port=this.state.jupyter_port;
|
|
|
|
|
var jupyter_port="";
|
|
|
|
|
try{
|
|
|
|
|
jupyter_port= parseInt(this.state.jupyter_port);
|
|
|
|
|
}catch (e) {
|
|
|
|
|
jupyter_port=this.state.jupyter_port;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const url=`/jupyters/save_with_tpm.json`;
|
|
|
|
|
const data={
|
|
|
|
|
identifier:id,
|
|
|
|
@ -225,8 +232,8 @@ class Challengesjupyter extends Component {
|
|
|
|
|
axios.get(url, {params: data})
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status === 0) {
|
|
|
|
|
this.props.showNotification(`应用成功`);
|
|
|
|
|
console.log("触发了jupytermessage调用了应用成功");
|
|
|
|
|
// this.props.showNotification(`应用成功`);
|
|
|
|
|
console.log("应用成功了");
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
})
|
|
|
|
@ -237,15 +244,12 @@ class Challengesjupyter extends Component {
|
|
|
|
|
opentitletype:!this.state.opentitletype
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onclki=(bool)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
enlarge:bool
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let{ChallengesDataList,booljupyterurls,enlarge}=this.state;
|
|
|
|
|
let id = this.props.match.params.shixunId;
|
|
|
|
@ -255,8 +259,6 @@ class Challengesjupyter extends Component {
|
|
|
|
|
const business = this.props&&this.props.current_user&&this.props.current_user.business?this.props.current_user.business:false;
|
|
|
|
|
//管理员
|
|
|
|
|
const admin = this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
|
|
|
|
|
//用户
|
|
|
|
|
const login = this.props&&this.props.current_user&&this.props.current_user.login?this.props.current_user.login:"";
|
|
|
|
|
|
|
|
|
|
let mysidentity =false;
|
|
|
|
|
try {
|
|
|
|
@ -377,9 +379,8 @@ class Challengesjupyter extends Component {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction:row-reverse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
@ -388,29 +389,35 @@ class Challengesjupyter extends Component {
|
|
|
|
|
""
|
|
|
|
|
:
|
|
|
|
|
(
|
|
|
|
|
admin===true||business===true||mysidentity===true?
|
|
|
|
|
<div className={"shixunjianjiecballenges edu-back-white sortinxdirection mt20"}>
|
|
|
|
|
<div className="renwuxiangssi sortinxdirection">
|
|
|
|
|
<div><p className="renwuxiangqdiv">任务详情</p></div>
|
|
|
|
|
<div><p className="renwuxiangqdivtest ml1 shixunbingbaocun">(请将实训题目写在下方并保存)</p></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="renwuxiangssit xaxisreverseorder">
|
|
|
|
|
{
|
|
|
|
|
enlarge===true?
|
|
|
|
|
<i className="iconfont icon-suoxiao2 font-20 ml2 ysliconfont" style={{
|
|
|
|
|
marginLeft: '30px',
|
|
|
|
|
}} onClick={()=>this.onclki(false)}></i>
|
|
|
|
|
:
|
|
|
|
|
<i className="iconfont icon-fangda font-20 ml2 ysliconfont" style={{
|
|
|
|
|
marginLeft: '30px',
|
|
|
|
|
}} onClick={()=>this.onclki(true)}></i>
|
|
|
|
|
}
|
|
|
|
|
<div className="challenbaocun" ><p
|
|
|
|
|
className="challenbaocuntest">导入</p>
|
|
|
|
|
admin===true||business===true||mysidentity===true?
|
|
|
|
|
<div style={{
|
|
|
|
|
height: '63px',
|
|
|
|
|
}} className={enlarge?"shixunjianjiecballenges edu-back-white intermediatecenter fangdaone":"shixunjianjiecballenges edu-back-white mt20"}>
|
|
|
|
|
|
|
|
|
|
<div className={enlarge?"sortinxdirection jupyterswidth":"sortinxdirection"} >
|
|
|
|
|
<div className="renwuxiangssi sortinxdirection">
|
|
|
|
|
<div><p className="renwuxiangqdiv">任务详情</p></div>
|
|
|
|
|
<div><p className="renwuxiangqdivtest ml1 shixunbingbaocun">(请将实训题目写在下方并保存)</p></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="renwuxiangssit xaxisreverseorder">
|
|
|
|
|
{
|
|
|
|
|
enlarge===true?
|
|
|
|
|
<i className="iconfont icon-suoxiao2 font-18 ml2 ysliconfont" style={{
|
|
|
|
|
marginLeft: '30px',
|
|
|
|
|
}} onClick={()=>this.onclki(false)}></i>
|
|
|
|
|
:
|
|
|
|
|
<i className="iconfont icon-fangda font-18 ml2 ysliconfont" style={{
|
|
|
|
|
marginLeft: '30px',
|
|
|
|
|
}} onClick={()=>this.onclki(true)}></i>
|
|
|
|
|
}
|
|
|
|
|
{/*<div className="challenbaocun" ><p*/}
|
|
|
|
|
{/* className="challenbaocuntest">导入</p>*/}
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
:
|
|
|
|
|
|
|
|
|
|
:
|
|
|
|
|
""
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -442,34 +449,25 @@ class Challengesjupyter extends Component {
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
{
|
|
|
|
|
admin===true||business===true||mysidentity===true?
|
|
|
|
|
<div>
|
|
|
|
|
<div className="pb47">
|
|
|
|
|
{
|
|
|
|
|
this.state.jupyter_url===null || this.state.jupyter_url===undefined?
|
|
|
|
|
(
|
|
|
|
|
booljupyterurls===false?
|
|
|
|
|
<LoadingSpin></LoadingSpin>
|
|
|
|
|
:""
|
|
|
|
|
)
|
|
|
|
|
:
|
|
|
|
|
(
|
|
|
|
|
login==="innov"?
|
|
|
|
|
<iframe src={"http://121.41.4.83:46666/notebooks/root/work/01.ipynb"} className={enlarge?"fangdatwo":""}
|
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
|
|
|
|
|
name="framename" width="100%" height="700" frameBorder="0"
|
|
|
|
|
></iframe>
|
|
|
|
|
:
|
|
|
|
|
admin===true||business===true||mysidentity===true?
|
|
|
|
|
<div>
|
|
|
|
|
<div className="pb47">
|
|
|
|
|
{
|
|
|
|
|
this.state.jupyter_url===null || this.state.jupyter_url===undefined?
|
|
|
|
|
(
|
|
|
|
|
booljupyterurls===false?
|
|
|
|
|
<LoadingSpin></LoadingSpin>
|
|
|
|
|
:""
|
|
|
|
|
)
|
|
|
|
|
:
|
|
|
|
|
<iframe src={this.state.jupyter_url} className={enlarge?"fangdatwo":""}
|
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
|
|
|
|
|
name="framename" width="100%" height="700" frameBorder="0"
|
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
|
|
|
|
|
name="framename" width="100%" height="700" frameBorder="0"
|
|
|
|
|
></iframe>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
:""
|
|
|
|
|
</div>
|
|
|
|
|
:""
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|