Merge branch 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

chromesetting
杨树林 5 years ago
commit 2bf80316e9

@ -9,7 +9,6 @@ window.onload=function(){
} }
function runEvery10Sec() { function runEvery10Sec() {
// 1000 * 10 = 10 秒钟 // 1000 * 10 = 10 秒钟
console.log("每隔10秒中一次"); console.log("每隔10秒中一次");
require(["base/js/namespace"],function(Jupyter) { require(["base/js/namespace"],function(Jupyter) {
@ -26,32 +25,27 @@ $(function(){
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){
e.preventDefault(); e.preventDefault();
console.log("点击了ctrl+s"); console.log("ctrl+s");
console.log("开始发送消息了ctrl+s");
window.parent.postMessage('jupytermessage','*'); window.parent.postMessage('jupytermessage','*');
} }
}); });
})
$(function(){
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
console.log("触发了Parentwindow");
console.log(e);
if(e){ if(e){
if(e.data){ if(e.data){
if(e.data==="Parentwindow"){ if(e.data==="stopParent"){
//重置停止 //重置停止
timebool=false; timebool=false;
console.log("父窗口调我了重置停止"); console.log("父窗口调停止");
}else if(e.data==="cancelwindow"){ }else if(e.data==="clonsParent"){
console.log("父窗口调我了取消启动"); console.log("父窗口调启动");
//取消启动 //取消启动
timebool=true; timebool=true;
this.runEvery10Sec(); runEvery10Sec();
} }
} }
} }
}); });
}) })

@ -135,6 +135,14 @@ function JupyterTPI (props) {
// 重置实训 // 重置实训
const handleClickResetTpi = () => { const handleClickResetTpi = () => {
var _iframe = document.getElementById("rightPaneframe");
if(_iframe == null || _iframe == undefined || _iframe == ""){
return;
}
_iframe.contentWindow.postMessage("stopParent", "*");
Modal.confirm({ Modal.confirm({
title: '重置实训', title: '重置实训',
content: ( content: (
@ -150,7 +158,10 @@ function JupyterTPI (props) {
if (myIdentifier) { if (myIdentifier) {
syncJupyterCode(myIdentifier, '重置成功'); syncJupyterCode(myIdentifier, '重置成功');
} }
} },
onCancel() {
_iframe.contentWindow.postMessage("clonsParent", "*");
},
}) })
} }

@ -57,7 +57,8 @@ function RightPane (props) {
<div className="jupyter_result"> <div className="jupyter_result">
<div className="jupyter_iframe"> <div className="jupyter_iframe">
<iframe <iframe
id={"rightPaneframe"}
title=" " title=" "
width="100%" width="100%"
height="100%" height="100%"

Loading…
Cancel
Save