From 6ea0459f35cbb218c0c5769f608294ac777fd1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 18:07:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 2 +- .../Challenges/Challengesjupyter.js | 25 +++++++++++-------- public/react/src/redux/actions/jupyter.js | 3 ++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 8c07b0bee..6883aa72f 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -367,7 +367,7 @@ function JupyterTPI (props) { - {/*{endjupytertime===false?"":}*/} + {endjupytertime===false?"":}

diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index d53a88327..3f2aa68a9 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -107,7 +107,7 @@ class Challengesjupyter extends Component { } - gettimeinfo_with_tpm=(datas)=>{ + gettimeinfo_with_tpm=(datas,type)=>{ let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json` axios.get(timeinfo_with_tpm, {params: datas}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { @@ -128,6 +128,9 @@ class Challengesjupyter extends Component { endtimes:endsms===0?Date.now()+1000:Date.now() +endsms }) },500); + if(type===true){ + this.props.showNotification('延长成功!'); + } } }else{ @@ -461,19 +464,21 @@ class Challengesjupyter extends Component { onendhandleClickResetTpi=(id)=>{ - + let datas={ + identifier: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); + this.gettimeinfo_with_tpm(datas,true) + // setTimeout(()=>{ + // this.setState({ + // jupytertime:Date.now() + 900 * 1000, + // endtimes:Date.now() + 300 * 1000 + // }) + // },500); } }); } @@ -550,7 +555,7 @@ class Challengesjupyter extends Component { {/*this.state.jupytertime*/} - {/*{endtimes===false?"":}*/} + {endtimes===false?"":}

diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index 1a3654c3f..c4a723b3c 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -160,7 +160,8 @@ export const active_with_tpi = (identifier, msg) => { if (status === 0) { message.success(msg); // dispatch(addjypertime(Date.now() + 900 * 1000,false)) - setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800); + // setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800); + timeinfo_with_tpi(identifier,dispatch) } } })