From 4f5dfccaaa95c8fc5bf88fb02cf8b689814de0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 14 Dec 2019 01:46:27 +0800 Subject: [PATCH 01/63] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 1d713acc3..62e9156ff 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -301,7 +301,7 @@ class Challengesjupyter extends Component { } { - is_teacher===true||admin===true||business===true? + is_teacher===true||admin===true||business===true||this.props.identity < 8?
(请将实训题目写在下方并保存)
应用到实训
+ 你在本文件中修改的内容将丢失,
+ 是否确定重置环境?
+
Some contents...
+Some contents...
+Some contents...
+任务详情
(请将实训题目写在下方并保存)
导入
任务详情
(请将实训题目写在下方并保存)
+ 基本使用情况 +
+ {/*基本使用情况1*/} ++ 教师 +
++ 学生 +
++ 课堂 +
++ 共建实训 +
++ 实习报告 +
++ 学员实战时间 +
++ 课堂 +
+ { + courses===null? ++ 教师排名 +
+ { + teachers===null? ++ 在线实训情况 +
+ { + shixun_chart_data===null? ++ 学生排名 +
+ { + students === null ? ++ 最热评测 +
+ { + studentionsnames===null? +确定要删除该条回复吗?
), + onOk () { + console.log('点击了删除'); + } + }); + // ModalConfirm('提示', (确定要删除该条回复吗?
), () => { + // console.log('点击了删除'); + // }); + } + + // 评论头像 + const commentAvatar = (url) => ( + + ); + + // 评论信息 + const commentInfo = () => ( +
+ 用户名
+ {moment(new Date(), 'YYYYMMDD HHmmss').fromNow()}
+
+ 这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容这是评论内容 +
+ ); + + // 加载更多 + const handleOnLoadMore = () => { + if (!arrow) { + // 展开所有 + } else { + // 收起 + } + setArrow(!arrow); + }; + + // 评论追加内容 + const commentAppend = () => { + + return ( +展开其余23条评论
+
+
发布后即可应用到自己管理的课堂
是否确认发布?
发布后即可应用到自己管理的课堂
是否确认发布?
发布后即可应用到自己管理的课堂
是否确认发布?
是否确认撤销发布?
), () => { - changePublishLoadingStatus(true); - handleCancelPublish(props, identifier); + // ModalConfirm('提示', (是否确认撤销发布?
), () => { + // changePublishLoadingStatus(true); + // handleCancelPublish(props, identifier); + // }); + props.confirm({ + title: '提示', + content: ((是否确认撤销发布?
)), + onOk () { + changePublishLoadingStatus(true); + handleCancelPublish(props, identifier); + } }); - } // 取消保存/取消按钮 @@ -125,6 +139,7 @@ const NewOrEditTask = (props) => { const renderPubOrFight = () => { const pubButton = isPublish ? (出题者: - {username} + {username}
+ {ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined? +
暂时还没有相关数据哦!
+{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
} - + }@@ -341,11 +387,7 @@ class Challengesjupyter extends Component { : ( admin===true||business===true||mysidentity===true? -
任务详情
(请将实训题目写在下方并保存)
导入
-导入
*/} + {/*@@ -385,9 +330,8 @@ class Challengesjupyter extends Component { display: flex; flex-direction:row-reverse; } - ; - } + } ` } @@ -396,29 +340,33 @@ class Challengesjupyter extends Component { "" : ( - admin===true||business===true||mysidentity===true? -
任务详情
(请将实训题目写在下方并保存)
导入
*/} - {/*任务详情
(请将实训题目写在下方并保存)
导入
*/} + {/*任务详情
(请将实训题目写在下方并保存)
导入
*/} {/*Some contents...
-Some contents...
-Some contents...
+ +导入
*/} - {/*this.daoruzhon()}>导入
+
{/* sync | poweroff */}
-
this.daoruzhon()}>导入
+ className="challenbaocuntest" onClick={()=>this.Importingfiles()}>导入this.Importingfiles()}>导入
+ +this.Importingfiles()}>导入
关卡任务的代码文件有更新啦
更新操作将保留已完成的评测记录和成绩
还未完成评测的任务代码,请自行保存
@@ -128,21 +149,17 @@ function JupyterTPI (props) { cancelText: '取消', onOk () { syncJupyterCode(myshixun_identifier, '同步成功'); - } + },onCancel() { + stopposttpip(2) + }, }) } }, [props]); + // 重置实训 const handleClickResetTpi = () => { - - var _iframe = document.getElementById("rightPaneframe"); - if(_iframe == null || _iframe == undefined || _iframe == ""){ - return; - } - _iframe.contentWindow.postMessage("stopParent", "*"); - - + stopposttpip(1) Modal.confirm({ title: '重置实训', content: ( @@ -160,7 +177,7 @@ function JupyterTPI (props) { } }, onCancel() { - _iframe.contentWindow.postMessage("clonsParent", "*"); + stopposttpip(2) }, }) } @@ -168,6 +185,7 @@ function JupyterTPI (props) { // 重置环境 const handleEnvironmentTpi = () => { + stopposttpip(1) Modal.confirm({ title: '重置环境', content: ( @@ -179,11 +197,14 @@ function JupyterTPI (props) { okText: '确定', cancelText: '取消', onOk () { - // console.log('调用重置代码....', myIdentifier); - // if (myIdentifier) { - // syncJupyterCode(myIdentifier, '重置成功'); - // } - } + console.log('调用重置代码....', myIdentifier); + if (myIdentifier) { + reset_with_tpi(myIdentifier, '重置成功'); + } + }, + onCancel() { + stopposttpip(2) + }, }) } @@ -265,14 +286,17 @@ function JupyterTPI (props) { } }, [props]); + const deadline = Date.now() + 7200 * 1000; // Moment is also OK return (
- {jupyterInfo.name}
-
+ {jupyterInfo.name}
+
+
{/* sync | poweroff */}
@@ -384,6 +408,8 @@ const mapDispatchToProps = (dispatch) => ({
getJupyterInfo: (identifier) => dispatch(actions.getJupyterInfo(identifier)),
// 重置代码
syncJupyterCode: (identifier, msg) => dispatch(actions.syncJupyterCode(identifier, msg)),
+ // 重置代码
+ reset_with_tpi: (identifier, msg) => dispatch(actions.reset_with_tpi(identifier, msg)),
getJupyterTpiDataSet: (identifier, current) => dispatch(actions.getJupyterTpiDataSet(identifier, current)),
getJupyterTpiUrl: (identifier) => dispatch(actions.getJupyterTpiUrl(identifier)),
saveJupyterTpi: () => dispatch(actions.saveJupyterTpi()),
diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss
index 76c8bedd1..2fbb0f4fd 100644
--- a/public/react/src/modules/tpm/jupyter/index.scss
+++ b/public/react/src/modules/tpm/jupyter/index.scss
@@ -159,3 +159,12 @@
}
}
+.jupytertitle_time{
+ .ant-statistic-content{
+ font-size: 20px !important;
+ }
+ .ant-statistic-content-value{
+ color:#fff !important;
+ font-size: 17px !important;
+ }
+}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index a08825936..5fcc53bd3 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -146,7 +146,7 @@ class Challengesjupyter extends Component {
window.addEventListener('message', (e) => {
- console.log("触发了jupytermessage");
+
console.log(e);
if(e){
if(e.data){
diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js
index 23647ec4a..6b8f01fa5 100644
--- a/public/react/src/redux/actions/index.js
+++ b/public/react/src/redux/actions/index.js
@@ -74,6 +74,7 @@ import {
saveJupyterTpi,
changeCurrentPage,
changeshowDrawer,
+ reset_with_tpi,
} from './jupyter';
export default {
@@ -129,6 +130,7 @@ export default {
changeGetJupyterUrlState,
saveJupyterTpi,
changeCurrentPage,
- changeshowDrawer
+ changeshowDrawer,
+ reset_with_tpi
// isUpdateCodeCtx
}
\ No newline at end of file
diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js
index 73bc30a42..22804be51 100644
--- a/public/react/src/redux/actions/jupyter.js
+++ b/public/react/src/redux/actions/jupyter.js
@@ -13,6 +13,7 @@ import {
fetchJupyterTpiUrl,
fetchJupyterInfo,
fetchSyncJupyterCode,
+ fetchreset_with_tpi,
fetchSaveJupyterTpi
} from "../../services/jupyterServer";
@@ -110,6 +111,30 @@ export const syncJupyterCode = (identifier, msg) => {
})
}
}
+
+// 重置环境
+export const reset_with_tpi = (identifier, msg) => {
+ return (dispatch,getState) => {
+ const {jupyter_info }= getState().jupyterReducer;
+ if (!jupyter_info.myshixun_identifier) return;
+ const params = {
+ identifier: jupyter_info.myshixun_identifier,
+ };
+ fetchreset_with_tpi(params).then(res => {
+ // console.log('同步代码成功: ', res);
+ if (res.data.status === 401) return;
+ if (res.status === 200) {
+ const {status} = res.data
+ if (status === 0) {
+ message.success(msg);
+ setTimeout(() => {
+ window.location.reload();
+ }, 300);
+ }
+ }
+ })
+ }
+}
// 改变状态值
export const changeGetJupyterUrlState = (status) => {
return {
diff --git a/public/react/src/services/jupyterServer.js b/public/react/src/services/jupyterServer.js
index 059aace5e..8f512d8ef 100644
--- a/public/react/src/services/jupyterServer.js
+++ b/public/react/src/services/jupyterServer.js
@@ -34,8 +34,8 @@ export async function fetchSaveJupyterTpi (params) {
return axios.get(url, { params });
}
-// 重置jupyter 保存
-// export async function reset_with_tpi (params) {
-// const url = `/jupyters/reset_with_tpi.json`;
-// return axios.get(url, { params });
-// }
\ No newline at end of file
+//重置jupyter 环境
+export async function fetchreset_with_tpi (params) {
+ const url = `/jupyters/reset_with_tpi.json`;
+ return axios.get(url, { params });
+}
\ No newline at end of file
From 7b3d81ebca32bb91faeba44d2e4ba16854c8422e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 20 Dec 2019 21:22:22 +0800
Subject: [PATCH 60/63] =?UTF-8?q?=E8=B0=83=E6=95=B4jupyter?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/jupyter.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js
index c55830c44..c79346e6d 100644
--- a/public/javascripts/jupyter.js
+++ b/public/javascripts/jupyter.js
@@ -16,7 +16,7 @@ function runEvery10Sec() {
});
window.parent.postMessage('jupytermessage','*');
if(timebool===true){
- setTimeout( runEvery10Sec, 1000 * 10 );
+ // setTimeout( runEvery10Sec, 1000 * 10 );
}
}
From e3d7ef3bca150f6b9a52ed9e1bcca45f97ce881e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 20 Dec 2019 21:22:41 +0800
Subject: [PATCH 61/63] =?UTF-8?q?=E8=B0=83=E6=95=B4jupyter?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/jupyter.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js
index c79346e6d..664fc5309 100644
--- a/public/javascripts/jupyter.js
+++ b/public/javascripts/jupyter.js
@@ -3,14 +3,14 @@
var timebool=false;
window.onload=function(){
- console.log("开始发送消息了");
+ console.log("开始发送消息了1");
timebool=true;
runEvery10Sec();
}
function runEvery10Sec() {
// 1000 * 10 = 10 秒钟
- console.log("每隔10秒中一次");
+ console.log("开始发送消息了2");
require(["base/js/namespace"],function(Jupyter) {
Jupyter.notebook.save_checkpoint();
});
From 594b39d027999e732a1d3333d71743f50c022c65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 20 Dec 2019 21:25:30 +0800
Subject: [PATCH 62/63] =?UTF-8?q?=E5=90=88=E5=B9=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index 5ae7de9ea..6a78e6e1a 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -482,7 +482,7 @@ class Challengesjupyter extends Component {
this.Importingfiles()}>导入
+ Jupyter将中断服务,是否需要延长使用时间? +
+ ), + okText: '确定', + cancelText: '取消', + onOk () { + active_with_tpi(myIdentifier, '重置成功'); + } + }) + } return (
{jupyterInfo.name}
-
@@ -391,7 +409,7 @@ const mapStateToProps = (state) => { jupyter_pagination, jupyter_identifier } = state.jupyterReducer; - const { loading ,drawervisible} = state.commonReducer; + const { loading ,drawervisible,jupytertime} = state.commonReducer; return { loading, jupyter_info, @@ -402,6 +420,7 @@ const mapStateToProps = (state) => { pagination: jupyter_pagination, jupyter_identifier, drawervisible, + jupytertime }; } @@ -418,7 +437,11 @@ const mapDispatchToProps = (dispatch) => ({ changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag)), changeCurrentPage: (current) => dispatch(actions.changeCurrentPage(current)), //展开Drawer - changeshowDrawer: (type) => dispatch(actions.changeshowDrawer(type)) + changeshowDrawer: (type) => dispatch(actions.changeshowDrawer(type)), + //倒计时增加 + addjypertime: (type) => dispatch(actions.addjypertime(type)), + //延时 + active_with_tpi:(identifier, msg) => dispatch(actions.active_with_tpi(identifier, msg)), }); export default connect( diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js index 2ef96941f..f31da4f20 100644 --- a/public/react/src/redux/actions/actionTypes.js +++ b/public/react/src/redux/actions/actionTypes.js @@ -64,6 +64,8 @@ const types = { SAVE_NOTICE_COUNT: 'SAVE_NOTICE_COUNT', // 保存代码块是否更新 AUTO_UPDATE_CODE: 'AUTO_UPDATE_CODE', // 自动更新代码 CHANGE_SHOW_DRAWER: 'CHANGE_SHOW_DRAWER', + CHANGE_JYPYTER_TIME: 'CHANGE_JYPYTER_TIME',//增加15分钟 + CHANGE_EXTENDED_TIME: 'CHANGE_EXTENDED_TIME',//延时 } export default types; diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js index 6b8f01fa5..7fe6db649 100644 --- a/public/react/src/redux/actions/index.js +++ b/public/react/src/redux/actions/index.js @@ -75,6 +75,8 @@ import { changeCurrentPage, changeshowDrawer, reset_with_tpi, + addjypertime, + active_with_tpi } from './jupyter'; export default { @@ -131,6 +133,8 @@ export default { saveJupyterTpi, changeCurrentPage, changeshowDrawer, - reset_with_tpi + reset_with_tpi, + addjypertime, + active_with_tpi, // isUpdateCodeCtx } \ No newline at end of file diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index 22804be51..ce9dcaa6b 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -14,7 +14,8 @@ import { fetchJupyterInfo, fetchSyncJupyterCode, fetchreset_with_tpi, - fetchSaveJupyterTpi + fetchSaveJupyterTpi, + fetactive_with_tpi } from "../../services/jupyterServer"; // 获取 jupyter 相关信息 @@ -135,6 +136,30 @@ export const reset_with_tpi = (identifier, msg) => { }) } } + +// 延时 +export const active_with_tpi = (identifier, msg) => { + return (dispatch,getState) => { + const {jupyter_info }= getState().jupyterReducer; + if (!jupyter_info.myshixun_identifier) return; + const params = { + identifier: jupyter_info.myshixun_identifier, + }; + fetactive_with_tpi(params).then(res => { + // console.log('同步代码成功: ', res); + if (res.data.status === 401) return; + if (res.status === 200) { + const {status} = res.data + if (status === 0) { + message.success(msg); + addjypertime(Date.now() + 900 * 1000); + } + } + }) + } +} + + // 改变状态值 export const changeGetJupyterUrlState = (status) => { return { @@ -187,4 +212,13 @@ export const changeshowDrawer = (type) => { type: types.CHANGE_SHOW_DRAWER, payload: type } -} \ No newline at end of file +} +//增加倒计时 +export const addjypertime=(time)=>{ + return { + type: types.CHANGE_JYPYTER_TIME, + payload: time + } +} + + diff --git a/public/react/src/redux/reducers/commonReducer.js b/public/react/src/redux/reducers/commonReducer.js index 4d38b75ad..82910812d 100644 --- a/public/react/src/redux/reducers/commonReducer.js +++ b/public/react/src/redux/reducers/commonReducer.js @@ -15,7 +15,8 @@ const initialState = { submitLoading: false, // 提交按钮状态 publishLoading: false, // 发布 isMySource: false, - drawervisible:false + drawervisible:false, + jupytertime:Date.now() + 3600 * 1000, } const commonReducer = (state = initialState, action) => { @@ -56,6 +57,11 @@ const commonReducer = (state = initialState, action) => { ...state, drawervisible: action.payload } + case types.CHANGE_JYPYTER_TIME: + return { + ...state, + jupytertime: action.payload + } default: return state; } diff --git a/public/react/src/services/jupyterServer.js b/public/react/src/services/jupyterServer.js index 8f512d8ef..37c86a3a2 100644 --- a/public/react/src/services/jupyterServer.js +++ b/public/react/src/services/jupyterServer.js @@ -38,4 +38,10 @@ export async function fetchSaveJupyterTpi (params) { export async function fetchreset_with_tpi (params) { const url = `/jupyters/reset_with_tpi.json`; return axios.get(url, { params }); +} + +//延时jupyter +export async function fetactive_with_tpi(params) { + const url = `/jupyters/active_with_tpi.json`; + return axios.get(url, { params }); } \ No newline at end of file