背景知识
}
- { 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/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 b3f009e21..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"}}
>
-
+
共{collaboratorList&&collaboratorList.length}人
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;
From 625a68f9c112a603e97b0c0b2939df0b24dfc21c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 11 Dec 2019 20:28:17 +0800
Subject: [PATCH 5/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/TPMIndex.js | 2 +-
.../modules/tpm/TPMsettings/Configuration.js | 17 ++
.../tpm/TPMsettings/Shixuninformation.js | 159 +++++++++++++++---
.../modules/tpm/TPMsettings/TPMsettings.js | 9 +-
.../src/modules/tpm/newshixuns/Newshixuns.js | 6 +-
5 files changed, 159 insertions(+), 34 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js
index 9c82e987d..f80691d56 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -20,7 +20,7 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
-import TPMsettings from './TPMsettings/TPMsettings';
+import TPMsettings from './TPMsettings/oldTPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer';
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent';
diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
index 187955c22..299f4eb64 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 {
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
index 5b8ef39ae..acd73541b 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,10 +43,35 @@ class Shixuninformation extends Component {
NAME_COUNT: 60,
shixunmemoMDvalue: "",
language: "java",
- testscripttiptype:false
+ 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
+ })
+
+ this.props.form.setFieldsValue({
+ name:this.props.data.shixun.name,
+ })
+ this.contentMdRef.current.setValue(this.props.data.shixun.description);
+ }
+ }
+ }
getshixunmemoMDvalue = (value, e) => {
@@ -194,12 +219,104 @@ class Shixuninformation extends Component {
}
+ 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 {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,
@@ -246,6 +363,7 @@ class Shixuninformation extends Component {
+
return (