Merge remote-tracking branch 'origin/ysm_jupyter' into ysm_jupyter

chromesetting
杨树明 5 years ago
commit 270ccba3fd

@ -5,3 +5,9 @@
$(function(){ $(function(){
console.log("educoder jupyter js init"); console.log("educoder jupyter js init");
}) })
$(function(){
window.parent.postMessage('jupytermessage','需要发送的消息');
})

File diff suppressed because one or more lines are too long

@ -10,20 +10,19 @@
// //子目标父窗口接收子窗口发送的消息 // //子目标父窗口接收子窗口发送的消息
// let message = {type: 'open', link:'需要发送的消息'}; // let message = {type: 'open', link:'需要发送的消息'};
// //子窗口向父窗口发送消息,消息中包含我们想跳转的链接 //子窗口向父窗口发送消息,消息中包含我们想跳转的链接
// window.parent.postMessage(message,'需要发送的消息'); window.parent.postMessage('jupytermessage','需要发送的消息');
// //目标父窗口接收子窗口发送的消息 // //目标父窗口接收子窗口发送的消息
// window.addEventListener('message', (e)=>{ // window.addEventListener('message', (e)=>{
// let origin = event.origin || event.originalEvent.origin; // let origin = event.origin || event.originalEvent.origin;
// if (origin !== '需要发送的消息') { // if (origin !== '需要发送的消息') {
// return; // return;
// }else { // }else {
// //更换iframe的src,实现iframe页面跳转 // //更换iframe的src,实现iframe页面跳转
// 执行方法 // 执行方法
// } // }
// },false); // },false);

@ -25,6 +25,7 @@ class Challengesjupyter extends Component {
boxoffsetHeigh:0, boxoffsetHeigh:0,
opentitletype:true, opentitletype:true,
isopentitletype:"Less", isopentitletype:"Less",
enlarge:false,
} }
} }
@ -79,6 +80,7 @@ class Challengesjupyter extends Component {
} }
componentDidMount() { componentDidMount() {
var that=this;
setTimeout(this.ChallengesList(), 1000); setTimeout(this.ChallengesList(), 1000);
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`; let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
@ -122,6 +124,14 @@ class Challengesjupyter extends Component {
}, 600) }, 600)
}); });
window.addEventListener('jupytermessage', (e) => {
console.log("触发了jupytermessage");
console.log("触发了jupytermessage");
that.modifyjupyter();
});
} }
updatamakedowns = () => { updatamakedowns = () => {
@ -191,6 +201,7 @@ class Challengesjupyter extends Component {
.then((result) => { .then((result) => {
if (result.data.status === 0) { if (result.data.status === 0) {
this.props.showNotification(`应用成功`); this.props.showNotification(`应用成功`);
console.log("触发了jupytermessage调用了应用成功");
} }
}).catch((error) => { }).catch((error) => {
}) })
@ -202,9 +213,15 @@ class Challengesjupyter extends Component {
}) })
} }
onclki=(bool)=>{
this.setState({
enlarge:bool
})
}
render() { render() {
let{ChallengesDataList,booljupyterurls}=this.state; let{ChallengesDataList,booljupyterurls,enlarge}=this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
//老师 //老师
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
@ -212,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 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 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; let mysidentity =false;
try { try {
@ -310,8 +329,9 @@ class Challengesjupyter extends Component {
display: flex; display: flex;
flex-direction:row-reverse; flex-direction:row-reverse;
} }
; ;
} }
` `
} }
</style> </style>
@ -321,16 +341,33 @@ class Challengesjupyter extends Component {
: :
( (
admin===true||business===true||mysidentity===true? admin===true||business===true||mysidentity===true?
<div className={"shixunjianjiecballenges edu-back-white sortinxdirection mt20"}> <div style={{
height: '63px',
}} className={enlarge?"shixunjianjiecballenges edu-back-white intermediatecenter fangdaone":"shixunjianjiecballenges edu-back-white mt20"}>
<div className={enlarge?"sortinxdirection jupyterswidth":"sortinxdirection"} >
<div className="renwuxiangssi sortinxdirection"> <div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdiv">任务详情</p></div>
<div><p className="renwuxiangqdivtest ml1 shixunbingbaocun">请将实训题目写在下方并保存</p></div> <div><p className="renwuxiangqdivtest ml1 shixunbingbaocun">请将实训题目写在下方并保存</p></div>
</div> </div>
<div className="renwuxiangssit xaxisreverseorder"> <div className="renwuxiangssit xaxisreverseorder">
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p {
className="challenbaocuntest">应用到实训</p></div> enlarge===true?
<i className="iconfont icon-suoxiao2 font-20 ml2 ysliconfont" style={{
marginLeft: '30px',
}} onClick={()=>this.onclki(false)}></i>
:
<i className="iconfont icon-fangda font-20 ml2 ysliconfont" style={{
marginLeft: '30px',
}} onClick={()=>this.onclki(true)}></i>
}
<div className="challenbaocun" ><p
className="challenbaocuntest">导入</p>
</div>
</div> </div>
</div> </div>
</div>
: :
"" ""
) )
@ -365,7 +402,7 @@ class Challengesjupyter extends Component {
{ {
admin===true||business===true||mysidentity===true? admin===true||business===true||mysidentity===true?
<div> <div>
<div className="pb47"> <div className={"pb47"}>
{ {
this.state.jupyter_url===null || this.state.jupyter_url===undefined? this.state.jupyter_url===null || this.state.jupyter_url===undefined?
( (
@ -374,10 +411,19 @@ class Challengesjupyter extends Component {
:"" :""
) )
: :
<iframe src={this.state.jupyter_url} (
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" login==="innov"?
name="framename" width="100%" height="700" frameBorder="0" <iframe src={"http://121.41.4.83:46666/notebooks/root/work/01.ipynb"} className={enlarge?"fangdatwo":""}
></iframe> sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe>
:
<iframe src={this.state.jupyter_url} className={enlarge?"fangdatwo":""}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe>
)
} }
</div> </div>
</div> </div>

@ -27,14 +27,14 @@
line-height: 25px; line-height: 25px;
} }
.challenbaocun{ .challenbaocun{
width:103px; width:60px;
height:30px; height:30px;
background:#29BD8B; background:#29BD8B;
border-radius:3px; border-radius:3px;
cursor:pointer cursor:pointer
} }
.challenbaocuntest{ .challenbaocuntest{
width:103px; width:60px;
height:30px; height:30px;
font-size:16px; font-size:16px;
color:#FFFFFF; color:#FFFFFF;
@ -185,4 +185,33 @@
.icon-shanchu_Hover:hover{ .icon-shanchu_Hover:hover{
color:rgb(255, 85, 85) !important; color:rgb(255, 85, 85) !important;
} }
.ysliconfont{
text-align: center;
line-height: 30px;
}
.fangdaone{
height: 63px;
width: 100%;
position: fixed;
top: 0px;
left: 0px;
z-index: 999999;
right: 0px;
}
.fangdatwo{
height: 100%;
width: 100%;
position: fixed;
top:0px;
margin-top: 63px;
bottom: 0px;
left: 0px;
z-index: 999999;
right: 0px;
}
.jupyterswidth{
width: 1140px;
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save