|
|
|
@ -30,7 +30,8 @@ class Challengesjupyter extends Component {
|
|
|
|
|
fileList:[],
|
|
|
|
|
shuaxin:false,
|
|
|
|
|
showtime:false,
|
|
|
|
|
jupytertime:Date.now() +3600 * 1000
|
|
|
|
|
jupytertime:Date.now() +3600 * 1000,
|
|
|
|
|
endtimes:false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -119,10 +120,12 @@ class Challengesjupyter extends Component {
|
|
|
|
|
let remainingSeconds=response.data.remainingSeconds;
|
|
|
|
|
// let summain=3600 * 1000;
|
|
|
|
|
let sums= remainingSeconds * 1000;
|
|
|
|
|
let endsms=(remainingSeconds-300<0?0:remainingSeconds-300)*1000
|
|
|
|
|
// let sum=summain-sums;
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
jupytertime:Date.now() +sums
|
|
|
|
|
jupytertime:Date.now() +sums,
|
|
|
|
|
endtimes:endsms===0?Date.now() +1000:Date.now() +endsms
|
|
|
|
|
})
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
@ -436,8 +439,45 @@ class Challengesjupyter extends Component {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onendFinish=()=>{
|
|
|
|
|
let id=this.props.match.params.shixunId;
|
|
|
|
|
let that=this;
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '命令行连接时长提醒',
|
|
|
|
|
content: (
|
|
|
|
|
<p style={{ lineHeight: '24px' }}>
|
|
|
|
|
命令行即将中断,需要延长使用时间吗?
|
|
|
|
|
</p>
|
|
|
|
|
),
|
|
|
|
|
okText: '立即延长',
|
|
|
|
|
cancelText: '不需要',
|
|
|
|
|
onOk () {
|
|
|
|
|
that.onendhandleClickResetTpi(id)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onendhandleClickResetTpi=(id)=>{
|
|
|
|
|
|
|
|
|
|
const url = `/jupyters/active_with_tpm.json`;
|
|
|
|
|
axios.get(url,{params:{
|
|
|
|
|
identifier:id
|
|
|
|
|
}}).then((response) => {
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.props.showNotification('延长成功!');
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
jupytertime:Date.now() + 900 * 1000,
|
|
|
|
|
endtimes:Date.now() + 300 * 1000
|
|
|
|
|
})
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state;
|
|
|
|
|
let{ChallengesDataList,booljupyterurls,enlarge,fileList,endtimes}=this.state;
|
|
|
|
|
let id = this.props.match.params.shixunId;
|
|
|
|
|
//老师
|
|
|
|
|
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
|
|
|
|
@ -509,6 +549,7 @@ class Challengesjupyter extends Component {
|
|
|
|
|
<span className={"Countdowntypes"}>
|
|
|
|
|
{/*this.state.jupytertime*/}
|
|
|
|
|
<Countdown value={this.state.jupytertime} format="HH:mm:ss" onFinish={this.onFinish}/>
|
|
|
|
|
{endtimes===false?"":<Countdown value={endtimes} format="HH:mm:ss" onFinish={this.onendFinish}/>}
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<p className="clearfix mb20 edu-back-white">
|
|
|
|
|