diff --git a/public/react/src/modules/tpm/Audit_situationComponent.js b/public/react/src/modules/tpm/Audit_situationComponent.js index 4d6c413da..3739cd6db 100644 --- a/public/react/src/modules/tpm/Audit_situationComponent.js +++ b/public/react/src/modules/tpm/Audit_situationComponent.js @@ -212,6 +212,7 @@ class Audit_situationComponent extends Component { user={user} shixun={shixun} {...this.props} + is_jupyter={this.props.is_jupyter} >
diff --git a/public/react/src/modules/tpm/TPMChallenge.js b/public/react/src/modules/tpm/TPMChallenge.js index 630a233fd..5c6e1a16a 100644 --- a/public/react/src/modules/tpm/TPMChallenge.js +++ b/public/react/src/modules/tpm/TPMChallenge.js @@ -20,7 +20,7 @@ class TPMChallenge extends Component { } render() { - const { loadingContent, shixun, user, match,jupyterbool + const { loadingContent, shixun, user, match,jupyterbool,is_jupyter } = this.props; return ( @@ -32,13 +32,15 @@ class TPMChallenge extends Component { user={user} shixun={shixun} {...this.props} + is_jupyter={this.props.is_jupyter} > { - jupyterbool===true? + is_jupyter===true? - : } diff --git a/public/react/src/modules/tpm/TPMChallengeContainer.js b/public/react/src/modules/tpm/TPMChallengeContainer.js index a7c3c8a2b..9fc1f44f4 100644 --- a/public/react/src/modules/tpm/TPMChallengeContainer.js +++ b/public/react/src/modules/tpm/TPMChallengeContainer.js @@ -15,13 +15,16 @@ class TPMChallengeContainer extends Component { render() { const { tpmLoading } = this.props; const user = this.props.current_user; + // console.log("TPMChallengeContainerTPMChallengeContainer"); + // console.log(this.props); - return ( + return ( { tpmLoading ?
: } diff --git a/public/react/src/modules/tpm/TPMCollaborators.js b/public/react/src/modules/tpm/TPMCollaborators.js index cfab39ca5..3b1bdb181 100644 --- a/public/react/src/modules/tpm/TPMCollaborators.js +++ b/public/react/src/modules/tpm/TPMCollaborators.js @@ -1,53 +1,54 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import Collaborators from './shixunchild/Collaborators/Collaborators' -import TPMRightSection from './component/TPMRightSection' -import TPMNav from './component/TPMNav' - -class TPMCollaborators extends Component { - constructor(props) { - super(props) - } - - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - return ( - -
- -
- - - -
- -
- -
-
-
- - ); - } -} - -export default TPMCollaborators; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import Collaborators from './shixunchild/Collaborators/Collaborators' +import TPMRightSection from './component/TPMRightSection' +import TPMNav from './component/TPMNav' + +class TPMCollaborators extends Component { + constructor(props) { + super(props) + } + + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + return ( + +
+ +
+ + + +
+ +
+ +
+
+
+ + ); + } +} + +export default TPMCollaborators; diff --git a/public/react/src/modules/tpm/TPMCollaboratorsContainer.js b/public/react/src/modules/tpm/TPMCollaboratorsContainer.js index 80049cee9..61b9bd2ec 100644 --- a/public/react/src/modules/tpm/TPMCollaboratorsContainer.js +++ b/public/react/src/modules/tpm/TPMCollaboratorsContainer.js @@ -1,47 +1,47 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMCollaborators from './TPMCollaborators' - -import axios from 'axios'; - -class TPMChallengeContainer extends Component { - constructor(props) { - super(props) - this.state = { - } - } - - componentWillReceiveProps(newProps, newContext) { - - } - - componentDidMount() { - // this.props.showShixun(); - } - - - - render() { - const { tpmLoading } = this.props; - const user = this.props.current_user; - return ( - - { tpmLoading ?
: - - - } -
- ); - } -} - -export default TPMChallengeContainer; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMCollaborators from './TPMCollaborators' + +import axios from 'axios'; + +class TPMChallengeContainer extends Component { + constructor(props) { + super(props) + this.state = { + } + } + + componentWillReceiveProps(newProps, newContext) { + + } + + componentDidMount() { + // this.props.showShixun(); + } + + + + render() { + const { tpmLoading } = this.props; + const user = this.props.current_user; + return ( + + { tpmLoading ?
: + + + } +
+ ); + } +} + +export default TPMChallengeContainer; diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index 643118107..897fbe221 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -103,8 +103,8 @@ class TPMDataset extends Component { selectedRowKeysdata:mydata, selectedRowKeys: datas, }) - console.log(mydata); - console.log(datas); + // console.log(mydata); + // console.log(datas); } else { @@ -237,6 +237,7 @@ class TPMDataset extends Component { // 附件相关 START handleChange = (info) => { + debugger if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { let {fileList} = this.state; @@ -256,6 +257,7 @@ class TPMDataset extends Component { } onAttachmentRemove = (file) => { + debugger if(!file.percent || file.percent == 100){ confirm({ title: '确定要删除这个附件吗?', @@ -357,7 +359,7 @@ class TPMDataset extends Component { onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file, fileList) => { - + debugger if (this.state.fileList.length >= 1) { return false } @@ -400,6 +402,7 @@ class TPMDataset extends Component { user={user} shixun={shixun} {...this.props} + is_jupyter={this.props.is_jupyter} >
diff --git a/public/react/src/modules/tpm/TPMFork_listContainer.js b/public/react/src/modules/tpm/TPMFork_listContainer.js index bbd55c2ee..12c579863 100644 --- a/public/react/src/modules/tpm/TPMFork_listContainer.js +++ b/public/react/src/modules/tpm/TPMFork_listContainer.js @@ -1,50 +1,50 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMForklist from './TPMForklist' - -import axios from 'axios'; - -class TPMRanking_listContainer extends Component { - constructor(props) { - super(props) - this.state = { - tpmLoading: true, - creator: { - owner_id: '' - } - } - } - - componentWillReceiveProps(newProps, newContext) { - - } - - componentDidMount() { - this.props.showShixun(); - } - - - render() { - const { tpmLoading } = this.props; - const user = this.props.current_user; - return ( - - { tpmLoading ?
: - - - } -
- ); - } -} - -export default TPMRanking_listContainer; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMForklist from './TPMForklist' + +import axios from 'axios'; + +class TPMRanking_listContainer extends Component { + constructor(props) { + super(props) + this.state = { + tpmLoading: true, + creator: { + owner_id: '' + } + } + } + + componentWillReceiveProps(newProps, newContext) { + + } + + componentDidMount() { + this.props.showShixun(); + } + + + render() { + const { tpmLoading } = this.props; + const user = this.props.current_user; + return ( + + { tpmLoading ?
: + + + } +
+ ); + } +} + +export default TPMRanking_listContainer; diff --git a/public/react/src/modules/tpm/TPMForklist.js b/public/react/src/modules/tpm/TPMForklist.js index 251821209..ffd31d2b7 100644 --- a/public/react/src/modules/tpm/TPMForklist.js +++ b/public/react/src/modules/tpm/TPMForklist.js @@ -1,63 +1,64 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import Shixunfork_list from './shixunchild/Shixunfork_list' -import TPMRightSection from './component/TPMRightSection' -import TPMNav from './component/TPMNav' - -class TPMForklist extends Component { - constructor(props) { - super(props) - - } - - componentWillReceiveProps(newProps, newContext) { - - } - - componentDidMount() { - - } - - - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - - return ( - -
- -
- - { loadingContent ? - : - - - } -
- -
- -
-
-
- - ); - } -} - -export default TPMForklist; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import Shixunfork_list from './shixunchild/Shixunfork_list' +import TPMRightSection from './component/TPMRightSection' +import TPMNav from './component/TPMNav' + +class TPMForklist extends Component { + constructor(props) { + super(props) + + } + + componentWillReceiveProps(newProps, newContext) { + + } + + componentDidMount() { + + } + + + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + + return ( + +
+ +
+ + { loadingContent ? + : + + + } +
+ +
+ +
+
+
+ + ); + } +} + +export default TPMForklist; diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index f80691d56..0fe17be2e 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,6 +20,8 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; +//import TPMsettings from './TPMsettings/TPMsettings'; + import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; @@ -29,6 +31,7 @@ import TPMCollaboratorsComponent from './TPMCollaboratorsContainer'; import Audit_situationComponent from './Audit_situationComponent'; import TPMDataset from './TPMDataset'; import '../page/tpiPage.css' +import TPMNav from "./component/TPMNav"; const $ = window.$ //任务 @@ -143,6 +146,7 @@ class TPMIndex extends Component { TPMRightSectionData:undefined, PropaedeuticsList: undefined, tpmindexjupyterbool:false, + is_jupyter:false, } } @@ -193,7 +197,7 @@ class TPMIndex extends Component { propaedeutics:response.data.propaedeutics, status: response.data.shixun_status, secret_repository: response.data.secret_repository, - + is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, }); } }).catch((error) => { @@ -205,7 +209,8 @@ class TPMIndex extends Component { power: undefined, identity: undefined, status: undefined, - propaedeutics:undefined + propaedeutics:undefined, + is_jupyter:false, }); }); @@ -274,6 +279,7 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; + console.log(this.state.is_jupyter); return (
{/*头部*/} @@ -295,16 +301,16 @@ class TPMIndex extends Component { ( () }> ( () }> - + {/*任务*/} ( () }> @@ -314,24 +320,24 @@ class TPMIndex extends Component { }> ( () }> ( () }> {/* */} ( () }> ( () }> @@ -340,7 +346,7 @@ class TPMIndex extends Component { ( (this.initForumState(data)} setSearchValue={this.setSearchValue} setHotLabelIndex={this.setHotLabelIndex} @@ -354,17 +360,17 @@ class TPMIndex extends Component { {/*实训项目条目塞选*/} ( () }> - + {/*合作者*/} ( () }> ( () }> @@ -415,7 +421,7 @@ class TPMIndex extends Component { }> ( () }> diff --git a/public/react/src/modules/tpm/TPMPropaedeutics.js b/public/react/src/modules/tpm/TPMPropaedeutics.js index 88a05fde7..3a6a92bb0 100644 --- a/public/react/src/modules/tpm/TPMPropaedeutics.js +++ b/public/react/src/modules/tpm/TPMPropaedeutics.js @@ -1,74 +1,75 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import Propaedeutics from './shixunchild/Propaedeutics/Propaedeu_tics' - -import TPMRightSection from './component/TPMRightSection' - -import TPMNav from './component/TPMNav' - -import axios from 'axios'; - -class TPMPropaedeutics extends Component { - constructor(props) { - super(props) - this.state = { - shixunId: undefined - } - } - - componentWillReceiveProps(newProps, newContext) { - } - - componentDidMount() { - - - } - - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - // - return ( - -
- -
- - - - -
- -
- -
-
-
- - ); - } -} - -export default TPMPropaedeutics; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import Propaedeutics from './shixunchild/Propaedeutics/Propaedeu_tics' + +import TPMRightSection from './component/TPMRightSection' + +import TPMNav from './component/TPMNav' + +import axios from 'axios'; + +class TPMPropaedeutics extends Component { + constructor(props) { + super(props) + this.state = { + shixunId: undefined + } + } + + componentWillReceiveProps(newProps, newContext) { + } + + componentDidMount() { + + + } + + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + // + return ( + +
+ +
+ + + + +
+ +
+ +
+
+
+ + ); + } +} + +export default TPMPropaedeutics; diff --git a/public/react/src/modules/tpm/TPMPropaedeuticsComponent.js b/public/react/src/modules/tpm/TPMPropaedeuticsComponent.js index 7c3eadb89..994bec874 100644 --- a/public/react/src/modules/tpm/TPMPropaedeuticsComponent.js +++ b/public/react/src/modules/tpm/TPMPropaedeuticsComponent.js @@ -1,39 +1,40 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMPropaedeutics from './TPMPropaedeutics' - -import axios from 'axios'; - -class TPMPropaedeuticsComponent extends Component { - constructor(props) { - super(props) - this.state = { - // tpmLoading: true, - // creator: { - // owner_id: '' - // } - } - } - - render() { - const { tpmLoading } = this.props; - - return ( - - { tpmLoading ?
: - - - } -
- - - ); - } -} - -export default TPMPropaedeuticsComponent ; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMPropaedeutics from './TPMPropaedeutics' + +import axios from 'axios'; + +class TPMPropaedeuticsComponent extends Component { + constructor(props) { + super(props) + this.state = { + // tpmLoading: true, + // creator: { + // owner_id: '' + // } + } + } + + render() { + const { tpmLoading } = this.props; + + return ( + + { tpmLoading ?
: + + + } +
+ + + ); + } +} + +export default TPMPropaedeuticsComponent ; diff --git a/public/react/src/modules/tpm/TPMRanking_list.js b/public/react/src/modules/tpm/TPMRanking_list.js index 7171692a7..b7498b876 100644 --- a/public/react/src/modules/tpm/TPMRanking_list.js +++ b/public/react/src/modules/tpm/TPMRanking_list.js @@ -1,59 +1,60 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import Ranking_list from './shixunchild/Ranking_list/Ranking_list' -import TPMRightSection from './component/TPMRightSection' -import TPMNav from './component/TPMNav' - -class TPMRanking_list extends Component { - constructor(props) { - super(props) - - } - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - - // - return ( - -
- -
- - - - - -
- -
- -
-
-
- - ); - } -} - -export default TPMRanking_list; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import Ranking_list from './shixunchild/Ranking_list/Ranking_list' +import TPMRightSection from './component/TPMRightSection' +import TPMNav from './component/TPMNav' + +class TPMRanking_list extends Component { + constructor(props) { + super(props) + + } + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + + // + return ( + +
+ +
+ + + + + +
+ +
+ +
+
+
+ + ); + } +} + +export default TPMRanking_list; diff --git a/public/react/src/modules/tpm/TPMRanking_listContainer.js b/public/react/src/modules/tpm/TPMRanking_listContainer.js index 98841b1ab..f07401abe 100644 --- a/public/react/src/modules/tpm/TPMRanking_listContainer.js +++ b/public/react/src/modules/tpm/TPMRanking_listContainer.js @@ -1,37 +1,40 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMRanking_list from './TPMRanking_list' - -import axios from 'axios'; - -class TPMRanking_listContainer extends Component { - constructor(props) { - super(props) - this.state = { - } - } - - render() { - const { tpmLoading } = this.props; - const user = this.props.current_user; - - return ( - - { tpmLoading ?
: - - - } -
- ); - } -} - -export default TPMRanking_listContainer; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMRanking_list from './TPMRanking_list' + +import axios from 'axios'; +import TPMNav from "./component/TPMNav"; + +class TPMRanking_listContainer extends Component { + constructor(props) { + super(props) + this.state = { + } + } + + render() { + const { tpmLoading } = this.props; + const user = this.props.current_user; + + return ( + + { tpmLoading ?
: + + + } +
+ ); + } +} + +export default TPMRanking_listContainer; diff --git a/public/react/src/modules/tpm/TPMRepository.js b/public/react/src/modules/tpm/TPMRepository.js index 0f8e31258..5db8100bc 100644 --- a/public/react/src/modules/tpm/TPMRepository.js +++ b/public/react/src/modules/tpm/TPMRepository.js @@ -1,58 +1,59 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import Repository from './shixunchild/Repository/Repository' -import TPMRightSection from './component/TPMRightSection' -import TPMNav from './component/TPMNav' - -// import RepositoryChooseModal from './component/modal/RepositoryChooseModal' - -class TPMRepository extends Component { - constructor(props) { - super(props) - } - - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match, isContentWidth100 - } = this.props; - - return ( - -
- {/* 可能会影响到其他页面的样式,需要测试、协商 */} -
- - {/* */} - { loadingContent ? - : - - } -
- - { !isContentWidth100 &&
- -
} -
-
- - ); - } -} - -export default TPMRepository; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import Repository from './shixunchild/Repository/Repository' +import TPMRightSection from './component/TPMRightSection' +import TPMNav from './component/TPMNav' + +// import RepositoryChooseModal from './component/modal/RepositoryChooseModal' + +class TPMRepository extends Component { + constructor(props) { + super(props) + } + + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match, isContentWidth100 + } = this.props; + + return ( + +
+ {/* 可能会影响到其他页面的样式,需要测试、协商 */} +
+ + {/* */} + { loadingContent ? + : + + } +
+ + { !isContentWidth100 &&
+ +
} +
+
+ + ); + } +} + +export default TPMRepository; diff --git a/public/react/src/modules/tpm/TPMRepositoryComponent.js b/public/react/src/modules/tpm/TPMRepositoryComponent.js index 027f3f705..af3930b74 100644 --- a/public/react/src/modules/tpm/TPMRepositoryComponent.js +++ b/public/react/src/modules/tpm/TPMRepositoryComponent.js @@ -1,229 +1,230 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMRepository from './TPMRepository' - -import axios from 'axios'; - -import { trace_collapse, info } from 'educoder' - -import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor' - - -class TPMRepositoryComponent extends Component { - constructor(props) { - super(props) - this.nameTypeMap = {} - let pathArray = [] - var splitArray = window.location.pathname.split('shixun_show/'); - if (splitArray[1]) { - pathArray = splitArray[1].split('/') - if (pathArray[pathArray.length - 1] == '') { - // 有可能是这么访问的: http://localhost:3007/shixuns/3ozvy5f8/repository/fsu7tkaw/master/shixun_show/src/ - pathArray.length = pathArray.length - 1; - } - } - this.state = { - repositoryLoading: true, - pathArray: pathArray, - isContentWidth100: this._isFileInPathArray(pathArray) - } - } - componentDidUpdate(prevProps, prevState) { - if (this.props.secret_repository_tab != prevProps.secret_repository_tab) { - this.fetchRepo() - } - } - - - componentDidMount = () => { - - this.fetchRepo() - } - setContentWidth100 = (flag) => { - const newFileContent = flag === false ? '' : this.state.fileContent - this.setState({ - // isCodeFile - isContentWidth100: flag, - fileContent: newFileContent - }) - } - saveCode = (content) => { - const path = this.state.pathArray.join('/') - let id = this.props.match.params.shixunId; - let url = `/shixuns/${id}/update_file.json`; - axios.post(url, { - path: path, - content - }).then((response) => { - if(response.status === 200){ - this.setState({ - fileContent: response.data.content, - repositoryLoading: false - }); - } - trace_collapse('tpm save code res: ', response) - this.props.showSnackbar('文件保存成功') - - }).catch((error)=>{ - console.log(error) - }); - } - fetchCode = (newPathArray) => { - const path = newPathArray.join('/') - - // https://testeduplus2.educoder.net/shixuns/3ozvy5f8/file_content.json - this.setContentWidth100(true) - this.setState({ repositoryLoading: true, pathArray: newPathArray }) - let id = this.props.match.params.shixunId; - let url = `/shixuns/${id}/file_content.json`; - axios.post(url, { - path: path, - secret_repository: this.props.secret_repository_tab - }).then((response) => { - trace_collapse('repository res: ', response) - - if (response.data.status == -1) { - this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') - return; - } - if(response.status === 200){ - this.setState({ - fileContent: response.data.content, - repositoryLoading: false - }); - this.props.history - .replace(`${this.props.match.url}/master/shixun_show/${newPathArray.join('/')}`) - } - - }).catch((error)=>{ - this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') - console.log(error) - }); - } - _isFileName = (name) => { - return name.indexOf('.') !== -1 - } - _isFileInPathArray = (array) => { - if (!array || array.length === 0) { - return false - } - return this.nameTypeMap[array[array.length - 1]] !== 'tree' && this._isFileName( array[array.length - 1] ) - } - // listItem 如果是num,则是通过面包屑点击过来的,取pathArray的子集 - fetchRepo = (listItem) => { - const { pathArray } = this.state; - let newPathArray = pathArray.slice(0) - - if (listItem === 0 || listItem) { - this.setContentWidth100(false) - this.nameTypeMap[listItem.name] = listItem.type - if (typeof listItem == 'number') { // 参数是数字的话,做截取 - // if (this._isFileName(newPathArray[listItem])) { // 面包屑中的文件不让点击了 - // listItem--; - // } - newPathArray = newPathArray.slice(0, listItem) - } else if (listItem.type === 'tree') { - newPathArray.push(listItem.name) - } else if (listItem.type === 'blob') { - newPathArray.push(listItem.name) - this.setState({ pathArray: newPathArray }) - this.fetchCode(newPathArray) - return; - } - } - // https://testeduplus2.educoder.net/shixuns/3ozvy5f8/repository.json - this.setState({ repositoryLoading: true, pathArray: newPathArray }) - let urlNewPathArray = newPathArray; - let fileInPathArray = false; - if (newPathArray.length) { - fileInPathArray = this.nameTypeMap[newPathArray[newPathArray.length - 1]] ? this.nameTypeMap[newPathArray[newPathArray.length - 1]] !== 'tree' - : (listItem ? listItem.type !== 'tree' : this._isFileName( newPathArray[newPathArray.length - 1] )) - if ( fileInPathArray ) { - urlNewPathArray = newPathArray.slice(0, newPathArray.length - 1) - } - } - const path = urlNewPathArray.join('/') - - let id = this.props.match.params.shixunId; - let url = `/shixuns/${id}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}.json`; - // this.props.setLoadingContent(true) - axios.post(url, { - path: path ? path : '' - }).then((response) => { - // this.props.setLoadingContent(false) - - const trees = response.data.trees - const treeIsFileMap = {} - if (!trees || !Array.isArray(trees)) { - // this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') - // return; - } else { - trees.forEach(item => { - treeIsFileMap[item.name] = item.type == 'blob' - }) - } - if(response.status === 200){ - this.setState({ - treeIsFileMap, - ...response.data, - repositoryLoading: false - }); - this.props.history - .replace(`${this.props.match.url}` + - (newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : '')) - } - - // 初始化时,repo接口完毕后需要看是否需要fetchCode - if (fileInPathArray) { - this.fetchCode(newPathArray) - } - // info(response) - trace_collapse('repository res: ', response) - - }).catch((error)=>{ - console.log(error) - }); - } - - - render() { - const { isContentWidth100 } = this.state; - - // 需要重构 - return ( - - { !isContentWidth100 ? - - : -
- {/* 可能会影响到其他页面的样式,需要测试、协商 */} -
- -
-
- } - -
- - - ); - } -} - -export default TPMRepositoryComponent ; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMRepository from './TPMRepository' + +import axios from 'axios'; + +import { trace_collapse, info } from 'educoder' + +import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor' + + +class TPMRepositoryComponent extends Component { + constructor(props) { + super(props) + this.nameTypeMap = {} + let pathArray = [] + var splitArray = window.location.pathname.split('shixun_show/'); + if (splitArray[1]) { + pathArray = splitArray[1].split('/') + if (pathArray[pathArray.length - 1] == '') { + // 有可能是这么访问的: http://localhost:3007/shixuns/3ozvy5f8/repository/fsu7tkaw/master/shixun_show/src/ + pathArray.length = pathArray.length - 1; + } + } + this.state = { + repositoryLoading: true, + pathArray: pathArray, + isContentWidth100: this._isFileInPathArray(pathArray) + } + } + componentDidUpdate(prevProps, prevState) { + if (this.props.secret_repository_tab != prevProps.secret_repository_tab) { + this.fetchRepo() + } + } + + + componentDidMount = () => { + + this.fetchRepo() + } + setContentWidth100 = (flag) => { + const newFileContent = flag === false ? '' : this.state.fileContent + this.setState({ + // isCodeFile + isContentWidth100: flag, + fileContent: newFileContent + }) + } + saveCode = (content) => { + const path = this.state.pathArray.join('/') + let id = this.props.match.params.shixunId; + let url = `/shixuns/${id}/update_file.json`; + axios.post(url, { + path: path, + content + }).then((response) => { + if(response.status === 200){ + this.setState({ + fileContent: response.data.content, + repositoryLoading: false + }); + } + trace_collapse('tpm save code res: ', response) + this.props.showSnackbar('文件保存成功') + + }).catch((error)=>{ + console.log(error) + }); + } + fetchCode = (newPathArray) => { + const path = newPathArray.join('/') + + // https://testeduplus2.educoder.net/shixuns/3ozvy5f8/file_content.json + this.setContentWidth100(true) + this.setState({ repositoryLoading: true, pathArray: newPathArray }) + let id = this.props.match.params.shixunId; + let url = `/shixuns/${id}/file_content.json`; + axios.post(url, { + path: path, + secret_repository: this.props.secret_repository_tab + }).then((response) => { + trace_collapse('repository res: ', response) + + if (response.data.status == -1) { + this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') + return; + } + if(response.status === 200){ + this.setState({ + fileContent: response.data.content, + repositoryLoading: false + }); + this.props.history + .replace(`${this.props.match.url}/master/shixun_show/${newPathArray.join('/')}`) + } + + }).catch((error)=>{ + this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') + console.log(error) + }); + } + _isFileName = (name) => { + return name.indexOf('.') !== -1 + } + _isFileInPathArray = (array) => { + if (!array || array.length === 0) { + return false + } + return this.nameTypeMap[array[array.length - 1]] !== 'tree' && this._isFileName( array[array.length - 1] ) + } + // listItem 如果是num,则是通过面包屑点击过来的,取pathArray的子集 + fetchRepo = (listItem) => { + const { pathArray } = this.state; + let newPathArray = pathArray.slice(0) + + if (listItem === 0 || listItem) { + this.setContentWidth100(false) + this.nameTypeMap[listItem.name] = listItem.type + if (typeof listItem == 'number') { // 参数是数字的话,做截取 + // if (this._isFileName(newPathArray[listItem])) { // 面包屑中的文件不让点击了 + // listItem--; + // } + newPathArray = newPathArray.slice(0, listItem) + } else if (listItem.type === 'tree') { + newPathArray.push(listItem.name) + } else if (listItem.type === 'blob') { + newPathArray.push(listItem.name) + this.setState({ pathArray: newPathArray }) + this.fetchCode(newPathArray) + return; + } + } + // https://testeduplus2.educoder.net/shixuns/3ozvy5f8/repository.json + this.setState({ repositoryLoading: true, pathArray: newPathArray }) + let urlNewPathArray = newPathArray; + let fileInPathArray = false; + if (newPathArray.length) { + fileInPathArray = this.nameTypeMap[newPathArray[newPathArray.length - 1]] ? this.nameTypeMap[newPathArray[newPathArray.length - 1]] !== 'tree' + : (listItem ? listItem.type !== 'tree' : this._isFileName( newPathArray[newPathArray.length - 1] )) + if ( fileInPathArray ) { + urlNewPathArray = newPathArray.slice(0, newPathArray.length - 1) + } + } + const path = urlNewPathArray.join('/') + + let id = this.props.match.params.shixunId; + let url = `/shixuns/${id}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}.json`; + // this.props.setLoadingContent(true) + axios.post(url, { + path: path ? path : '' + }).then((response) => { + // this.props.setLoadingContent(false) + + const trees = response.data.trees + const treeIsFileMap = {} + if (!trees || !Array.isArray(trees)) { + // this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') + // return; + } else { + trees.forEach(item => { + treeIsFileMap[item.name] = item.type == 'blob' + }) + } + if(response.status === 200){ + this.setState({ + treeIsFileMap, + ...response.data, + repositoryLoading: false + }); + this.props.history + .replace(`${this.props.match.url}` + + (newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : '')) + } + + // 初始化时,repo接口完毕后需要看是否需要fetchCode + if (fileInPathArray) { + this.fetchCode(newPathArray) + } + // info(response) + trace_collapse('repository res: ', response) + + }).catch((error)=>{ + console.log(error) + }); + } + + + render() { + const { isContentWidth100 } = this.state; + + // 需要重构 + return ( + + { !isContentWidth100 ? + + : +
+ {/* 可能会影响到其他页面的样式,需要测试、协商 */} +
+ +
+
+ } + +
+ + + ); + } +} + +export default TPMRepositoryComponent ; diff --git a/public/react/src/modules/tpm/TPMShixunDiscuss.js b/public/react/src/modules/tpm/TPMShixunDiscuss.js index 9350060cc..be084ebff 100644 --- a/public/react/src/modules/tpm/TPMShixunDiscuss.js +++ b/public/react/src/modules/tpm/TPMShixunDiscuss.js @@ -1,72 +1,73 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import { CircularProgress } from 'material-ui/Progress'; - -import './TPMShixunDiscuss.css' - -import ShixunDiscuss from './shixunchild/ShixunDiscuss/ShixunDiscuss' -import TPMRightSection from './component/TPMRightSection' -import TPMNav from './component/TPMNav' - -import Comments from '../comment/Comments' -import { commentHOC } from '../comment/CommentsHOC' - -class TPMShixunDiscuss extends Component { - constructor(props) { - super(props) - - } - - componentWillReceiveProps(newProps, newContext) { - } - - componentDidMount() { - // TODO 加了HOC后 mount了两次 - this.props.fetchCommentIfNotFetched && - this.props.fetchCommentIfNotFetched(); - } - - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - - return ( - -
- -
- - { loadingContent ? - : - - // onPaginationChange={this.onPaginationChange} - // - } -
- -
- -
-
-
- - ); - } -} - -export default commentHOC ( TPMShixunDiscuss ); +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import { CircularProgress } from 'material-ui/Progress'; + +import './TPMShixunDiscuss.css' + +import ShixunDiscuss from './shixunchild/ShixunDiscuss/ShixunDiscuss' +import TPMRightSection from './component/TPMRightSection' +import TPMNav from './component/TPMNav' + +import Comments from '../comment/Comments' +import { commentHOC } from '../comment/CommentsHOC' + +class TPMShixunDiscuss extends Component { + constructor(props) { + super(props) + + } + + componentWillReceiveProps(newProps, newContext) { + } + + componentDidMount() { + // TODO 加了HOC后 mount了两次 + this.props.fetchCommentIfNotFetched && + this.props.fetchCommentIfNotFetched(); + } + + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + + return ( + +
+ +
+ + { loadingContent ? + : + + // onPaginationChange={this.onPaginationChange} + // + } +
+ +
+ +
+
+
+ + ); + } +} + +export default commentHOC ( TPMShixunDiscuss ); diff --git a/public/react/src/modules/tpm/TPMShixunDiscussContainer.js b/public/react/src/modules/tpm/TPMShixunDiscussContainer.js index 535840772..072cb5906 100644 --- a/public/react/src/modules/tpm/TPMShixunDiscussContainer.js +++ b/public/react/src/modules/tpm/TPMShixunDiscussContainer.js @@ -1,45 +1,45 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -import TPMShixunDiscuss from './TPMShixunDiscuss' - -import axios from 'axios'; - -class TPMShixunDiscussContainer extends Component { - constructor(props) { - super(props) - this.state = { - } - } - - componentWillReceiveProps(newProps, newContext) { - - } - - componentDidMount() { - - } - - render() { - const { tpmLoading } = this.props; - const user = this.props.current_user; - return ( - - { tpmLoading ?
: - - - } -
- ); - } -} - -export default TPMShixunDiscussContainer; +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +import TPMShixunDiscuss from './TPMShixunDiscuss' + +import axios from 'axios'; + +class TPMShixunDiscussContainer extends Component { + constructor(props) { + super(props) + this.state = { + } + } + + componentWillReceiveProps(newProps, newContext) { + + } + + componentDidMount() { + + } + + render() { + const { tpmLoading } = this.props; + const user = this.props.current_user; + return ( + + { tpmLoading ?
: + + + } +
+ ); + } +} + +export default TPMShixunDiscussContainer; diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index 187955c22..2089d1939 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -33,7 +33,24 @@ const Option = Select.Option; const RadioGroup = Radio.Group; const confirm = Modal.confirm; +function range(start, end) { + const result = []; + for (let i = start; i < end; i++) { + result.push(i); + } + return result; +} +function disabledDateTime() { + return { + // disabledHours: () => range(0, 24).splice(4, 20), + disabledMinutes: () => range(1, 30).concat(range(31, 60)), + // disabledSeconds: () => [0, 60], + }; +} +function disabledDate(current) { + return current && current < moment().endOf('day').subtract(1, 'days'); +} export default class Shixuninformation extends Component { @@ -63,7 +80,7 @@ export default class Shixuninformation extends Component { }) } return ( -
+
复制: diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js index 393e0659c..9f99ea5a0 100644 --- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js +++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js @@ -23,7 +23,7 @@ export default class Shixuninformation extends Component { render() { return ( -
+
1111
); diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index aa874d8fe..1e6980216 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -25,9 +25,9 @@ import axios from 'axios'; import TPMMDEditor from "../challengesnew/TPMMDEditor"; +import Bottomsubmit from "../../modals/Bottomsubmit"; -import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; -import {TPMIndexHOC} from "../TPMIndexHOC"; +import {getUploadActionUrl} from 'educoder'; import './css/TPMsettings.css'; @@ -43,9 +43,36 @@ class Shixuninformation extends Component { NAME_COUNT: 60, shixunmemoMDvalue: "", language: "java", + testscripttiptype:false, + shixunName:'', + trainee:undefined, + choice_small_type:[] } } + componentDidMount() { + + } + + componentDidUpdate(prevProps, prevState) { + if(prevProps.data!=this.props.data){ + console.log(this.props.data) + if(this.props.data){ + this.setState({ + shixunName:this.props.data.shixun.name, + trainee:this.props.data.shixun.trainee, + choice_main_type:this.props.data.shixun.choice_main_type, + choice_small_type:this.props.data.shixun.choice_small_type, + choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, + }) + + this.props.form.setFieldsValue({ + name:this.props.data.shixun.name, + }) + this.contentMdRef.current.setValue(this.props.data.shixun.description); + } + } + } getshixunmemoMDvalue = (value, e) => { @@ -54,13 +81,243 @@ class Shixuninformation extends Component { }) } + testscripttip=(val)=>{ + if(val===0){ + this.setState({ + testscripttiptype:true + }) + }else if(val===1){ + this.setState({ + testscripttiptype:false + }) + } + } + + post_apply = () => { + this.setState({ + postapplyvisible: true + }) + } + + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false, + }) + if (this.state.file !== undefined) { + // this.deleteAttachment(this.state.file); + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + } + + + sendsure_apply = () => { + let {language, runtime, run_method} = this.state; + + if (!language || language === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言`); + this.setState({ + languagewritetype: true + }) + return + } + if (!runtime || runtime === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); + this.setState({ + systemenvironmenttype: true + }) + return; + + } + if (!run_method || run_method === "") { + // this.props.showNotification(`请填写该镜像中测试代码运行方式`); + this.setState({ + testcoderunmodetype: true + }) + return; + } + + var attachment_ids = undefined; + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + if (attachment_ids === undefined || attachment_ids.length === 0) { + this.setState({ + attachmentidstype: true + }) + return; + } + + var data = { + language: language, + runtime: runtime, + run_method: run_method, + attachment_id: attachment_ids[0], + } + var url = `/shixuns/apply_shixun_mirror.json`; + axios.post(url, data + ).then((response) => { + + try { + if (response.data) { + + if (this.state.file !== undefined) { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() + + } + } catch (e) { + + } + + }) + + } + + + bigClass = (value) => { + let list=[] + list.push(this.props.data.shixun.choice_main_type) + this.props.data.shixun.choice_small_type.map((item,key)=>{ + list.push(item) + }) + let newshixun_service_configs=this.props.data.shixun.shixun_service_configs; + let newshixun_service_configsagin=[]; + newshixun_service_configs.map((item,key)=>{ + list.map((its,index)=>{ + if(item.mirror_repository_id===its){ + newshixun_service_configsagin.push(item) + } + }) + }) + + + this.props.data.shixun.main_type.some((item,key)=> { + if (item.id === value) { + newshixun_service_configsagin[0]={ + mirror_repository_id:value, + name:item.type_name, + cpu_limit:1, + lower_cpu_limit:0.1, + memory_limit:1024, + request_limit:10 + } + return true + } + } + ) + let url = `/shixuns/get_mirror_script.json?mirror_id=`+value; + axios.get(url).then((response) => { + if (response.status === 200) { + // console.log(response.data) + this.setState({ + choice_main_type: value, + standard_scripts:response.data, + choice_standard_scripts:null, + shixun_service_configs:newshixun_service_configsagin, + shixun_service_configlist:newshixun_service_configsagin, + }) + } + }).catch((error) => { + console.log(error) + }); + } + + littleClass = (value) => { + let newshixun_service_configs=this.props.data.shixun.shixun_service_configs; + let newchoice_small_type=this.props.data.shixun.choice_small_type; + let list=[] + list.push(this.props.data.shixun.choice_main_type) + newchoice_small_type.map((item,key)=>{ + list.push(item) + }) + + let newshixun_service_configsagin=[] + + newshixun_service_configs.map((item,key)=>{ + list.map((its,index)=>{ + if(item.mirror_repository_id===its){ + newshixun_service_configsagin.push(item) + } + }) + }) + + this.props.data.shixun.small_type.some((items,keys)=> { + if (items.id === value) { + newshixun_service_configsagin.push({ + mirror_repository_id:value, + name:items.type_name, + cpu_limit:1, + lower_cpu_limit:0.1, + memory_limit:1024, + request_limit:10 + }) + return true + } + } + ) + + newchoice_small_type.push(value) + + this.setState({ + choice_small_type: newchoice_small_type, + shixun_service_configs:newshixun_service_configsagin, + shixun_service_configlist:newshixun_service_configsagin, + }) + } render() { - console.log(this.props.data) + + let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; + console.log(operateauthority) const {getFieldDecorator} = this.props.form; - const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state; + const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; const {shixun_service_configs}=this.props; - let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false; const uploadProps = { width: 600, fileList, @@ -105,135 +362,145 @@ class Shixuninformation extends Component { }, } - return ( -
-
- - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '请输入名称,最大限制60个字符', - }, { - whitespace: true, message: '请勿输入空格' - }], - })( - - )} - - - - - - - - - {getFieldDecorator('select', { - rules: [{required: true, message: '请选择难易度'}], - })( -
- - -
- )} - (实训的难易程度) -
- - -
- {getFieldDecorator('selectleft', { - rules: [{required: true, message: '请选择主类别'}], - })( -
- -
+ return ( +
+
+ + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '请输入名称,最大限制60个字符', + }, { + whitespace: true, message: '请勿输入空格' + }], + })( + )} -
- - - - -
- {getFieldDecorator('selectright', { - rules: [{required: true, message: '请选择小类别'}], + + + + + + + + + {getFieldDecorator('trainee', { + rules: [{required: true, message: '请选择难易度'}], })( -
- - { - newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => { - return ( - - ) - }) - } + + + + +
)} - + (实训的难易程度) +
+ + +
+ + {getFieldDecorator('selectleft', { + rules: [{required: true, message: '请选择主类别'}], + })( +
+ + +
+ )} +
+
+ + + +
+ {getFieldDecorator('selectright', { + rules: [{required: true, message: '请选择小类别'}], + })( +
+ +
+ )} +
已安装软件:hadoop3.1.0、jdk1.8; @@ -243,236 +510,259 @@ class Shixuninformation extends Component {
-
-
+
+
-
-
- 没有实验环境? - 申请新建 -
+
+
+ 没有实验环境? + 申请新建 +
- - {getFieldDecorator('select', { - rules: [{required: true, message: '请选择评测脚本'}], - })( -
- + + {getFieldDecorator('select123', { + rules: [{required: true, message: '请选择评测脚本'}], + })( +
+ +
+ )} + 使用自定义脚本 - + this.testscripttip(0)}> +
+ + +
+

+ 使用自定义模板,平台无法自动更新脚本,请在关卡创建完后手动更新脚本中的必填参
+ 数和以下2个数组元素:
+ challengeProgramNames
+ sourceClassNames

+ 示例:有2个关卡的实训

+ 各关卡的待编译文件为:
+ src/step1/HelloWorld.java
+ src/step2/Other.java

+ 各关卡的编译后生成的执行文件为:
+ step1.HelloWorld
+ step2.Other

+ 则数组元素更新如下:
+ challengeProgramNames=("src/step1/
+ HelloWorld.java" "src/step2/Other.java")
+ sourceClassNames=("step1.HelloWorld
+ " "step2.Other")

+ 其它参数可按实际需求定制 +

+
+

+ this.testscripttip(1)}>知道了 +

+
-
- -
-
-
-
- + + +
+
+
+
+ +
-
- + - 私密版本库: + 私密版本库: (若需要对学员隐藏部分版本库内容时,请选中;选中即启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库) - {this.props.identity<3?
-

服务配置

- { shixun_service_configs&&shixun_service_configs.map((item,key)=>{ + {this.props.identity<3?
+

服务配置

+ { shixun_service_configs&&shixun_service_configs.map((item,key)=>{ - return( -
-
-
- {item.name} - {/*this.Deselectlittle(item.mirror_repository_id)}>*/} -
-
- -
- this.setConfigsInputs(e,key,1)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + return( +
+
+
+ {item.name} + {/*this.Deselectlittle(item.mirror_repository_id)}>*/}
-
-
-
- -
- this.setConfigsInputs(e,key,2)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+ +
+ this.setConfigsInputs(e,key,1)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+
-
-
-
- -
- this.setConfigsInputs(e,key,3)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+ +
+ this.setConfigsInputs(e,key,2)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+
-
-
-
- -
- this.setConfigsInputs(e,key,4)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+ +
+ this.setConfigsInputs(e,key,3)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+
+
+
+ +
+ this.setConfigsInputs(e,key,4)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
+ +
- -
-
- ) + ) - })} -
:""} + })} +
:""} - {postapplyvisible === true ? : ""} - - -
-
  • - - -
  • -
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    -
  • - - -
  • -
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    -
  • - - - -
  • -
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    -
  • - -
    - - - 上传附件 - (单个文件50M以内) - - -
    + } + : ""} + + +
    +
  • + + +
  • +
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    +
  • + + +
  • +
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    +
  • + + + +
  • +
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    +
  • + +
    + + + 上传附件 + (单个文件50M以内) + + +
    -
  • -
    - {this.state.attachmentidstype === true ? "请上传附件" : ""} -
    -
  • - this.sendhideModaly()} - >取消 - -
  • -
    -
    - {/**/} -
    - - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系
  • +
    + {this.state.attachmentidstype === true ? "请上传附件" : ""} +
    +
  • + this.sendhideModaly()} + >取消 + +
  • +
    -
    - 知道啦 -
    -
    -
    - + {/**/} + +
    +
    + ); } } diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 4540b5e60..c405e3e9f 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -11,17 +11,10 @@ import Configuration from './Configuration'; import LearningSettings from './LearningSettings'; -import Bottomsubmit from "../../modals/Bottomsubmit"; - -import moment from 'moment'; - import axios from 'axios'; import './css/TPMsettings.css'; -import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; - - const {TabPane} = Tabs; // 处理整点 半点 @@ -90,9 +83,21 @@ export default class TPMsettings extends Component { render() { return ( -
    -
    +
    +
    - - -
    ); } } diff --git a/public/react/src/modules/tpm/component/TPMNav.js b/public/react/src/modules/tpm/component/TPMNav.js index 025b26223..1d03d12da 100644 --- a/public/react/src/modules/tpm/component/TPMNav.js +++ b/public/react/src/modules/tpm/component/TPMNav.js @@ -5,7 +5,7 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom"; class TPMNav extends Component { render() { - const { user, match, shixun, secret_repository } = this.props; + const { user, match, shixun, secret_repository,is_jupyter} = this.props; let isAdminOrCreator = false; if (user) { isAdminOrCreator = user.admin || user.manager @@ -15,6 +15,8 @@ class TPMNav extends Component { // console.log(this.props.propaedeutics) const challengesPath = `/shixuns/${shixunId}/challenges`; // console.log(match.path) + console.log("TPMNavTPMNavTPMNav"); + console.log(is_jupyter); return (
    背景知识 } - { this.props.identity >4||this.props.identity===undefined ?"":版本库} + { this.props.identity >4||this.props.identity===undefined ?"": + (this.props.is_jupyter===false? + 版本库 + :"") + } + + + {this.props.identity >4||this.props.identity===undefined ?"": secret_repository && 私密版本库} @@ -37,8 +46,13 @@ class TPMNav extends Component { className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者 {/*jupyter*/} - 数据集 + { + this.props.is_jupyter===true? + 数据集 + :"" + } + 评论 diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 6d5e3fd4f..8a1be807b 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -265,7 +265,7 @@ class Newshixuns extends Component { { message: '提示', description: - '提交成功!', + '新建申请已提交,请等待管理员审核。', } ) @@ -589,10 +589,12 @@ class Newshixuns extends Component { )}
    - {this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" : + {this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
    - {`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} - {` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`} + {`${this.state.subvalues===undefined||this.state.subvalues=== ""?"":this.state.mainvalues===undefined||this.state.mainvalues=== ""?`已安装软件:`+this.state.subvalues:this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`说明:添加了`+this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues=== ""?"": + this.state.mainvalues===undefined||this.state.mainvalues=== ""?`说明:添加了`+this.state.subvalues:this.state.subvalues}`}
    }
    @@ -697,27 +699,6 @@ class Newshixuns extends Component { {/**/} - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index dc70ee1ca..86e7f2c04 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -60,11 +60,26 @@ class Challengesjupyter extends Component { componentDidMount() { setTimeout(this.ChallengesList(), 1000); + // console.log("componentDidMount"); + // console.log("Challengesjupyter"); + // console.log(this.props); + let id = this.props.match.params.shixunId; + let ChallengesURL = `/jupyters/get_info_with_tpm.json`; + let datas={ + identifier:id, + } + axios.get(ChallengesURL, {params: datas}).then((response) => { + if (response.status === 200) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - console.log("componentDidMount"); - console.log("Challengesjupyter"); - console.log(this.props); - + }else{ + console.log("componentDidMountChallengesjupyter"); + console.log(response.data); + } + } + }).catch((error) => { + console.log(error) + }); @@ -125,15 +140,21 @@ class Challengesjupyter extends Component { console.log("propsysl"); console.log(propsysl); let id=this.props.match.params.shixunId; + var jupyter_port=""; + try{ + jupyter_port= parseInt(propsysl.shixunsDetails.jupyter_port); + }catch (e) { + jupyter_port=propsysl.shixunsDetails.jupyter_port; + } const url=`/shixuns/${id}/update_jupyter.json`; const data={ identifier:id, - jupyter_port:propsysl.shixunsDetails.jupyter_port + jupyter_port:jupyter_port, } axios.post(url, data) .then((result) => { - if (result.data.status == 0) { + if (result.data.status === 0) { this.props.showNotification(`应用成功`); } }).catch((error) => { diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css index 4c45f581d..112f381ee 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css @@ -3,6 +3,11 @@ line-height: 30px; } +.height28 { + height: 30px; + line-height:28px; +} + .line27{ line-height: 27px; vertical-align: 1px; diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js index 8e4f0f24d..747a1cbe6 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js @@ -457,7 +457,7 @@ class Collaborators extends Component { style={{display:this.props.identity<5?"flex":"none"}} >
    -

    共12人

    +

    共{collaboratorList&&collaboratorList.length}人

    @@ -469,7 +469,13 @@ class Collaborators extends Component { this.showCollaboratorsvisible("admin")} style={{display:this.props.identity===1?"flex":"none"}} data-remote="true" - className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">更换管理员 + className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton"> +

    更换管理员

    +
    diff --git a/public/react/src/modules/tpm/shixunchild/Repository/TPMRepositoryCommits.js b/public/react/src/modules/tpm/shixunchild/Repository/TPMRepositoryCommits.js index 663c5fcf3..37a4217a6 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/TPMRepositoryCommits.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/TPMRepositoryCommits.js @@ -1,145 +1,146 @@ -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 axios from 'axios'; - -import TPMNav from '../../component/TPMNav' -import TPMRightSection from '../../component/TPMRightSection' -import { CircularProgress } from 'material-ui/Progress'; - -import { trace_collapse } from 'educoder' -const $ = window.$; - -// 点击按钮复制功能 -function jsCopy(){ - var e = document.getElementById("copy_rep_content"); - e.select(); - document.execCommand("Copy"); -} -class TPMRepositoryCommits extends Component { - constructor(props) { - super(props) - this.state = { - RepositoryList: undefined, - } - } - componentDidMount() { - let id = this.props.match.params.shixunId; - - let collaborators=`/shixuns/`+id+`/commits.json`; - axios.post(collaborators, { - secret_repository: this.props.secret_repository_tab - }).then((response)=> { - - if(response.status===200){ - this.setState({ - RepositoryList: response.data - }); - } - trace_collapse('repo commits res', response.data) - - }).catch((error)=>{ - console.log(error) - }); - - } - render() { - const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, - aboutFocus, user, match - } = this.props; - let { RepositoryList } = this.state; - return ( - - -
    - {/* 可能会影响到其他页面的样式,需要测试、协商 */} -
    - - { loadingContent ? - - : - -
    -
    - - 提交记录 - - {/*  35 */} - - 返回 - -
    - - -
    -
      - { RepositoryList === undefined ? "" : RepositoryList.commits.map( (item, key)=>{ - return ( -
    • - {item.email} -

      - {item.title} -

      - {item.time} - -
      -
    • ) - }) - } -
    -
    -
    - } -
    - -
    - -
    -
    - - -
    - - ); - } -} - -/** - { RepositoryList === undefined ? "" : RepositoryList.commits.map( (item, key)=>{ - // {"email":"李暾","title":"2\n","id":"80cb6fc55a14bdd64a9c99913f416966238ed3de","time":"49年前"} - return ( -
    -
    {item.email}
    -
    {item.title}
    -
    {item.id}
    -
    {item.time}
    -
    - ) - }) - */ -export default TPMRepositoryCommits; +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 axios from 'axios'; + +import TPMNav from '../../component/TPMNav' +import TPMRightSection from '../../component/TPMRightSection' +import { CircularProgress } from 'material-ui/Progress'; + +import { trace_collapse } from 'educoder' +const $ = window.$; + +// 点击按钮复制功能 +function jsCopy(){ + var e = document.getElementById("copy_rep_content"); + e.select(); + document.execCommand("Copy"); +} +class TPMRepositoryCommits extends Component { + constructor(props) { + super(props) + this.state = { + RepositoryList: undefined, + } + } + componentDidMount() { + let id = this.props.match.params.shixunId; + + let collaborators=`/shixuns/`+id+`/commits.json`; + axios.post(collaborators, { + secret_repository: this.props.secret_repository_tab + }).then((response)=> { + + if(response.status===200){ + this.setState({ + RepositoryList: response.data + }); + } + trace_collapse('repo commits res', response.data) + + }).catch((error)=>{ + console.log(error) + }); + + } + render() { + const { loadingContent, creator, shixun, myshixun, recommend_shixuns, current_user, watched, + aboutFocus, user, match + } = this.props; + let { RepositoryList } = this.state; + return ( + + +
    + {/* 可能会影响到其他页面的样式,需要测试、协商 */} +
    + + { loadingContent ? + + : + +
    +
    + + 提交记录 + + {/*  35 */} + + 返回 + +
    + + +
    +
      + { RepositoryList === undefined ? "" : RepositoryList.commits.map( (item, key)=>{ + return ( +
    • + {item.email} +

      + {item.title} +

      + {item.time} + +
      +
    • ) + }) + } +
    +
    +
    + } +
    + +
    + +
    +
    + + +
    + + ); + } +} + +/** + { RepositoryList === undefined ? "" : RepositoryList.commits.map( (item, key)=>{ + // {"email":"李暾","title":"2\n","id":"80cb6fc55a14bdd64a9c99913f416966238ed3de","time":"49年前"} + return ( +
    +
    {item.email}
    +
    {item.title}
    +
    {item.id}
    +
    {item.time}
    +
    + ) + }) + */ +export default TPMRepositoryCommits;