From 9ad11c5deb61aadb9e594e42b704ae1f2ad342b3 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 10:02: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/javascripts/jupyter.js | 6 ++++++ public/react/public/js/jupyter.js | 11 +++++------ .../Challenges/Challengesjupyter.js | 19 +++++++++++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index e24e06473..580b36045 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -5,3 +5,9 @@ $(function(){ console.log("educoder jupyter js init"); }) + + +$(function(){ + window.parent.postMessage('jupytermessage','需要发送的消息'); +}) + diff --git a/public/react/public/js/jupyter.js b/public/react/public/js/jupyter.js index 6e52088c3..97a0face2 100644 --- a/public/react/public/js/jupyter.js +++ b/public/react/public/js/jupyter.js @@ -10,20 +10,19 @@ // //子目标父窗口接收子窗口发送的消息 // let message = {type: 'open', link:'需要发送的消息'}; -// //子窗口向父窗口发送消息,消息中包含我们想跳转的链接 -// window.parent.postMessage(message,'需要发送的消息'); - +//子窗口向父窗口发送消息,消息中包含我们想跳转的链接 +window.parent.postMessage('jupytermessage','需要发送的消息'); + // //目标父窗口接收子窗口发送的消息 // window.addEventListener('message', (e)=>{ - // let origin = event.origin || event.originalEvent.origin; + // let origin = event.origin || event.originalEvent.origin; // if (origin !== '需要发送的消息') { - // return; + // return; // }else { // //更换iframe的src,实现iframe页面跳转 // 执行方法 // } // },false); - \ 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 d6f8c23f8..c68493163 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -229,6 +229,8 @@ class Challengesjupyter extends Component { const business = this.props&&this.props.current_user&&this.props.current_user.business?this.props.current_user.business:false; //管理员 const admin = this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; + //用户 + const login = this.props&&this.props.current_user&&this.props.current_user.login?this.props.current_user.login:""; let mysidentity =false; try { @@ -409,10 +411,19 @@ class Challengesjupyter extends Component { :"" ) : - + ( + login==="innov"? + + : + + ) + }