|
|
|
@ -75,11 +75,30 @@ function JupyterTPI (props) {
|
|
|
|
|
const [updateTip, setUpdateTip] = useState(true);
|
|
|
|
|
const [myIdentifier, setMyIdentifier] = useState('');
|
|
|
|
|
const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
|
|
|
|
|
|
|
|
|
|
// 保存代码
|
|
|
|
|
const addEventListeners = () => {
|
|
|
|
|
window.addEventListener('message', (e) => {
|
|
|
|
|
console.log("触发了jupytermessage");
|
|
|
|
|
if(e){
|
|
|
|
|
if(e.data){
|
|
|
|
|
if(e.data==="jupytermessage"){
|
|
|
|
|
saveJupyterTpi();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
/* 先调用 jupyter的 TPI 接口,
|
|
|
|
|
* 获取 用户信息,
|
|
|
|
|
* 实训的 identifier, 状态, 名称, 是否被修改等信息
|
|
|
|
|
*/
|
|
|
|
|
addEventListeners()
|
|
|
|
|
getJupyterInfo(identifier);
|
|
|
|
|
}, [identifier]);
|
|
|
|
|
|
|
|
|
@ -234,6 +253,8 @@ function JupyterTPI (props) {
|
|
|
|
|
setRenderCtx(oUl);
|
|
|
|
|
}
|
|
|
|
|
}, [props]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="jupyter_area">
|
|
|
|
|
<div className="jupyter_header">
|
|
|
|
|