diff --git a/public/react/src/common/EventUtil.js b/public/react/src/common/EventUtil.js
index 208207b5f..0b98925ef 100644
--- a/public/react/src/common/EventUtil.js
+++ b/public/react/src/common/EventUtil.js
@@ -27,7 +27,7 @@ function onMessageByLocalStorage(eventName, callback) {
}
window.addEventListener("storage", function(ev) {
const cb = localStorageMap[ev.key];
- console.log('storage event:', ev)
+ // console.log('storage event:', ev)
if (cb) {
cb(JSON.parse(ev.newValue))
}
diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
index f9318eb9d..314412f6b 100644
--- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
+++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js
@@ -34,6 +34,7 @@ class NewShixunModel extends Component{
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sorts)=>{
let newsort=sorts;
+ let no_jupyter=undefined;
if(this.props.type==="shixuns"&&type==="mine"){
if(this.props&&this.props.user.course_name===undefined){
newsort="created_at";
@@ -41,6 +42,12 @@ class NewShixunModel extends Component{
newsort="publish_time";
}
}
+ if(this.props.type==="shixuns"){
+ if(this.props&&this.props.user.course_name===undefined){
+ }else{
+ no_jupyter=1;
+ }
+ }
this.setState({
isspinning:true
})
@@ -51,6 +58,7 @@ class NewShixunModel extends Component{
}else{
url="/subject_lists.json";
}
+
axios.get(url,{params:{
page:page,
type:type,
@@ -59,7 +67,8 @@ class NewShixunModel extends Component{
order:order,
diff:diff,
limit:limit,
- sort:newsort
+ sort:newsort,
+ no_jupyter:no_jupyter
}}).then((response) => {
if(response.data){
if(pagetype===undefined){
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js
index 01e9fe5d3..f7f73eabc 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -383,8 +383,6 @@ class TPMIndex extends Component {
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
-
- console.log(this.state.openknows)
return (
{/*头部*/}
diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js
index 5efe5c729..e80edc59c 100644
--- a/public/react/src/modules/tpm/jupyter/index.js
+++ b/public/react/src/modules/tpm/jupyter/index.js
@@ -88,6 +88,15 @@ function JupyterTPI (props) {
const [myIdentifier, setMyIdentifier] = useState('');
const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
+ let newHandletype=false
+ const newHandle = function (event) {
+ if(newHandletype===false){
+ newHandletype=true
+ saveJupyterTpi(event);
+ setTimeout(()=>{newHandletype=false},500)
+ }
+ }
+
// 保存代码
const addEventListeners = () => {
window.addEventListener('message', (e) => {
@@ -95,12 +104,10 @@ function JupyterTPI (props) {
if(e){
if(e.data){
if(e.data==="jupytermessage"){
- saveJupyterTpi();
+ newHandle()
}
}
-
}
-
})
}
diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js
index cf2459922..5ecdbf699 100644
--- a/public/react/src/redux/actions/jupyter.js
+++ b/public/react/src/redux/actions/jupyter.js
@@ -15,7 +15,8 @@ import {
fetchSyncJupyterCode,
fetchreset_with_tpi,
fetchSaveJupyterTpi,
- fetactive_with_tpi
+ fetactive_with_tpi,
+ timeinfo_with_tpis
} from "../../services/jupyterServer";
// 获取 jupyter 相关信息
@@ -76,7 +77,9 @@ export const getJupyterTpiUrl = (obj) => {
console.log('获取url', res);
if (res.status === 200) {
const { status, url = '', port } = res.data;
- addjypertime(Date.now() +3600 * 1000)
+ dispatch(updataspinning(false))
+ setTimeout(()=>{ dispatch(addjypertime(Date.now() +3600 * 1000))},500)
+ // timeinfo_with_tpi(id,dispatch)
dispatch({
type: types.GET_JUPYTER_TPI_URL,
payload: {
@@ -106,7 +109,7 @@ export const syncJupyterCode = (identifier, msg) => {
const {status} = res.data
if (status === 0) {
message.success(msg);
- updataspinning(false)
+ dispatch(updataspinning(false))
setTimeout(() => {
window.location.reload();
}, 300);
@@ -131,7 +134,7 @@ export const reset_with_tpi = (identifier, msg) => {
const {status} = res.data
if (status === 0) {
message.success(msg);
- updataspinning(false)
+ dispatch(updataspinning(false))
setTimeout(() => {
window.location.reload();
}, 300);
@@ -156,7 +159,7 @@ export const active_with_tpi = (identifier, msg) => {
const {status} = res.data
if (status === 0) {
message.success(msg);
- addjypertime(Date.now() + 900 * 1000);
+ dispatch(addjypertime(Date.now() + 900 * 1000))
}
}
})
@@ -171,6 +174,7 @@ export const changeGetJupyterUrlState = (status) => {
payload: status
}
}
+
// 保存 jupyter tpi
export const saveJupyterTpi = () => {
return (dispatch, getState) => {
@@ -234,3 +238,29 @@ export const updataspinning=(type)=>{
}
}
+// 获取重置实训后的时间
+export const timeinfo_with_tpi = (identifier, dispatch) => {
+ debugger
+ const params = {
+ identifier: identifier
+ };
+ debugger
+ timeinfo_with_tpis(params).then(res => {
+ debugger
+ console.log('同步时间成功: ', res);
+ if (res.data.status === 401) return;
+ if (res.status === 200) {
+ const {status} = res.data
+ console.log(status)
+ // dispatch(addjypertime(Date.now() +3600 * 1000))
+ // setTimeout(()=>{ dispatch(addjypertime(Date.now() +3600 * 1000))},500)
+ // if (status === 0) {
+ // message.success(msg);
+ // dispatch(updataspinning(false))
+ // setTimeout(() => {
+ // window.location.reload();
+ // }, 300);
+ // }
+ }
+ })
+}
\ No newline at end of file
diff --git a/public/react/src/redux/reducers/commonReducer.js b/public/react/src/redux/reducers/commonReducer.js
index 5694faf84..d0246afce 100644
--- a/public/react/src/redux/reducers/commonReducer.js
+++ b/public/react/src/redux/reducers/commonReducer.js
@@ -16,7 +16,7 @@ const initialState = {
publishLoading: false, // 发布
isMySource: false,
drawervisible:false,
- jupytertime:Date.now() + 3600 * 1000,
+ jupytertime:0,
spinning:false
}
diff --git a/public/react/src/services/jupyterServer.js b/public/react/src/services/jupyterServer.js
index 37c86a3a2..93464820d 100644
--- a/public/react/src/services/jupyterServer.js
+++ b/public/react/src/services/jupyterServer.js
@@ -44,4 +44,11 @@ export async function fetchreset_with_tpi (params) {
export async function fetactive_with_tpi(params) {
const url = `/jupyters/active_with_tpi.json`;
return axios.get(url, { params });
+}
+
+
+//获取tpi重置实训的time
+export async function timeinfo_with_tpis(params){
+ const url = `/jupyters/timeinfo_with_tpi.json`;
+ return axios.get(url, { params });
}
\ No newline at end of file