diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index 67c81381c..6f723e660 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -261,7 +261,7 @@ class Osshackathon extends Component { } -
+
{ + + //防止陷入无限循环 + if(prevState.ChallengesDataList!=this.state.ChallengesDataList){ + let boxoffsetHeigh; + let box=document.getElementById("shixunchallengesid"); + if(box){ + boxoffsetHeigh=box.offsetHeight + if(boxoffsetHeigh<260){ + this.setState({ + opentitletype:false, + boxoffsetHeigh:boxoffsetHeigh + }) + }else{ + this.setState({ + boxoffsetHeigh:boxoffsetHeigh + }) + } + + } + } + } updatamakedown = (id) => { setTimeout(() => { var shixunDescr = window.editormd.markdownToHTML(id, { @@ -301,6 +320,12 @@ class Challenges extends Component { }) } + opentitle=()=>{ + this.setState({ + opentitletype:!this.state.opentitletype + }) + } + render() { let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue,AccountProfiletype} = this.state; let { loadingContent } = this.props; @@ -378,8 +403,18 @@ class Challenges extends Component { this.props.identity < 5?实训制作指南 : "":""}
- -
+ {this.state.opentitletype===true?:""} +
+
+

@@ -397,6 +433,13 @@ class Challenges extends Component { }

+
+ {this.state.opentitletype===true?this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> + 阅读全文 + :this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> + 收起全文 + } +

diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 04a52a61e..fcdbed408 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -1,25 +1,11 @@ import React, { Component } from 'react'; - -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames'; - -import { getImageUrl ,markdownToHTML, configShareForCustom} from 'educoder' - -import { CircularProgress } from 'material-ui/Progress'; - -import { Modal, Spin, Tooltip ,message,Icon} from 'antd'; +import { Link } from "react-router-dom"; +import { markdownToHTML, configShareForCustom} from 'educoder' +import { Divider, Tooltip } from 'antd'; import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; - -import '../shixunchildCss/Challenges.css' -import ReactDOM from 'react-dom'; +import '../shixunchildCss/Challenges.css'; import axios from 'axios'; -import AccountProfile from"../../../user/AccountProfile"; const $ = window.$; @@ -36,6 +22,8 @@ class Challengesjupyter extends Component { username:"", booljupyterurls:false, loading:false, + boxoffsetHeigh:0, + opentitletype:true } } @@ -59,7 +47,29 @@ class Challengesjupyter extends Component { //console.log(error) }); } + componentDidUpdate = (prevProps,prevState) => { + + //防止陷入无限循环 + if(prevState.ChallengesDataList!=this.state.ChallengesDataList){ + let boxoffsetHeigh; + let box=document.getElementById("shixunchallengesid"); + if(box){ + boxoffsetHeigh=box.offsetHeight + if(boxoffsetHeigh<260){ + this.setState({ + opentitletype:false, + boxoffsetHeigh:boxoffsetHeigh + }) + }else{ + this.setState({ + boxoffsetHeigh:boxoffsetHeigh + }) + } + } + } + + } componentDidMount() { setTimeout(this.ChallengesList(), 1000); let id = this.props.match.params.shixunId; @@ -178,6 +188,11 @@ class Challengesjupyter extends Component { }) } + opentitle=()=>{ + this.setState({ + opentitletype:!this.state.opentitletype + }) + } render() { @@ -204,33 +219,53 @@ class Challengesjupyter extends Component {
简介 - + 编辑 - +
-
-

- {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": -

- } -

+ {this.state.opentitletype===true?:""} +
-
+
+

+ {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": +

+ } +

+ { + booljupyterurls===true? + ( + this.state.jupyter_url === null? +
+ +

加载实训失败,

this.updatamakedowns()}>重新加载

+ +
+ + :"" + ) + :"" + } +
- :"" - ) - :"" - } + {this.state.opentitletype===true?this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> + 阅读全文 + :this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> + 收起全文 + }
+