|
|
|
@ -59,7 +59,7 @@ class Challenges extends Component {
|
|
|
|
|
isopentitletype:"Less",
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getjianjiesize()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -67,31 +67,54 @@ class Challenges extends Component {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getjianjiesize=()=>{
|
|
|
|
|
let {ChallengesDataList}=this.state;
|
|
|
|
|
let boxoffsetHeigh;
|
|
|
|
|
let box=document.getElementById("shixunchallengesid");
|
|
|
|
|
|
|
|
|
|
if(box){
|
|
|
|
|
boxoffsetHeigh=box.offsetHeight
|
|
|
|
|
if(ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
if(this.state.isopentitletype==="greater"){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
if(boxoffsetHeigh>=300){
|
|
|
|
|
this.setState({
|
|
|
|
|
opentitletype:true,
|
|
|
|
|
isopentitletype:"greater",
|
|
|
|
|
boxoffsetHeigh:boxoffsetHeigh
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
isopentitletype:"Less",
|
|
|
|
|
boxoffsetHeigh:boxoffsetHeigh
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
this.ChallengesList()
|
|
|
|
|
if(this.state.isopentitletype==="greater"){
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
this.ChallengesList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate = (prevProps,prevState) => {
|
|
|
|
|
|
|
|
|
|
//防止陷入无限循环
|
|
|
|
|
if(prevState.ChallengesDataList!=this.state.ChallengesDataList){
|
|
|
|
|
let boxoffsetHeigh;
|
|
|
|
|
let box=document.getElementById("shixunchallengesid");
|
|
|
|
|
if(box){
|
|
|
|
|
boxoffsetHeigh=box.offsetHeight
|
|
|
|
|
if(boxoffsetHeigh<300){
|
|
|
|
|
this.setState({
|
|
|
|
|
isopentitletype:"Less",
|
|
|
|
|
boxoffsetHeigh:boxoffsetHeigh
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
opentitletype:true,
|
|
|
|
|
isopentitletype:"greater",
|
|
|
|
|
boxoffsetHeigh:boxoffsetHeigh
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
console.log(boxoffsetHeigh)
|
|
|
|
|
if(this.state.isopentitletype==="greater"){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
this.getjianjiesize()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -333,7 +356,6 @@ class Challenges extends Component {
|
|
|
|
|
opentitle=()=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
opentitletype:!this.state.opentitletype,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -415,16 +437,7 @@ class Challenges extends Component {
|
|
|
|
|
this.props.identity < 5?<a className="fr font-14 color-blue mr20" href="/forums/2943"
|
|
|
|
|
target="_blank">实训制作指南</a> : "":""}
|
|
|
|
|
</div>
|
|
|
|
|
{this.state.opentitletype===true?<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
#shixunchallengesid{
|
|
|
|
|
max-height: 300px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>:""}
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<div className={"pd20"} id={"shixunchallengesid"}>
|
|
|
|
|
<style>
|
|
|
|
@ -436,6 +449,40 @@ class Challenges extends Component {
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.markdown-body img{
|
|
|
|
|
min-height: 200px;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
#shixunchallengesid{
|
|
|
|
|
max-height: 300px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>:""}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?"":this.state.isopentitletype==="greater"&&this.state.opentitletype===true?
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
#shixunchallengesid{
|
|
|
|
|
max-height:260px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>:""}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="justify break_full_word new_li "
|
|
|
|
|
id="challenge_editorMd_description">
|
|
|
|
|