chromesetting
杨树林 5 years ago
parent 7fca3f2e87
commit a44e06b506

@ -8,7 +8,7 @@ import '../shixunchildCss/Challenges.css';
import axios from 'axios'; import axios from 'axios';
const $ = window.$; const $ = window.$;
//12.20,14:11
class Challengesjupyter extends Component { class Challengesjupyter extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -48,54 +48,33 @@ class Challengesjupyter extends Component {
isopentitletype:"Less", isopentitletype:"Less",
}) })
} }
this.getjianjiesize()
} }
} }
}).catch((error) => { }).catch((error) => {
//console.log(error) //console.log(error)
}); });
} }
componentDidUpdate = (prevProps,prevState) => {
//防止陷入无限循环
getjianjiesize=()=>{ if(prevState.ChallengesDataList!=this.state.ChallengesDataList){
let {ChallengesDataList}=this.state;
let boxoffsetHeigh; let boxoffsetHeigh;
let box=document.getElementById("shixunchallengesid"); let box=document.getElementById("shixunchallengesid");
if(box){ if(box){
boxoffsetHeigh=box.offsetHeight boxoffsetHeigh=box.offsetHeight
if(ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined){ if(boxoffsetHeigh<300){
}else{
if(this.state.isopentitletype==="greater"){
}else{
if(boxoffsetHeigh>=300){
this.setState({ this.setState({
opentitletype:true, isopentitletype:"Less",
isopentitletype:"greater",
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
}else{ }else{
this.setState({ this.setState({
isopentitletype:"Less", isopentitletype:"greater",
opentitletype:true,
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
} }
}
}
}
}
componentDidUpdate = (prevProps,prevState) => {
//防止陷入无限循环
if(prevState.ChallengesDataList!=this.state.ChallengesDataList){
if(this.state.isopentitletype==="greater"){
}else{
this.getjianjiesize()
} }
} }
@ -145,10 +124,6 @@ class Challengesjupyter extends Component {
}, 600) }, 600)
}); });
setTimeout(this.getjianjiesize(), 1000);
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
console.log("触发了jupytermessage"); console.log("触发了jupytermessage");
@ -163,8 +138,6 @@ class Challengesjupyter extends Component {
} }
}); });
setTimeout(this.getjianjiesize(), 1000);
} }
updatamakedowns = () => { updatamakedowns = () => {
@ -234,7 +207,6 @@ 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) => {
}) })
@ -245,15 +217,12 @@ class Challengesjupyter extends Component {
opentitletype:!this.state.opentitletype opentitletype:!this.state.opentitletype
}) })
} }
onclki=(bool)=>{ onclki=(bool)=>{
this.setState({ this.setState({
enlarge:bool enlarge:bool
}) })
} }
render() { render() {
let{ChallengesDataList,booljupyterurls,enlarge}=this.state; let{ChallengesDataList,booljupyterurls,enlarge}=this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
@ -263,8 +232,6 @@ 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 {
@ -286,19 +253,7 @@ class Challengesjupyter extends Component {
</a> </a>
</Tooltip> </Tooltip>
</div> </div>
{this.state.opentitletype===true?<style>
<div>
<style>
{
`
.markdown-body img{
min-height: 200px;
}
`
}
</style>
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?<style>
{ {
` `
#shixunchallengesid{ #shixunchallengesid{
@ -308,17 +263,7 @@ class Challengesjupyter extends Component {
` `
} }
</style>:""} </style>:""}
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?"":this.state.isopentitletype==="greater"&&this.state.opentitletype===true? <div>
<style>
{
`
#shixunchallengesid{
max-height:260px;
overflow: hidden;
}
`
}
</style>:""}
<div className={"pd20"} id={"shixunchallengesid"}> <div className={"pd20"} id={"shixunchallengesid"}>
<p id="ReactMarkdown" style={{overflow:'hidden'}}> <p id="ReactMarkdown" style={{overflow:'hidden'}}>
@ -385,7 +330,6 @@ class Challengesjupyter extends Component {
display: flex; display: flex;
flex-direction:row-reverse; flex-direction:row-reverse;
} }
; ;
} }
` `
@ -397,7 +341,9 @@ 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 className={enlarge?"shixunjianjiecballenges edu-back-white intermediatecenter fangdaone":"shixunjianjiecballenges edu-back-white mt20"}>
<div className={"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>
@ -413,11 +359,13 @@ class Challengesjupyter extends Component {
marginLeft: '30px', marginLeft: '30px',
}} onClick={()=>this.onclki(true)}></i> }} onClick={()=>this.onclki(true)}></i>
} }
{/*<div className="challenbaocun" ><p*/} {/*<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p*/}
{/* className="challenbaocuntest">导入</p>*/} {/* className="challenbaocuntest">导入</p>*/}
{/*</div>*/} {/*</div>*/}
</div> </div>
</div> </div>
</div>
: :
"" ""
) )

Loading…
Cancel
Save