diff --git a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js index cccaa3ca4..68a16d89e 100644 --- a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js +++ b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js @@ -86,7 +86,7 @@ class WorkDetailPageHeader extends Component{ background: #fff; } .workDetailPageHeader .summaryname { - line-height:30px + line-height:28px } `} { if (visible) { - this.setState({school_name: this.props.user.user_school},()=>{ + this.setState({ + school_name: this.props.user.user_school, + name: undefined + },()=>{ this.fetchMemberList(); }) this.fetchOptions() @@ -88,7 +91,7 @@ class AddStudentModal extends Component{ this.refs.modalWrapper.setVisible(visible) if (visible == false) { this.setState({ - checkBoxValues: [] + checkBoxValues: [], }) } } diff --git a/public/react/src/modules/page/main/CodeRepositoryView.js b/public/react/src/modules/page/main/CodeRepositoryView.js index fc10a31dd..ee2017ab3 100644 --- a/public/react/src/modules/page/main/CodeRepositoryView.js +++ b/public/react/src/modules/page/main/CodeRepositoryView.js @@ -40,8 +40,9 @@ class CodeRepositoryView extends Component { constructor(props) { super(props); + this.treeExpanded = false; this.state = { - autoExpandParent: true, + autoExpandParent: false, expandedKeys: [], addtionalSSHArray: [], @@ -52,24 +53,28 @@ class CodeRepositoryView extends Component { const { game, challenge, hide_code, tabIndex, } = this.props if ( // 初始化 或者 game切换 - challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 || + !this.treeExpanded && challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 || game && (!prevProps.game || prevProps.game.identifier !== this.props.game.identifier) ) { - const _path = challenge.multiPath ? challenge.path[0] : challenge.path; - let _ar = []; - const expandedKeys = []; - if (_path) { - _ar = _path.split('/') - _ar.length = _ar.length - 1 - _ar.forEach( (item, index) => { - expandedKeys.push( index === 0 ? item : expandedKeys[index - 1] + '/' + item) + + if (!this.treeExpanded) { + this.treeExpanded = true + const _path = challenge.multiPath ? challenge.path[0] : challenge.path; + let _ar = []; + const expandedKeys = []; + if (_path) { + _ar = _path.split('/') + _ar.length = _ar.length - 1 + _ar.forEach( (item, index) => { + expandedKeys.push( index === 0 ? item : expandedKeys[index - 1] + '/' + item) + }) + } + expandedKeys.length = 1 // 没办法做到多级初始化,而且会引起点击其他子目录,加载当前文件目录的问题 + // 初始化时无法展开到根节点 https://github.com/fis-components/rc-tree/issues/3 + expandedKeys.length && this.setState({ + expandedKeys, }) } - expandedKeys.length = 1 // 没办法做到多级初始化 - // 初始化时无法展开到根节点 https://github.com/fis-components/rc-tree/issues/3 - expandedKeys.length && this.setState({ - expandedKeys, - }) if (game && (!prevProps.game || prevProps.game.identifier !== this.props.game.identifier)) { diff --git a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js index b4d9c4fcf..279402e66 100644 --- a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js +++ b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js @@ -191,6 +191,10 @@ class CodeRepositoryViewContainer extends Component { // withCredentials: true, }) .then((response) => { + // if (!response) { + // resolve && resolve(); + // return; + // } const repoFilesData = this.map2OldData(response.data.trees) if (!this.state.fileTreeData || this.state.fileTreeData.length === 0) { // 还没树节点,没加载过