diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index 9b20e5157..dc70ee1ca 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -30,7 +30,9 @@ class Challengesjupyter extends Component {
ChallengesDataList: undefined,
operate: true,
startbtns: false,
- iFrameHeight: '0px'
+ iFrameHeight: '0px',
+ jupyter_port:0,
+ jupyter_url:null,
}
}
@@ -57,23 +59,13 @@ class Challengesjupyter extends Component {
componentDidMount() {
setTimeout(this.ChallengesList(), 1000);
- // var iframe =
- // document.getElementById('ifr1');
- // console.log("iframe||||||||");
- // console.log(iframe);
- // if(iframe){
- // // var headertest=test.contentWindow.document.getElementById('header');
- // // console.log(headertest);
- // var iwindow = iframe.contentWindow;
- // var idoc = iwindow.document;
- // console.log("window",iwindow);//获取iframe的window对象
- // console.log("windowwindow",iwindow.document.getElementById('header'));//获取iwindow.document对象
- // console.log("document",idoc); //获取iframe的document
- // console.log("documentdocument",idoc.getElementById('header'));
- // console.log("html",idoc.documentElement);//获取iframe的html
- // console.log("head",idoc.head); //获取head
- // console.log("body",idoc.body); //获取body
- // }
+
+
+ console.log("componentDidMount");
+ console.log("Challengesjupyter");
+ console.log(this.props);
+
+
}
@@ -129,114 +121,32 @@ class Challengesjupyter extends Component {
};
- modifyjupyter=()=>{
- // var ifr =window.parent.frames["frame"].document;
- // console.log(ifr);
- // var data = JSON.stringify({
- //
- // 'location': window.location
- //
- // // etc
- //
- // });
- // let parentDomain = window.location.hostname;
- // console.log("domain",parentDomain); //localhost
- // document.domain = data;
- // document.domain = 'https://47519.test-jupyter.educoder.net';
- // window.parent.document.contents().find("#ifr1")[0].contentWindow.iframefunction();
- const iframe = document.getElementById('iframe');
- console.log("modifyjupyter");
- // const frameWindow = iframe.contentWindow;
- const frameWindow = iframe.contentWindow.postMessage('setLocation,' + null + "," + null, '*');
- console.log(frameWindow);
- const frameDocument = frameWindow.document;
- console.log(frameDocument);
-
- // window.addEventListener('load', () => {
- // console.log('12313页面加载好了');
- // const iframe = document.getElementById('ifr1');
- // if (iframe && iframe.contentWindow && this.props.iframe_src) {
- // console.log('32131231yes mounted');
- // console.log(iframe.contentWindow);
- // } else {
- // console.log('3242242not mounted')
- // }
- // });
-
- // var editor;
- // editor = document.getElementById("ifr1").contentWindow;
- // console.log(editor);
-
-
-
- // window.onload = () => {
- // var testwindow =
- // document.getElementById('ifr1').contentWindow;
- //
- // }
-
-
-
-
- // var iframe=window.frames["ifr1"];
- // // var title =${'ifr1'}
- // console.log("iframe");
- // console.log(iframe);
- // var frames = window.frames; // 或 // var frames = window.parent.frames;
- // for (var i = 0; i < frames.length; i++) {
- // // 在这对frames的一个frame做点什么
- // // frames[i].document.body.style.background = "red";
- // console.log(frames[i]);
- //
- // }
- // var idoc = iframe.document;
- // console.log(idoc);
- // var iwindow = title.contentWindow;
- // console.log("iwindow");
- // console.log(iwindow);
- // var idoc = iwindow.document;
- // console.log(idoc);
- // window.addEventListener('message', receiveMessageFromParent, false);
- //
- // let messageButton = document.getElementById('message_button');
- // /* console.log('msg button', messageButton); annoataion cannot use \/\/ */
- // messageButton.addEventListener('click', function (e) {
- // console.log('iframe send msg');
- // console.log('parent', window.parent);
- // console.log('top container', window.top);
- // window.parent.postMessage('This is child', '*');
- // }, false);
-
-
-
-
-
-
- // var iframe = $('#ifr1');
- // console.log(iframe.context.find('#save-notbook'));
- // console.log("iframe");
- // console.log(iframe)
- // title.window.say(); //myFrame.say();也可
- //
- // title.window.document.getElementById("button").value="保存并检查";
- //find button inside iframe
- // let button = iframe.contents().find('#save-notbook');
- // //trigger button click
- // button.trigger("click");
- // console.log("iframe||||||||");
- // if(iframe){
- // var iwindow = iframe.contentWindow;
- // var idoc = iwindow.document;
- // console.log("window",iwindow);//获取iframe的window对象
- // console.log("document",idoc); //获取iframe的document
- // console.log("html",idoc.documentElement);//获取iframe的html
- // console.log("head",idoc.head); //获取head
- // console.log("body",idoc.body); //获取body
- // }
- // var test =
- // document.getElementById('ifr1').contentWindow.document.getElementById('header');
- // test.style.background = "#333";
+ modifyjupyter=(propsysl)=>{
+ console.log("propsysl");
+ console.log(propsysl);
+ let id=this.props.match.params.shixunId;
+
+ const url=`/shixuns/${id}/update_jupyter.json`;
+ const data={
+ identifier:id,
+ jupyter_port:propsysl.shixunsDetails.jupyter_port
+ }
+ axios.post(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`应用成功`);
+ }
+ }).catch((error) => {
+ })
+ }
+ sendToken=()=>{
+ // console.log("sendToken");
+ // const iframe = document.getElementById('iframe');
+ // console.log("modifyjupyter");
+ // const frameWindow = iframe.contentWindow;
+ // console.log("frameWindow");
+ // console.log(frameWindow);
}
render() {
@@ -316,7 +226,7 @@ class Challengesjupyter extends Component {
-
+
this.modifyjupyter(this.props)}>
应用到实训
{data === undefined ? "" : data.map((item, key) => {
return (
@@ -195,14 +207,19 @@ class SearchPage extends Component{
{/*标题*/}
+
+
{
type==="shixun"?
-
+ (
+ item.is_jupyter===true?
+
+ :""
+ )
:""
}
-
{/*描述*/}
@@ -368,7 +385,7 @@ class SearchPage extends Component{
{
count && count && count> perpages ?
-