+ {/*
*/}
+ {/* */}
+ {/* 普通实训*/}
+ {/* jupyter实训*/}
+ {/* */}
+ {/* */}
+ {/**/}
实训名称:
diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
index c054ac0db..9a4b82fb3 100644
--- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
+++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js
@@ -320,7 +320,7 @@ class DetailCardsEditAndAdd extends Component{
})
}
- Getaddshixuns=(value)=>{
+ Getaddshixuns=(value,is_jupyter)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
@@ -329,7 +329,8 @@ class DetailCardsEditAndAdd extends Component{
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
- name:value
+ name:value,
+ is_jupyter:is_jupyter
}).then((response) => {
if(response){
if(response.data){
@@ -383,7 +384,7 @@ class DetailCardsEditAndAdd extends Component{
{this.state.Addshixunstype===true?this.Getaddshixuns(value)}
+ Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props}
{...this.state}
/>:""}
diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
index 20d9ce9ed..350c2eb8d 100644
--- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
+++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js
@@ -320,7 +320,7 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data);
}
- Getaddshixuns=(value)=>{
+ Getaddshixuns=(value,is_jupyter)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
@@ -329,7 +329,8 @@ class DetailCardsEditAndEdit extends Component{
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
- name:value
+ name:value,
+ is_jupyter:is_jupyter
}).then((response) => {
if(response){
if(response.data){
@@ -383,7 +384,7 @@ class DetailCardsEditAndEdit extends Component{
{this.state.Addshixunstype===true?this.Getaddshixuns(value)}
+ Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props}
{...this.state}
/>:""}
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/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index b660001c6..c7cc7fba9 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -1,16 +1,12 @@
-import React, { Component } from 'react';
-
-import { Redirect } from 'react-router';
+import React, {Component} from 'react';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
-import PropTypes from 'prop-types';
-
-import { Rating ,Progress} from "@icedesign/base";
+import {Rating, Progress} from "@icedesign/base";
-import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip,Rate} from 'antd';
+import {Modal, Input, Radio, Pagination, message, Spin, Icon, Tooltip, Button,Popover} from 'antd';
-import AccountProfile from"../user/AccountProfile";
+import AccountProfile from "../user/AccountProfile";
import 'antd/lib/pagination/style/index.css';
@@ -27,515 +23,708 @@ const Search = Input.Search;
const RadioGroup = Radio.Group;
class TPMBanner extends Component {
- constructor(props) {
- super(props)
- this.state={
- Forkvisible: false,
- Senttothetype:false,
- Senttothevcalue:undefined,
- courses_count:1,
- course_list:[],
- pagenum:1,
- publishbox:"",
- publishboxstatus:0,
- pages:1,
- Issuevisible:false,
- evaluation_set_position:[],
- tag_position:[],
- Forkauthentication:false,
- can_fork:undefined,
- certi_url:undefined,
- showradios:false,
- startbtn:false,
- Searchvalue:"",
- startshixunCombattype:false,
- shixunsmessage:"",
- shixunsreplace:false,
- hidestartshixunsreplacevalue:"",
- isIE:false,
- Forkvisibletype: false,
- isSpin:false,
- Senttothevcaluetype:false
+ constructor(props) {
+ super(props)
+ this.state = {
+ Forkvisible: false,
+ Senttothetype: false,
+ Senttothevcalue: undefined,
+ courses_count: 1,
+ course_list: [],
+ pagenum: 1,
+ publishbox: "",
+ publishboxstatus: 0,
+ pages: 1,
+ Issuevisible: false,
+ evaluation_set_position: [],
+ tag_position: [],
+ Forkauthentication: false,
+ can_fork: undefined,
+ certi_url: undefined,
+ showradios: false,
+ startbtn: false,
+ Searchvalue: "",
+ startshixunCombattype: false,
+ shixunsmessage: "",
+ shixunsreplace: false,
+ hidestartshixunsreplacevalue: "",
+ isIE: false,
+ Forkvisibletype: false,
+ isSpin: false,
+ Senttothevcaluetype: false,
+ jupyterbool: false,
+ openknow:false,
+ openshowpublictype:false
+ }
+ }
+
+ // star_info:[0, 0, 0, 0, 0, 0],
+ // star_infos:[0, 0, 0, 0, 0, 0],
+ // shixunsDetails:{},
+ // shixunId: undefined,
+ // componentWillReceiveProps(newProps, newContext){
+ // this.setState({
+ // shixunsDetails: newProps.shixunsDetails
+ // });
+ // }
+
+ IEVersion = () => {
+ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
+ var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
+ var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
+ var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
+ if (isIE) {
+ var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
+ reIE.test(userAgent);
+ var fIEVersion = parseFloat(RegExp["$1"]);
+ if (fIEVersion == 7) {
+ return 7;
+ } else if (fIEVersion == 8) {
+ return 8;
+ } else if (fIEVersion == 9) {
+ return 9;
+ } else if (fIEVersion == 10) {
+ return 10;
+ } else {
+ return 6;//IE版本<=7
}
+ } else if (isEdge) {
+ return 'edge';//edge
+ } else if (isIE11) {
+ return 11; //IE11
+ } else {
+ return -1;//不是ie浏览器
}
-
- // star_info:[0, 0, 0, 0, 0, 0],
- // star_infos:[0, 0, 0, 0, 0, 0],
- // shixunsDetails:{},
- // shixunId: undefined,
- // componentWillReceiveProps(newProps, newContext){
- // this.setState({
- // shixunsDetails: newProps.shixunsDetails
- // });
- // }
-
- IEVersion=()=>{
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
- var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
- var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
- var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
- if(isIE) {
- var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
- reIE.test(userAgent);
- var fIEVersion = parseFloat(RegExp["$1"]);
- if(fIEVersion == 7) {
- return 7;
- } else if(fIEVersion == 8) {
- return 8;
- } else if(fIEVersion == 9) {
- return 9;
- } else if(fIEVersion == 10) {
- return 10;
- } else {
- return 6;//IE版本<=7
- }
- } else if(isEdge) {
- return 'edge';//edge
- } else if(isIE11) {
- return 11; //IE11
+ }
+
+ openknow=()=>{
+ let storage=window.localStorage;
+ this.setState({
+ openknow:false
+ })
+ storage.setItem("shixunopenprocess",true);
+ }
+
+ openshowpublic=()=>{
+ let storage=window.localStorage;
+ this.setState({
+ openshowpublictype:false
+ })
+ storage.setItem("openopenpublictype",true);
+ }
+
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps != this.props) {
+ let shixunopenprocess=window.localStorage.shixunopenprocess;
+ let openopenpublictype=window.localStorage.openopenpublictype;
+ if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){
+ if(shixunopenprocess===undefined||shixunopenprocess===false){
+ this.setState({
+ openknow:true
+ })
}else{
- return -1;//不是ie浏览器
+ this.setState({
+ openknow:false
+ })
}
- }
- componentDidMount() {
- let thiisie=this.IEVersion();
- if(thiisie!=-1){
+ }
+
+ if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 2 && this.props.shixunsDetails&&this.props.shixunsDetails.public===0 && this.props.identity < 5){
+ if(openopenpublictype===undefined||openopenpublictype===false){
this.setState({
- isIE:true
+ openshowpublictype:true
})
- }else{
+ }else{
this.setState({
- isIE:false
+ openshowpublictype:false
})
+ }
}
}
- /*
- * Fork
- * */
- copyForkvisible = () => {
- let {shixunsDetails} = this.props;
- if (shixunsDetails.can_fork === null) {
- this.setState({
- Forkvisible: true
- })
- } else {
- this.setState({
- Forkvisible: false,
- Forkauthentication: true,
- can_fork: shixunsDetails.can_fork.can_fork,
- certi_url: shixunsDetails.can_fork.certi_url,
- })
- }
+ }
+ componentDidMount() {
+ let thiisie = this.IEVersion();
+ if (thiisie != -1) {
+ this.setState({
+ isIE: true
+ })
+ } else {
+ this.setState({
+ isIE: false
+ })
+ }
+ }
+
+ /*
+ * Fork
+ * */
+ copyForkvisible = () => {
+ let {shixunsDetails} = this.props;
+ if (shixunsDetails.can_fork === null) {
+ this.setState({
+ Forkvisible: true
+ })
+ } else {
+ this.setState({
+ Forkvisible: false,
+ Forkauthentication: true,
+ can_fork: shixunsDetails.can_fork.can_fork,
+ certi_url: shixunsDetails.can_fork.certi_url,
+ })
}
- hideForkvisible = () => {
+ }
+
+ hideForkvisible = () => {
+ this.setState({
+ Forkvisible: false,
+ Forkauthentication: false
+ })
+ }
+
+ addForkvisible = () => {
+ this.setState({
+ Forkvisibletype: true,
+ })
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/copy.json";
+ axios.post(url).then((response) => {
+ if (response.data.status === 401) {
+
+ } else {
this.setState({
- Forkvisible: false,
- Forkauthentication:false
+ Forkvisible: false,
+ Forkauthentication: false,
+ // Forkvisibletype:false
})
+ window.location.href = "/shixuns/" + response.data.shixun + "/challenges";
+ }
+
+ }).catch((error) => {
+ console.log(error)
+ });
+
+ }
+ /*
+ * 发送至按钮
+ * */
+ Senttothe = () => {
+ if (this.props.checkIfLogin() === false) {
+ this.props.showLoginDialog()
+ return
}
- addForkvisible = () => {
+ // if(this.props.checkIfProfileCompleted()===false){
+ // this.setState({
+ // AccountProfiletype:true
+ // })
+ // return
+ // }
+ //
+ // if(this.props.checkIfProfessionalCertification()===false){
+ // this.setState({
+ // AccountProfiletype:true
+ // })
+ // return
+ // }
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/search_user_courses.json";
+ this.setState({
+ Senttothetype: true
+ })
+
+ axios.get(url, {
+ params: {
+ page: 1,
+ limit: 10
+ }
+ }).then((response) => {
this.setState({
- Forkvisibletype: true,
+ courses_count: response.data.courses_count,
+ course_list: response.data.course_list
})
- let id = this.props.match.params.shixunId;
- let url = "/shixuns/" + id + "/copy.json";
- axios.post(url).then((response) => {
- if(response.data.status===401){
-
- }else{
- this.setState({
- Forkvisible: false,
- Forkauthentication: false,
- // Forkvisibletype:false
- })
- window.location.href = "/shixuns/" + response.data.shixun + "/challenges";
- }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ SenttotheSearch = (value) => {
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/search_user_courses.json?search=" + value;
+ axios.get(encodeURI(url), {
+ params: {
+ page: 1,
+ limit: 10
+ }
+ }).then((response) => {
+ this.setState({
+ courses_count: response.data.courses_count,
+ course_list: response.data.course_list,
+ pages: 1,
+ Searchvalue: value
+ })
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ onChangeSenttothevcalue = (e) => {
+ this.setState({
+ Senttothevcalue: e.target.value
+ })
+ }
+ onChangesendeSenttothe = (pageNumber) => {
+ let {Searchvalue} = this.state;
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/search_user_courses.json?search=" + Searchvalue;
+ axios.get(url, {
+ params: {
+ page: pageNumber,
+ limit: 10
+ }
+ }).then((response) => {
+ this.setState({
+ courses_count: response.data.courses_count,
+ course_list: response.data.course_list,
+ pagenum: pageNumber,
+ pages: pageNumber
+ })
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+ sendeSenttothevcalue = () => {
- }).catch((error) => {
- console.log(error)
- });
+ let {Senttothevcalue} = this.state;
+ if (Senttothevcalue === undefined) {
+ this.setState({
+ Senttothevcaluetype: true
+ })
+ return
}
- /*
- * 发送至按钮
- * */
- Senttothe=()=>{
- if(this.props.checkIfLogin()===false){
- this.props.showLoginDialog()
- return
- }
-
- // if(this.props.checkIfProfileCompleted()===false){
- // this.setState({
- // AccountProfiletype:true
- // })
- // return
- // }
- //
- // if(this.props.checkIfProfessionalCertification()===false){
- // this.setState({
- // AccountProfiletype:true
- // })
- // return
- // }
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/search_user_courses.json";
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/send_to_course.json";
+ axios.post(url, {
+ course_id: Senttothevcalue
+ }).then((response) => {
+
+ this.props.showSnackbar(response.data.message);
+ this.setState({
+ Senttothetype: false,
+ Searchvalue: "",
+ pages: 1
+ })
+ // window.location.href = response.data.url;
+ // response.data.course_id
+ this.props.history.replace(response.data.first_category_url);
+
+ }).catch((error) => {
+ console.log(error)
+ });
+
+ }
+
+ hideSenttothevcalue = () => {
+ this.setState({
+ Senttothetype: false,
+ Searchvalue: "",
+ pages: 1
+ })
+
+
+ }
+
+ /*
+ * 撤销发布按钮
+ * */
+
+ ModalCancel = () => {
+ this.setState({
+ Modalstype: false,
+ Modalstopval: "",
+ modalsMidval:undefined,
+ ModalsBottomval:"",
+ modalstyles:"",
+ })
+ }
+ ModalSave = () => {
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/cancel_publish.json";
+ axios.get(url).then((response) => {
+ this.props.showSnackbar(response.data.message);
+ window.location.reload()
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ cancel_publish = () => {
+ this.setState({
+ Modalstype: true,
+ Modalstopval: "是否确认撤销发布?",
+ modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
+ ModalsBottomval:"卡,学员需要重新体验课程",
+ ModalCancel: this.ModalCancel,
+ ModalSave: this.ModalSave,
+ modalstyles:"848282"
+ })
+ }
+ ModalSaveopenpublic= () => {
+ this.setState({
+ Modalstype: true,
+ Modalstopval: "公开申请已提交,请等待管理员的审核",
+ modalsMidval:"• 我们将在1-2个工作日内完成审核",
+ ModalCancel: this.eopenpublicupdatadata,
+ ModalSave: this.eopenpublicupdatadata,
+ modalstyles:"848282"
+ })
+ }
+ eopenpublicupdatadata=()=>{
+ window.location.reload()
+ }
+ openpublic=()=>{
+ let id = this.props.match.params.shixunId;
+ let url = `/shixuns/${id}/apply_public.json`;
+ axios.get(url).then((response) => {
+ if(response.data.status===0){
+ this.ModalSaveopenpublic()
+
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ ModalhidenpublicSave=()=>{
+ let id = this.props.match.params.shixunId;
+ let url = `/shixuns/${id}/cancel_apply_public.json`;
+ axios.get(url).then((response) => {
+ if(response.data.status===0){
+ window.location.reload()
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ hidenpublic=()=>{
+ this.setState({
+ Modalstype: true,
+ Modalstopval: "是否确认撤销申请公开?",
+ modalsMidval:" ",
+ ModalsBottomval:" ",
+ ModalCancel: this.ModalCancel,
+ ModalSave: this.ModalhidenpublicSave,
+ })
+
+ }
+ /*
+ * 申请发布按钮
+ * */
+ applyrelease = () => {
+ let id = this.props.match.params.shixunId;
+ let url = "/shixuns/" + id + "/publish.json";
+ axios.get(url).then((response) => {
+ let evaluation_set_position
+ if (response.data.evaluation_set_position === null) {
+ evaluation_set_position = []
+ } else {
+ evaluation_set_position = response.data.evaluation_set_position
+ }
+ if(response.data.status===0){
+ window.location.reload()
+ }else{
this.setState({
- Senttothetype:true
+ Issuevisible: true,
+ tag_position: response.data.tag_position,
+ evaluation_set_position: evaluation_set_position,
+ publishboxstatus: response.data.status,
})
+ }
- axios.get(url, {
- params: {
- page:1,
- limit:10
- }}).then((response) => {
- this.setState({
- courses_count:response.data.courses_count,
- course_list:response.data.course_list
- })
- }).catch((error) => {
- console.log(error)
- });
+ }).catch((error) => {
+ console.log(error)
+ });
+ };
+
+ hiddenIssuevisible = (val) => {
+ this.setState({
+ Issuevisible: false
+ })
+ if (val === 0 || val === 1) {
+ window.location.reload()
}
- SenttotheSearch=(value)=>{
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/search_user_courses.json?search="+value;
- axios.get(encodeURI(url), {
- params: {
- page:1,
- limit:10
- }}).then((response) => {
- this.setState({
- courses_count:response.data.courses_count,
- course_list:response.data.course_list,
- pages:1,
- Searchvalue:value
- })
- }).catch((error) => {
- console.log(error)
- });
- }
+ }
+
+ //重置按钮
+ // resetshixunCombat=(id)=>{
+ // let zrl="/myshixuns/"+id+"/reset_my_game.json";
+ // axios.get(zrl).then((response) => {
+ // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
+ // message.success('重置成功');
+ // }).catch((error) => {
+ // console.log(error)
+ // });
+ // }
+
+ // reset_my_game
+ hidestartshixunsreplace = (url) => {
+ this.setState({
+ isSpin: true,
+ })
+ axios.get(url).then((response) => {
+ if (response.status === 200) {
+ // let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
+ // this.props.history.push(path);
+ message.success('重置成功,正在进入实训!');
+ this.startshixunCombat(response.data.shixun_identifier, 1);
+ this.setState({
+ shixunsreplace: false,
+ isSpin: false,
+ })
- onChangeSenttothevcalue=(e)=>{
- this.setState({
- Senttothevcalue:e.target.value
- })
- }
- onChangesendeSenttothe=(pageNumber)=>{
- let{Searchvalue}=this.state;
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue;
- axios.get(url, {
- params: {
- page:pageNumber,
- limit:10
- }}).then((response) => {
- this.setState({
- courses_count:response.data.courses_count,
- course_list:response.data.course_list,
- pagenum: pageNumber,
- pages: pageNumber
- })
- }).catch((error) => {
- console.log(error)
- });
- }
- sendeSenttothevcalue=()=>{
-
- let {Senttothevcalue}=this.state;
-
- if(Senttothevcalue===undefined){
- this.setState({
- Senttothevcaluetype:true
- })
- return
- }
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/send_to_course.json";
- axios.post(url,{
- course_id:Senttothevcalue
- }).then((response) => {
-
- this.props.showSnackbar(response.data.message);
- this.setState({
- Senttothetype:false,
- Searchvalue:"",
- pages:1
- })
- // window.location.href = response.data.url;
- // response.data.course_id
- this.props.history.replace(response.data.first_category_url);
+ // message.success('重置成功,正在进入实训!');
+ // this.startshixunCombat();
+ }
+ }
+ ).catch((error) => {
+ this.setState({
+ startbtn: false,
+ shixunsreplace: false,
+ isSpin: false
+ })
+ });
- }).catch((error) => {
- console.log(error)
- });
+ }
- }
- hideSenttothevcalue=()=>{
+ //开始实战按钮
+ startshixunCombat = (id, reset) => {
+
+ if(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true){
+ if (this.props.checkIfLogin() === false) {
+ this.props.showLoginDialog()
+ return
+ }
+
+ if (this.props.checkIfProfileCompleted() === false) {
this.setState({
- Senttothetype:false,
- Searchvalue:"",
- pages:1
+ AccountProfiletype: true
})
+ return
+ }
+ // if(this.props.checkIfProfessionalCertification()===false){
+ // this.setState({
+ // AccountProfiletype:true
+ // })
+ // return
+ // }
- }
-
- /*
- * 撤销发布按钮
- * */
-
- ModalCancel=()=>{
- this.setState({
- Modalstype:false
- })
- }
- ModalSave=()=>{
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/cancel_publish.json";
- axios.get(url).then((response) => {
- this.props.showSnackbar(response.data.message);
- window.location.reload()
- }).catch((error) => {
- console.log(error)
- });
- }
- cancel_publish=()=>{
- this.setState({
- Modalstype:true,
- Modalstopval:"是否确认撤销发布?",
- ModalCancel:this.ModalCancel,
- ModalSave:this.ModalSave,
- })
- }
+ let {shixunsDetails} = this.props
+ if (shixunsDetails.shixun_status > 1) {
+ this.setState({
+ startbtn: true,
+ hidestartshixunsreplacevalue: ""
+ })
+ } else {
+ this.setState({
+ hidestartshixunsreplacevalue: ""
+ })
+ }
- /*
- * 申请发布按钮
- * */
- applyrelease=()=>{
- let id = this.props.match.params.shixunId;
- let url="/shixuns/" + id +"/publish.json";
- axios.get(url).then((response) => {
- let evaluation_set_position
- if(response.data.evaluation_set_position===null){
- evaluation_set_position=[]
- }else{
- evaluation_set_position=response.data.evaluation_set_position
- }
+ let url = "/shixuns/" + id + "/jupyter_exec.json";
+ if (reset) {
+ url += '?reset=' + reset
+ }
+ axios.get(url).then((response) => {
+ if (response.status === 200) {
+ if (response.data.status === -2) {
+ // this.resetshixunCombat(response.data.message);
this.setState({
- Issuevisible:true,
- tag_position:response.data.tag_position,
- evaluation_set_position:evaluation_set_position,
- publishboxstatus:response.data.status,
+ startbtn: false,
+ shixunsreplace: true,
+ hidestartshixunsreplacevalue: response.data.message + ".json"
})
- }).catch((error) => {
- console.log(error)
- });
- };
+ // this.shixunexec(response.data.message+".json")
+ } else if (response.data.status === -1) {
- hiddenIssuevisible=(val)=>{
- this.setState({
- Issuevisible:false
- })
- if(val===0||val===1){
- window.location.reload()
- }
+ } else if (response.data.status === -3) {
+ this.setState({
+ shixunsmessage: response.data.message,
+ startshixunCombattype: true,
+ startbtn: false
+ })
+ } else {
+ // let path="/tasks/"+response.data.game_identifier;
+ // this.props.history.push(path);
- }
- //重置按钮
- // resetshixunCombat=(id)=>{
- // let zrl="/myshixuns/"+id+"/reset_my_game.json";
- // axios.get(zrl).then((response) => {
- // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
- // message.success('重置成功');
- // }).catch((error) => {
- // console.log(error)
- // });
- // }
+ // this.context.router.history.push(path);
+ if (response.data.status != 401) {
+ window.location.href = "/tasks/" + response.data.identifier+`/jupyter`;
+ }
- // reset_my_game
- hidestartshixunsreplace=(url)=>{
+ }
+ }
+ }).catch((error) => {
this.setState({
- isSpin:true,
+ startbtn: false
})
- axios.get(url).then((response) => {
- if(response.status===200){
- // let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
- // this.props.history.push(path);
- message.success('重置成功,正在进入实训!');
- this.startshixunCombat(response.data.shixun_identifier, 1);
- this.setState({
- shixunsreplace:false,
- isSpin:false,
- })
-
- // message.success('重置成功,正在进入实训!');
- // this.startshixunCombat();
- }}
- ).catch((error) => {
- this.setState({
- startbtn:false,
- shixunsreplace:false,
- isSpin:false
- })
- });
-
- }
-
+ });
+ }else{
+ if (this.props.checkIfLogin() === false) {
+ this.props.showLoginDialog()
+ return
+ }
- //开始实战按钮
- startshixunCombat=(id, reset)=>{
+ if (this.props.checkIfProfileCompleted() === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return
+ }
- if(this.props.checkIfLogin()===false){
- this.props.showLoginDialog()
- return
- }
+ // if(this.props.checkIfProfessionalCertification()===false){
+ // this.setState({
+ // AccountProfiletype:true
+ // })
+ // return
+ // }
- if(this.props.checkIfProfileCompleted()===false){
- this.setState({
- AccountProfiletype:true
- })
- return
- }
+ let {shixunsDetails} = this.props
+ if (shixunsDetails.shixun_status > 1) {
+ this.setState({
+ startbtn: true,
+ hidestartshixunsreplacevalue: ""
+ })
+ } else {
+ this.setState({
+ hidestartshixunsreplacevalue: ""
+ })
+ }
- // if(this.props.checkIfProfessionalCertification()===false){
- // this.setState({
- // AccountProfiletype:true
- // })
- // return
- // }
- let {shixunsDetails} = this.props
- if( shixunsDetails.shixun_status>1){
- this.setState({
- startbtn:true,
- hidestartshixunsreplacevalue:""
- })
- }else{
+ let url = "/shixuns/" + id + "/shixun_exec.json";
+ if (reset) {
+ url += '?reset=' + reset
+ }
+ axios.get(url).then((response) => {
+ if (response.status === 200) {
+ if (response.data.status === -2) {
+ // this.resetshixunCombat(response.data.message);
this.setState({
- hidestartshixunsreplacevalue:""
+ startbtn: false,
+ shixunsreplace: true,
+ hidestartshixunsreplacevalue: response.data.message + ".json"
})
- }
+ // this.shixunexec(response.data.message+".json")
+ } else if (response.data.status === -1) {
-
- let url="/shixuns/"+id+"/shixun_exec.json" ;
- if (reset) {
- url += '?reset=' + reset
- }
- axios.get(url).then((response) => {
- if(response.status===200){
- if(response.data.status===-2){
- // this.resetshixunCombat(response.data.message);
- this.setState({
- startbtn:false,
- shixunsreplace:true,
- hidestartshixunsreplacevalue:response.data.message+".json"
- })
- // this.shixunexec(response.data.message+".json")
- }else if(response.data.status===-1){
- console.log(response)
- }else if(response.data.status===-3){
- this.setState({
- shixunsmessage:response.data.message,
- startshixunCombattype:true,
- startbtn:false
- })
- }else{
- // let path="/tasks/"+response.data.game_identifier;
- // this.props.history.push(path);
-
-
- // this.context.router.history.push(path);
- if(response.data.status!=401){
- window.location.href = "/tasks/"+response.data.game_identifier;
- }
-
- }
- }
- }).catch((error) => {
+ } else if (response.data.status === -3) {
this.setState({
- startbtn:false
+ shixunsmessage: response.data.message,
+ startshixunCombattype: true,
+ startbtn: false
})
- });
- }
+ } else {
+ // let path="/tasks/"+response.data.game_identifier;
+ // this.props.history.push(path);
- tocertification=()=>{
- let{certi_url}=this.state;
- this.setState({
- Forkauthentication:false
- })
- window.location.href=certi_url;
- }
- SenttotheValue=(e)=>{
- this.setState({
- Searchvalue:e.target.value
- })
- }
+ // this.context.router.history.push(path);
+ if (response.data.status != 401) {
+ window.location.href = "/tasks/" + response.data.game_identifier;
+ }
- hidestartshixunCombattype=()=>{
+ }
+ }
+ }).catch((error) => {
this.setState({
- startshixunCombattype:false
+ startbtn: false
})
+ });
}
- hideAccountProfile=()=>{
- this.setState({
- AccountProfiletype:false
- })
- }
-
-
- showonMouseOver=()=>{
- $("#ratePanel").show();
- this.setState({
- showradios:true
- })
- }
-
- hideonMouseOut=()=>{
- $("#ratePanel").hide();
- this.setState({
- showradios:false
- })
- }
-
- render() {
- let {
- Forkvisible,
- Senttothetype,
- Senttothevcalue,
- evaluation_set_position,
- Forkauthentication,
- can_fork,
- certi_url,
- tag_position,
- courses_count,
- course_list,
- Issuevisible,
- publishboxstatus,
- showradios,
- startbtn,
- Searchvalue,
- startshixunCombattype,
- shixunsmessage,
- pages,
- shixunsreplace,
- hidestartshixunsreplacevalue,
- Forkvisibletype,
- AccountProfiletype,
- isIE} = this.state;
- let {shixunsDetails, shixunId, star_info, star_infos} = this.props;
- let challengeBtnTipText = '';
- let challengeBtnText = '模拟实战';
- // let star_info=[]
+
+ }
+
+ tocertification = () => {
+ let {certi_url} = this.state;
+ this.setState({
+ Forkauthentication: false
+ })
+ window.location.href = certi_url;
+ }
+
+ SenttotheValue = (e) => {
+ this.setState({
+ Searchvalue: e.target.value
+ })
+ }
+
+ hidestartshixunCombattype = () => {
+ this.setState({
+ startshixunCombattype: false
+ })
+ }
+
+ hideAccountProfile = () => {
+ this.setState({
+ AccountProfiletype: false
+ })
+ }
+
+
+ showonMouseOver = () => {
+ $("#ratePanel").show();
+ this.setState({
+ showradios: true
+ })
+ }
+
+ hideonMouseOut = () => {
+ $("#ratePanel").hide();
+ this.setState({
+ showradios: false
+ })
+ }
+
+ render() {
+ let {
+ Forkvisible,
+ Senttothetype,
+ Senttothevcalue,
+ evaluation_set_position,
+ Forkauthentication,
+ can_fork,
+ certi_url,
+ tag_position,
+ courses_count,
+ course_list,
+ Issuevisible,
+ publishboxstatus,
+ showradios,
+ startbtn,
+ Searchvalue,
+ startshixunCombattype,
+ shixunsmessage,
+ pages,
+ shixunsreplace,
+ hidestartshixunsreplacevalue,
+ Forkvisibletype,
+ AccountProfiletype,
+ isIE
+ } = this.state;
+ let {shixunsDetails, shixunId, star_info, star_infos} = this.props;
+ let challengeBtnTipText = '';
+ let challengeBtnText = '模拟实战';
+ // let star_info=[]
// if (shixunsDetails.status === 0) {
//
// } else if (shixunsDetails.status === 1) {
@@ -544,265 +733,275 @@ class TPMBanner extends Component {
// challengeBtnTipText = '开始学习并完成实战任务'
//
// }
- if(shixunsDetails!=undefined){
- if (shixunsDetails.shixun_status === 0 ) {
- challengeBtnText = '继续实战'
- } else if (shixunsDetails.shixun_status === 1) {
- challengeBtnText = '查看实战'
- } else if (shixunsDetails.shixun_status === 3) {
- challengeBtnText = '继续实战'
- }else{
- challengeBtnText = "开始实战"
- }
+ if (shixunsDetails != undefined) {
+ if (shixunsDetails.shixun_status === 0) {
+ challengeBtnText = '继续实战'
+ } else if (shixunsDetails.shixun_status === 1) {
+ challengeBtnText = '查看实战'
+ } else if (shixunsDetails.shixun_status === 3) {
+ challengeBtnText = '继续实战'
+ } else {
+ challengeBtnText = "开始实战"
}
+ }
- // let list=shixunsDetails.task_operation;
- // if(list!=undefined){
- // if (shixunsDetails.status === 0 ) {
- // for(var i=0; i
;
+ const MyRate = ({defaultValue, ...rest}) => {
+ let myValue = defaultValue;
+ // console.log(myValue-Math.floor(myValue))
+ // if (myValue < Math.ceil(myValue)) {
+ // myValue = Math.floor(myValue) + 0.5;
// }
- const radioStyle = {
- display: 'block',
- height: '30px',
- lineHeight: '30px',
- };
-
- const antIcon =
;
- const MyRate = ({ defaultValue, ...rest }) => {
- let myValue = defaultValue;
- // console.log(myValue-Math.floor(myValue))
- // if (myValue < Math.ceil(myValue)) {
- // myValue = Math.floor(myValue) + 0.5;
- // }
-
- return
;
- };
- return (
-
- shixunsDetails===undefined?"":
-
-
-
- {AccountProfiletype===true?
this.hideAccountProfile()}
- {...this.props}
- {...this.state}
- />:""}
-
-
- {this.state.Modalstype===true?:""}
-
-
-
+
+ return ;
+ };
+ //
+ // console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter)
+
+ return (
+
+ shixunsDetails === undefined ? "" :
+
+
+
+ {AccountProfiletype === true ?
this.hideAccountProfile()}
+ {...this.props}
+ {...this.state}
+ /> : ""}
+
+
+ {this.state.Modalstype === true ? : ""}
+
+
+
{shixunsDetails.name}
{
- shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" :
-
-
-
+ shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" :
+
+
+
}
-
-
- {/**/}
-
- -
- 学习人数
- {shixunsDetails.stu_num}
-
- {/*- */}
- {/*经验值*/}
- {/*{shixunsDetails.experience}*/}
- {/*
*/}
- -
- 难度系数
- {shixunsDetails.diffcult}
-
-
+
+
+ {/**/}
+
+ -
+ 学习人数
+ {shixunsDetails.stu_num}
+
+ {/*- */}
+ {/*经验值*/}
+ {/*{shixunsDetails.experience}*/}
+ {/*
*/}
+ -
+ 难度级别
+ {shixunsDetails.diffcult}
+
+
-
-
{
- startbtn === false && shixunsDetails.shixun_status != -1 ?
-
- this.startshixunCombat(this.props.match.params.shixunId)}
- className="fr user_default_btn task-btn-orange font-18"
- id="shixun_operation" data-remote="true"
- >
- {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"}
-
-
- : ""
+ startbtn === false && shixunsDetails.shixun_status != -1 ?
+
+ this.startshixunCombat(this.props.match.params.shixunId)}
+ className="fr user_default_btn task-btn-orange font-18"
+ id="shixun_operation" data-remote="true"
+ >
+ {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"}
+
+
+ : ""
}
-
-
目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
-
-
- {/**/}
- {/*知道了*/}
- {/*
*/}
+
+
目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
+
+
+ {/**/}
+ {/*知道了*/}
+ {/*
*/}
-
+
-
实训已经更新了,正在为您重置!
+
实训已经更新了,正在为您重置!
-
+
-
+
{
- startbtn === true ?
-
开启中 : ""
+ startbtn === true ?
+
开启中 : ""
}
{/*{*/}
@@ -814,172 +1013,220 @@ class TPMBanner extends Component {
{/*}*/}
{shixunsDetails.shixun_status === 0 && this.props.identity < 5 ?
-
申请发布 : ""
+
+ 您编辑完成后,可以马上使用到自
+ 己的课堂和实训课程哦
+
+
+ }
+ trigger="click"
+ placement="bottom"
+ visible={this.state.openknow}
+ >
+
+ 发布
+
+ : ""
}
- {
- publishboxstatus === 0 ?
-
- 发布申请已提交,请等待管理员的审核
-
-
: publishboxstatus === 1 ?
-
-
- 发布申请已提交,请等待管理员的审核
- • 我们将在1-2个工作日内完成审核
-
-
: publishboxstatus === 2 ?
-
- 第
- {
- evaluation_set_position.map((item, key) => {
- return (
- {item},
- )
- })
- }
- 关评测设置尚未完成,无法申请发布
-
-
: publishboxstatus === 3 ?
-
-
- 每一个关卡至少需要一个技能标签
- 第
- {
- tag_position.map((item, key) => {
- return (
- {item},
- )
- })
- }
- 关尚未设置技能标签,请补充
-
-
:
-
- }
-
+ {
+ publishboxstatus === 0 ?
+
+ 发布申请已提交,请等待管理员的审核
+
+
: publishboxstatus === 1 ?
+
+
+ 发布申请已提交,请等待管理员的审核
+ • 我们将在1-2个工作日内完成审核
+
+
: publishboxstatus === 2 ?
+
+ 第
+ {
+ evaluation_set_position.map((item, key) => {
+ return (
+ {item},
+ )
+ })
+ }
+ 关评测设置尚未完成,无法申请发布
+
+
: publishboxstatus === 3 ?
+
+
+ 每一个关卡至少需要一个技能标签
+ 第
+ {
+ tag_position.map((item, key) => {
+ return (
+ {item},
+ )
+ })
+ }
+ 关尚未设置技能标签,请补充
+
+
:
+
+ }
+
- {shixunsDetails.shixun_status === 1 && this.props.identity < 5 ?
-
撤销发布 : ""
+ {shixunsDetails.shixun_status === 2 && shixunsDetails.public===0 && this.props.identity < 5 ?
+
+ 平台审核完成后,您的实训将会录入到平台的公共实训项目列表
+ 您将获得实训对应的经验值和金币~
+
+
+ }
+ trigger="click"
+ placement="bottom"
+ visible={this.state.openshowpublictype}
+ >
+
+
+
+ : ""
+ }
+
+ {shixunsDetails.shixun_status === 2 && shixunsDetails.public===1 && this.props.identity < 5 ?
+
+
+ : ""
+ }
+
+ {shixunsDetails.shixun_status === 2 && shixunsDetails.public===0 && this.props.identity < 5 ?
+
+ 撤销发布
+
+ : ""
}
{
-
-
- 发送至
-
-
+
+
+ 发送至
+
+
}
-
-
-
-
- 选择的实训将会发送到指定课堂
-
-
-
- this.SenttotheSearch(value)}
- style={{width: '100%'}}
- />
-
-
-
-
12?"cdefault ":"cdefault "}>
-
-
-
- {
- course_list === undefined ? "" : course_list.map((item, key) => {
- return (
- {item.name}
- )
- })
- }
-
-
-
-
- {this.state.Senttothevcaluetype===true?
请选择你要发送的课堂
:""}
-
12 ? "block" : "none"}}>
-
-
-
-
-
-
-
+
+
+
12 ? "cdefault " : "cdefault "}>
+
+
+
+ {
+ course_list === undefined ? "" : course_list.map((item, key) => {
+ return (
+ {item.name}
+ )
+ })
+ }
+
+
+
+
+ {this.state.Senttothevcaluetype === true ?
请选择你要发送的课堂
: ""}
+
12 ? "block" : "none"}}>
+
+
+
+
+
-
+
{shixunsDetails.shixun_status === 3 &&
- 已关闭
+ 已关闭
}
- {shixunsDetails.shixun_status === -1 &&
- 已删除
- }
+ {shixunsDetails.shixun_status === -1 &&
+ 已删除
+ }
- {this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?
-
+ {this.props.identity < 5 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0?
+
+
-
- {Forkvisibletype===true?
+ {Forkvisibletype === true ?
- :
+ :
-
复制将在后台执行,平台将为你创建
一个新的同名实训和内容,请问是否继续?
-
-
+
复制将在后台执行,平台将为你创建
一个新的同名实训和内容,请问是否继续?
+
+
}
@@ -1016,40 +1263,41 @@ class TPMBanner extends Component {
-
-
+
+
{!!shixunsDetails.fork_num &&
-
- {shixunsDetails.fork_num}
+
+ {shixunsDetails.fork_num}
}
-
:""}
+ : ""}
+
+
+
+
正在等待管理员的审核。在审核通过前,可以随时撤销发布
+
-
- 正在等待管理员的审核。在审核通过前,可以随时撤销发布
-
-
- );
- }
+ );
+ }
}
export default TPMBanner;
diff --git a/public/react/src/modules/tpm/TPMChallenge.js b/public/react/src/modules/tpm/TPMChallenge.js
index 847e8b965..5c6e1a16a 100644
--- a/public/react/src/modules/tpm/TPMChallenge.js
+++ b/public/react/src/modules/tpm/TPMChallenge.js
@@ -1,54 +1,63 @@
-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 Challenges from './shixunchild/Challenges/Challenges'
-
-import TPMRightSection from './component/TPMRightSection'
-
-import TPMNav from './component/TPMNav'
-
-class TPMChallenge extends Component {
- constructor(props) {
- super(props)
-
- }
-
- render() {
- const { loadingContent, shixun, user, match
- } = this.props;
- return (
-
-
-
-
- );
- }
-}
-
-export default TPMChallenge;
+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 Challenges from './shixunchild/Challenges/Challenges'
+import Challengesjupyter from './shixunchild/Challenges/Challengesjupyter'
+import TPMRightSection from './component/TPMRightSection'
+
+import TPMNav from './component/TPMNav'
+
+class TPMChallenge extends Component {
+ constructor(props) {
+ super(props)
+
+ }
+
+ render() {
+ const { loadingContent, shixun, user, match,jupyterbool,is_jupyter
+ } = this.props;
+ return (
+
+
+
+
+
+ {
+ is_jupyter===true?
+
+ :
+
+ }
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default TPMChallenge;
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
new file mode 100644
index 000000000..619dea9e1
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMDataset.js
@@ -0,0 +1,630 @@
+import React, {Component} from 'react';
+import {Redirect} from 'react-router';
+import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,notification} from 'antd';
+import { NoneData } from 'educoder'
+
+import TPMRightSection from './component/TPMRightSection';
+import TPMNav from './component/TPMNav';
+import axios from 'axios';
+import './tpmmodel/tpmmodel.css'
+import {getUploadActionUrltwo,appendFileSizeToUploadFileAll} from 'educoder';
+import moment from 'moment';
+import Tpmdatasetmodel from "./tpmmodel/Tpmdatasetmodel";
+
+const confirm = Modal.confirm;
+
+class TPMDataset extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ value: undefined,
+ columns: [
+ {
+ title: '文件',
+ dataIndex: 'title',
+ key: 'title',
+ align: 'left',
+ className: " font-14 wenjiantit",
+ width: '220px',
+ render: (text, record) => (
+
+ {record.title}
+
+ )
+ },
+ {
+ title: '最后修改时间',
+ dataIndex: 'timedata',
+ key: 'timedata',
+ align: 'center',
+ className: "edu-txt-center font-14 zuihoushijian",
+ width: '150px',
+ render: (text, record) => (
+
+ {record.timedata}
+
+ )
+ },
+ {
+ title: '最后修改人',
+ dataIndex: 'author',
+ key: 'author',
+ align: 'center',
+ className: "edu-txt-center font-14 ",
+ render: (text, record) => (
+
+ {record.author}
+
+ )
+ },
+ {
+ title: '文件大小',
+ dataIndex: 'filesize',
+ key: 'filesize',
+ align: 'center',
+ className: "edu-txt-center font-14 ",
+ render: (text, record) => (
+
+ {record.filesize}
+
+ )
+ },
+ ],
+ page: 1,
+ limit: 10,
+ selectedRowKeys: [],
+ mylistansum:30,
+ collaboratorList:[],
+ fileList:[],
+ fileListimgs:[],
+ file:null,
+ datalist:[],
+ data_sets_count:0,
+ selectedRowKeysdata:[],
+ loadingstate:false,
+ checked: false,
+ showmodel:false,
+ itemtypebool:false,
+ }
+ }
+
+ componentDidMount() {
+ this.setState({
+ loadingstate:true,
+ })
+ this.getdatas()
+
+ }
+
+ mysonChange = (e) => {
+ // console.log(`全选checked = ${e.target.checked}`);
+ if (e.target.checked === true) {
+ let mydata=[];
+ let datas=[];
+ for(let i=0;i {
+ let id=this.props.match.params.shixunId;
+
+ let collaborators=`/shixuns/${id}/get_data_sets.json`;
+ axios.get(collaborators,{params:{
+ page:1,
+ limit:10,
+ }}).then((response)=> {
+ if(response.status===200){
+ if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
+
+ }else{
+ let datalists=[];
+ for(let i=0;i {
+ this.setState({
+ loadingstate:false,
+ })
+ }, 500)
+
+ }).catch((error)=>{
+ setTimeout(() => {
+ this.setState({
+ loadingstate:false,
+ })
+ }, 500)
+ console.log(error)
+ });
+
+ }
+
+ getdatastwo = (page,limit) => {
+ let id=this.props.match.params.shixunId;
+
+ let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
+ axios.get(collaborators,{params:{
+ page:page,
+ limit:limit,
+ }}).then((response)=> {
+ if(response.status===200){
+ if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
+
+ }else{
+ let datalists=[];
+ for(let i=0;i {
+ this.setState({
+ loadingstate:false,
+ })
+ }, 500)
+ }).catch((error)=>{
+ setTimeout(() => {
+ this.setState({
+ loadingstate:false,
+ })
+ }, 500)
+ console.log(error)
+ });
+
+ }
+
+
+ getdatasthree = (page,limit) => {
+ let id=this.props.match.params.shixunId;
+
+ let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
+ axios.get(collaborators,{params:{
+ page:page,
+ limit:limit,
+ }}).then((response)=> {
+ if(response.status===200){
+ if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
+
+ }else{
+
+
+ }
+
+ }
+
+ }).catch((error)=>{
+
+ });
+
+ }
+
+ paginationonChanges = (pageNumber) => {
+ // //console.log('Page: ');
+ this.setState({
+ page: pageNumber,
+ loadingstate:true,
+ })
+
+ this.getdatastwo(pageNumber,10);
+ }
+
+ onSelectChange = (selectedRowKeys, selectedRows) => {
+ // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
+ this.setState(
+ {
+ selectedRowKeys
+ }
+ );
+ let mydata=[];
+ for(let i=0;i {
+ let className = 'light-row';
+ if (index % 2 === 1) className = 'dark-row';
+ return className;
+ }
+ handleChange = (info) => {
+ // console.log("handleChange123123");
+ // console.log(info);
+// debugger
+ if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
+ let fileList = info.fileList;
+ this.setState({
+ fileList: appendFileSizeToUploadFileAll(fileList),
+ });
+ if(info.file.status === 'done'){
+ //done 成功就会调用这个方法
+ this.getdatas();
+ }
+ if(info.file.response){
+ if(info.file.response.status===-1||info.file.response.status==="-1"){
+ // console.log("准备显示弹框了");
+ // console.log(info);false
+ let itemtype=-1;
+ try {
+ itemtype=info.file.response.message.indexOf('文件名已经存在'.toLowerCase());
+
+ }catch (e) {
+
+ }
+ this.setState({
+ showmodel:true,
+ tittest:info.file.response.message,
+ itemtypebool:itemtype>-1?true:itemtype<=-1?false:false,
+ })
+ }
+ }
+
+ }
+ }
+
+
+ onAttachmentRemove = (file) => {
+ // debugger
+ if(!file.percent || file.percent == 100){
+ confirm({
+ title: '确定要删除这个附件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ console.log("665")
+ this.deleteAttachment(file)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ return false;
+ }
+
+ }
+
+ deleteRemovedata(){
+
+ if(this.state.selectedRowKeysdata===undefined || this.state.selectedRowKeysdata===null ||this.state.selectedRowKeysdata.length===0){
+
+ this.props.showNotification(`请选择要删除的文件`);
+
+ return
+ }
+ let id=this.props.match.params.shixunId;
+
+ confirm({
+ title: '确定要删除文件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ const url = `/shixuns/${id}/destroy_data_sets.json`;
+ axios.delete(url,
+ { params: {
+ id:this.state.selectedRowKeysdata,
+ }}
+ )
+ .then((response) => {
+ if (response.data) {
+ const { status } = response.data;
+ if (status == 0) {
+ this.props.showNotification(`删除成功`);
+
+ this.getdatas()
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+
+ }
+ deleteAttachment = (file) => {
+ // console.log(file);
+ let id=file.response ==undefined ? file.id : file.response.id
+ const url = `/attachements/destroy_files.json`
+ axios.delete(url, {
+ id:[id],
+ })
+ .then((response) => {
+ if (response.data) {
+ const { status } = response.data;
+ if (status == 0) {
+ // console.log('--- success')
+
+ this.setState((state) => {
+
+ const index = state.fileList.indexOf(file);
+ const newFileList = state.fileList.slice();
+ newFileList.splice(index, 1);
+ return {
+ fileList: newFileList,
+ deleteisnot:true
+ };
+ });
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+
+ ModalCancel = () => {
+ this.setState({
+ showmodel: false,
+ })
+ }
+
+ ModalSave=()=>{
+ this.setState({
+ showmodel: false,
+ })
+ }
+
+ render() {
+ const {tpmLoading, shixun, user, match} = this.props;
+ const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
+ const rowSelection = {
+ selectedRowKeys,
+ onChange: this.onSelectChange,
+ };
+ // getCheckboxProps: record => ({
+ // disabled: record.name === 'Disabled User', // Column configuration not to be checked
+ // name: record.name,
+ // }),
+ let id=this.props.match.params.shixunId;
+ const uploadProps = {
+ width: 600,
+ fileList,
+ multiple: false,
+ //multiple 是否支持多选 查重的时候不能多选 不然弹许多框出来
+ // https://github.com/ant-design/ant-design/issues/15505
+ // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
+ // showUploadList: false,
+ action: `${getUploadActionUrltwo(id)}`,
+ showUploadList:false,
+ onChange: this.handleChange,
+ onRemove: this.onAttachmentRemove,
+ beforeUpload: (file) => {
+ //上传前的操作
+ // console.log('beforeUpload', file.name);
+ const isLt150M = file.size / 1024 / 1024 < 150;
+ if (!isLt150M) {
+ this.props.showNotification('文件大小必须小于150MB!');
+ }
+ return isLt150M;
+ },
+ };
+ // console.log("showmodelshowmodel");
+ // console.log(this.state.showmodel);
+ return (
+
+
+
+
+ {
+ this.state.showmodel===true?
+
this.ModalSave()} tittest={this.state.tittest} modalsType={this.state.showmodel}>
+ :""
+ }
+
+
+
+
+
+
+ 全选
+
+
+
+
+
+ {
+ data_sets_count>0?
+
0 ? "deletebutomtextcode intermediatecenter mr21" : "deletebutom intermediatecenter mr21"} onClick={()=>this.deleteRemovedata()}>
+
删除
+ :""
+ }
+
+
+
+
+ {data_sets_count===0?
+
+ :
+
+ }
+
+ {
+ data_sets_count>=11?
+
+ :""
+ }
+
+ { data_sets_count===0?
+
:""
+ }
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default TPMDataset;
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.css b/public/react/src/modules/tpm/TPMIndex.css
index e30631e1d..e86bc2d68 100644
--- a/public/react/src/modules/tpm/TPMIndex.css
+++ b/public/react/src/modules/tpm/TPMIndex.css
@@ -114,7 +114,7 @@ body>.-task-title {
/*-------------------个人主页:右侧提示区域--------------------------*/
-.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:30px;z-index: 10;}
+.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:80px !important;z-index: 10;}
.-task-sidebar>div{height: 40px;line-height: 40px;box-sizing: border-box;width:40px;background:#4CACFF;color:#fff;font-size:20px;text-align:center;margin-bottom:5px;border-radius: 4px;}
.-task-sidebar>div i{ color:#fff;}
.-task-sidebar>div i:hover{color: #fff!important;}
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js
index 7fd389197..9890c2dcf 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -22,13 +22,16 @@ import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'
import TPMsettings from './TPMsettings/TPMsettings';
+//import TPMsettings from './TPMsettings/oldTPMsettings';
+
import TPMChallengeComponent from './TPMChallengeContainer';
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent';
import TPMRanking_listComponent from './TPMRanking_listContainer';
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.$
//任务
@@ -142,13 +145,15 @@ class TPMIndex extends Component {
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
+ tpmindexjupyterbool:false,
+ is_jupyter:false,
}
}
componentDidMount = () => {
let id = this.props.match.params.shixunId;
- console.log('props', this.props);
+ // console.log('props', this.props);
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
//
// axios.get(collaborators).then((response) => {
@@ -192,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) => {
@@ -204,7 +209,8 @@ class TPMIndex extends Component {
power: undefined,
identity: undefined,
status: undefined,
- propaedeutics:undefined
+ propaedeutics:undefined,
+ is_jupyter:false,
});
});
@@ -259,8 +265,8 @@ class TPMIndex extends Component {
axios.interceptors.request.eject(this.tpmContentResponseInterceptor);
this.tpmContentResponseInterceptor = null;
}
-
-
+
+
setLoadingContent = (isLoadingContent) => {
this.setState({ loadingContent: isLoadingContent })
}
@@ -270,31 +276,42 @@ class TPMIndex extends Component {
// }
render() {
+
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
+ // console.log(this.state.is_jupyter);
return (
+ {/*头部*/}
{
- !flag &&
+ !flag &&
}
-
+ {/*筛选*/}
+ {/*{*/}
+ {/* tpmindexjupyterbool===false?*/}
+
+ {/* :""*/}
+ {/*}*/}
+ {/* */}
+
-
+
( ()
}>
( ()
}>
-
+ {/*任务*/}
( ()
}>
@@ -304,33 +321,33 @@ class TPMIndex extends Component {
}>
( ()
}>
( ()
}>
-
+
{/* */}
( ()
}>
( ()
}>
-
+
{/* */}
( (this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
@@ -342,14 +359,19 @@ class TPMIndex extends Component {
(props) => ()
}>
-
+ {/*实训项目条目塞选*/}
( ()
}>
+ {/*合作者*/}
+ ()
+ }>
( ()
}>
@@ -400,7 +422,7 @@ class TPMIndex extends Component {
}>
( ()
}>
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index 774587865..cc8e28bf7 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -23,7 +23,7 @@ const versionNum = '0001';
// let _url_origin = getUrl()
let _url_origin='';
if(window.location.port === "3007"){
- _url_origin="http://pre-newweb.educoder.net";
+ _url_origin="https://test-newweb.educoder.net";
}
// let _url_origin=`https://www.educoder.net`;
@@ -31,7 +31,7 @@ if(window.location.port === "3007"){
if (!window['indexHOCLoaded']) {
window.indexHOCLoaded = true;
//解决首屏加载问题
-
+
// $('head').append($('')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('')
@@ -51,7 +51,7 @@ if (!window['indexHOCLoaded']) {
// setTimeout(() => {
// $('head').append( $('')
// .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1525440977`) );
-
+
// $('head').append( $('')
// .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1525440977`) );
// $('head').append( $('')
@@ -60,7 +60,7 @@ if (!window['indexHOCLoaded']) {
$("script").append('')
.attr('src', `${_url_origin}/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=${versionNum}`);
-
+
}
// `${_url_origin}/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=${versionNum}`
// TODO css加载完成后再打开页面,行为和tpm其他页面一致
@@ -146,7 +146,7 @@ export function TPMIndexHOC(WrappedComponent) {
componentWillUnmount() {
window.removeEventListener('keyup', this.keyupListener)
}
-
+
componentDidMount() {
// console.log("TPMIndexHOC========");
// console.log(this.props);
@@ -216,7 +216,7 @@ export function TPMIndexHOC(WrappedComponent) {
this.getAppdata();
}
/**
- 课堂权限相关方法,暂时写这里了 ----------------------------------------START
+ 课堂权限相关方法,暂时写这里了 ----------------------------------------START
ADMIN = 0 # 超级管理员
CREATOR = 1 # 课程创建者
PROFESSOR = 2 # 课程老师
@@ -560,7 +560,7 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfProfessionalCertification = () => {
return this.state.current_user && this.state.current_user.professional_certification
}
-
+
ShowOnlinePdf = (url) => {
return axios({
@@ -642,14 +642,14 @@ export function TPMIndexHOC(WrappedComponent) {
isAdminOrCreator:this.isAdminOrCreator,
isClassManagement:this.isClassManagement,
isCourseAdmin:this.isCourseAdmin,
-
+
isAdmin: this.isAdmin,
isAdminOrTeacher: this.isAdminOrTeacher,
isStudent: this.isStudent,
isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember,
isCourseEnd: this.isCourseEnd,
-
+
isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser,
@@ -660,7 +660,7 @@ export function TPMIndexHOC(WrappedComponent) {
checkIfProfileCompleted: this.checkIfProfileCompleted,
checkIfProfessionalCertification: this.checkIfProfessionalCertification,
showProfessionalCertificationDialog: this.showProfessionalCertificationDialog,
-
+
ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url),
@@ -671,7 +671,7 @@ export function TPMIndexHOC(WrappedComponent) {
yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
-
+
};
// console.log("this.props.mygetHelmetapi");
// console.log(this.props.mygetHelmetapi);
@@ -742,7 +742,7 @@ export function TPMIndexHOC(WrappedComponent) {
}
`
}
-
+
-
+
);
}
}
-}
\ No newline at end of file
+}
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
new file mode 100644
index 000000000..070f5b156
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -0,0 +1,413 @@
+import React, {Component} from 'react';
+
+//MonacoDiffEditor 对比模式
+import {
+ Badge,
+ Select,
+ Radio,
+ Checkbox,
+ Modal,
+ DatePicker,
+ Button,
+} from 'antd';
+
+import locale from 'antd/lib/date-picker/locale/zh_CN';
+
+import moment from 'moment';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import {handleDateStrings} from "./oldTPMsettings";
+
+import Bottomsubmit from "../../modals/Bottomsubmit";
+
+const $ = window.$;
+
+let timeout;
+
+let currentValue;
+
+const Option = Select.Option;
+
+const RadioGroup = Radio.Group;
+
+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 {
+ constructor(props) {
+ super(props)
+ this.state = {
+ can_copy: false,
+ use_scope: 0,
+ opening_time: null,
+ opentime: false,
+ oldscope_partment: [],
+ scope_partment: [],
+ loading: false,
+ opening_timetype:false
+ }
+ }
+
+ componentDidMount() {
+ if (this.props.data) {
+ if (this.props.data.shixun) {
+ this.setState({
+ can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
+ use_scope: this.props.data && this.props.data.shixun.use_scope,
+ opening_time: this.props.data && this.props.data.shixun.opening_time,
+ opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
+ oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
+ })
+ }
+ }
+ let departmentsUrl = `/shixuns/departments.json`;
+ axios.get(departmentsUrl).then((response) => {
+ if (response.status === 200) {
+ if (response.data.message === undefined) {
+ this.setState({
+ departmentslist: response.data.shools_name
+ });
+ }
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps.data != this.props.data) {
+ if (this.props.data) {
+ if (this.props.data.shixun) {
+ this.setState({
+ can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
+ use_scope: this.props.data && this.props.data.shixun.use_scope,
+ opening_time: this.props.data && this.props.data.shixun.opening_time,
+ opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
+ oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
+ })
+ }
+ }
+ }
+ }
+
+ onChangeTimePicker = (value, dateString) => {
+ this.setState({
+ opening_time: dateString === "" ? "" : handleDateStrings(dateString),
+ opening_timetype:false,
+ loading: false
+ })
+ }
+
+ onSubmits = () => {
+ let {can_copy, use_scope, scope_partment, opening_time,oldscope_partment} = this.state;
+
+
+ if(this.state.opentime===true){
+ if(opening_time===null){
+ this.setState({
+ opening_timetype:true
+ })
+
+ return
+ }
+ }
+ let list=[]
+ scope_partment.map((item,key)=>{
+ list.push(item)
+ })
+
+ oldscope_partment.map((item,key)=>{
+ list.push(item)
+ })
+
+ let id = this.props.match.params.shixunId;
+ let url = `/shixuns/${id}/update_permission_setting.json`;
+
+ axios.post(url,
+ {
+ scope_partment: list,
+ shixun: {
+ can_copy: can_copy,
+ use_scope: use_scope,
+ opening_time: opening_time
+ }
+ }
+ ).then((response) => {
+ if (response.data.status === -1) {
+
+ } else {
+ this.props.showNotification("权限配置保存成功!")
+ this.setState({
+ loading: false,
+ scope_partment:[],
+ oldscope_partment:list
+ })
+ this.props.getdatas("3")
+ }
+ }).catch((error) => {
+
+
+ })
+
+ }
+ CheckboxonChange = (e) => {
+ this.setState({
+ can_copy: e.target.checked
+ })
+ }
+
+ SelectOpenpublic = (e) => {
+ this.setState({
+ use_scope: e.target.value
+ });
+ }
+
+ shixunScopeInput = (e) => {
+ let {scope_partment, oldscope_partment} = this.state;
+ let datalist = scope_partment;
+ if (datalist === undefined) {
+ datalist = []
+ }
+
+ let scopetype = false;
+
+ if(scope_partment.length>0){
+ scope_partment.map((item, key) => {
+ if (item === e) {
+ debugger
+ scopetype = true
+ }
+ })
+ }
+
+ if(oldscope_partment.length>0){
+ oldscope_partment.map((item, key) => {
+ if (item === e) {
+ debugger
+ scopetype = true
+ }
+ })
+ }
+
+
+
+ if (scopetype === false) {
+ datalist.push(e)
+ this.setState({
+ scope_partment: datalist
+ });
+ } else {
+ this.props.showNotification("请勿指定相同的单位")
+ }
+
+ }
+
+ shixunsfetch = (value, callback) => {
+ if (timeout) {
+ clearTimeout(timeout);
+ timeout = null;
+ }
+ currentValue = value;
+
+ function fake() {
+ let departmentsUrl = `/shixuns/departments.json?q=` + currentValue;
+ axios.get(departmentsUrl).then((response) => {
+ callback(response.data.shools_name);
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ timeout = setTimeout(fake, 300);
+ }
+
+ shixunHandleSearch = (value) => {
+ this.shixunsfetch(value, departmentslist => this.setState({departmentslist}));
+ }
+
+ deleteScopeInput = (key) => {
+ let {scope_partment} = this.state;
+ let datalist = scope_partment;
+ datalist.splice(key, 1);
+ this.setState({
+ scope_partment: datalist
+ });
+ }
+
+ setopentime = (e) => {
+ this.setState({
+ opentime: e.target.checked
+ })
+ }
+
+ render() {
+
+ let options;
+ if (this.state.departmentslist != undefined) {
+ options = this.state.departmentslist.map((d, k) => {
+ return (
+
+ )
+ })
+ }
+
+ const dateFormat = 'YYYY-MM-DD HH:mm';
+
+ return (
+
+
+
+ 复制:
+
+
+
+
+
+
+
+
+
公开程度:
+
+
+ 对所有单位公开 (实训发布后,所有用户可见)
+ 对指定单位公开 (实训发布后,仅对下方指定单位的用户可见)
+
+
+
+
+
+
+
+
+ {
+ this.state.oldscope_partment.map((item, key) => {
+ return (
+
+
+
+ )
+ })
+ }
+ {
+ this.state.scope_partment === undefined ? "" : this.state.scope_partment.map((item, key) => {
+
+ return (
+
+ this.deleteScopeInput(key)}>
+
+
+
+ )
+ })
+ }
+
+
+
+
+
+
+ 请选择需要公开的单位
+
+
+
+
+
+
+
+
+
+
开启时间:
+
+
+
+
+ {this.state.opentime === false ? "" :
+
+
}
+ 请选择开启时间
+
+
+
+
+
+
+
+ {this.props.identity < 5 ?
+
: ""}
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
new file mode 100644
index 000000000..681cbc956
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
@@ -0,0 +1,349 @@
+import React, {Component} from 'react';
+
+import {
+ Radio,
+ Checkbox,
+} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import Bottomsubmit from "../../modals/Bottomsubmit";
+
+const RadioGroup = Radio.Group;
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ vnc: false,
+ hide_code: false,
+ code_edit_permission: false,
+ code_hidden: false,
+ forbid_copy: false,
+ test_set_permission: true,
+ task_pass: true,
+ websshshow: false,
+ multi_webssh: false,
+ opensshRadio: null,
+ loading: false
+ }
+ }
+
+
+ componentDidMount() {
+ if (this.props.data ) {
+ if (this.props.data.shixun) {
+ this.setState({
+ vnc: this.props.data && this.props.data.shixun.vnc,
+ code_hidden: this.props.data && this.props.data.shixun.code_hidden,
+ forbid_copy: this.props.data && this.props.data.shixun.forbid_copy,
+ hide_code: this.props.data && this.props.data.shixun.hide_code,
+ task_pass: this.props.data && this.props.data.shixun.task_pass,
+ test_set_permission: this.props.data && this.props.data.shixun.test_set_permission,
+ code_edit_permission: this.props.data && this.props.data.shixun.code_edit_permission,
+ websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true,
+ multi_webssh: this.props.data && this.props.data.shixun.multi_webssh,
+ opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh,
+ })
+
+ // if(this.props.data && this.props.data.shixun.status===0){
+ // this.setState({
+ // task_pass:true
+ // })
+ // }
+
+ }
+ }
+
+ }
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps.data != this.props.data) {
+ if (this.props.data) {
+ if (this.props.data.shixun) {
+ this.setState({
+ vnc: this.props.data && this.props.data.shixun.vnc,
+ code_hidden: this.props.data && this.props.data.shixun.code_hidden,
+ forbid_copy: this.props.data && this.props.data.shixun.forbid_copy,
+ hide_code: this.props.data && this.props.data.shixun.hide_code,
+ task_pass: this.props.data && this.props.data.shixun.task_pass,
+ test_set_permission: this.props.data && this.props.data.shixun.test_set_permission,
+ code_edit_permission: this.props.data && this.props.data.shixun.code_edit_permission,
+ websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true,
+ multi_webssh: this.props.data && this.props.data.shixun.multi_webssh,
+ opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh,
+ })
+
+ // if(this.props.data && this.props.data.shixun.status===0){
+ // this.setState({
+ // task_pass:true
+ // })
+ // }
+
+ }
+ }
+ }
+ }
+
+
+ onSubmits = () => {
+ this.setState({
+ loading: true
+ })
+ let id = this.props.match.params.shixunId;
+ let url = `/shixuns/${id}/update_permission_setting.json`;
+ axios.post(url,
+ {
+ shixun: {
+ code_hidden: this.state.code_hidden,
+ forbid_copy: this.state.forbid_copy,
+ hide_code: this.state.hide_code,
+ multi_webssh: this.state.multi_webssh,
+ task_pass: this.state.task_pass,
+ test_set_permission: this.state.test_set_permission,
+ vnc: this.state.vnc,
+ webssh: this.state.websshshow === false ? 0 : this.state.opensshRadio,
+ code_edit_permission:this.state.code_edit_permission
+ },
+ }
+ ).then((response) => {
+ if (response.data.status === -1) {
+
+ } else {
+ this.props.getdatas()
+ this.props.showNotification("学习页面设置保存成功!")
+ this.setState({
+ loading: false
+ })
+ }
+ }).catch((error) => {
+ this.setState({
+ loading: false
+ })
+ })
+ }
+
+ Checkvnc = () => {
+
+ if (this.state.vnc === false) {
+ this.setState({
+ hide_code: false,
+ code_edit_permission: false,
+ code_hidden: false,
+ forbid_copy: false,
+ multi_webssh: false,
+ websshshow: false,
+ })
+ }
+ this.setState({
+ vnc: !this.state.vnc
+ })
+ }
+
+ Checkhide_code = () => {
+ if (this.state.hide_code === false) {
+ this.setState({
+ code_edit_permission: false
+ })
+ }
+ this.setState({
+ hide_code: !this.state.hide_code
+ })
+ }
+
+ Checkis_secret_repository = () => {
+ this.setState({
+ code_edit_permission: !this.state.code_edit_permission
+ })
+ }
+
+ Checkcode_hidden = () => {
+ this.setState({
+ code_hidden: !this.state.code_hidden
+ })
+ }
+
+ Checkforbid_copy = () => {
+ this.setState({
+ forbid_copy: !this.state.forbid_copy
+ })
+ }
+
+ Checktask_pass = () => {
+ this.setState({
+ task_pass: !this.state.task_pass
+ })
+ }
+
+ Checktest_set_permission = () => {
+ this.setState({
+ test_set_permission: !this.state.test_set_permission
+ })
+ }
+
+ Checkwebsshshow = () => {
+ if (this.state.websshshow === false) {
+ this.setState({
+ vnc: false,
+ opensshRadio: 1
+ })
+ } else {
+ this.setState({
+ multi_webssh: false,
+ opensshRadio: null,
+ hide_code:false
+ })
+ }
+ this.setState({
+ websshshow: !this.state.websshshow
+ })
+
+ }
+
+ Checkmulti_webssh = () => {
+ this.setState({
+ multi_webssh: !this.state.multi_webssh
+ })
+ }
+
+ opensshRadio = (e) => {
+ if (e.target.value === 1) {
+ this.setState({
+ multi_webssh: false
+ })
+ } else {
+ this.setState({
+ multi_webssh: true
+ })
+ }
+ this.setState({
+ opensshRadio: e.target.value
+ });
+ }
+
+ render() {
+ // console.log(this.props)
+ return (
+
+
+
+ {this.state.websshshow === true ? "" :
+ 开启图形化界面:
+
+
+
+
+
}
+
+ {this.state.vnc === true ? "" :
+ 命令行:
+
+
+
+
+
}
+
+
+ {this.state.vnc === true ? "" : this.state.websshshow === true ?
+
+
+ 命令行练习窗口 (选中则给学员提供用于练习操作的命令行,命令行的操作不会对学生的实验环境造成影响)
+ 命令行评测窗口 (选中则给学员提供用于评测操作的命令行,命令行的操作可以对学生的实验环境产生影响)
+
+
+
+ {this.state.opensshRadio === 2 ?
+
+
+
+
+
+
+ : ""}
+
: ""}
+
+ {this.state.vnc === true||this.state.websshshow === false ? "" :
+ 隐藏代码窗口:
+
+
+
+
+
}
+
+ {this.state.vnc === true || this.state.hide_code === true ? "" :
+ 公开版本库:
+
+
+
+
+
}
+
+ {this.state.vnc === true ? "" :
+ 隐藏代码目录:
+
+
+
+
+
}
+
+ {this.state.vnc === true ? "" :
+ 禁用复制粘贴:
+
+
+
+
+
}
+
+
+ 跳关:
+
+
+
+
+
+
+
+ 测试集解锁:
+
+
+
+
+
+
+
+
+
+ {this.props.identity < 5 ?
+
: ""}
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
new file mode 100644
index 000000000..f3ec8e300
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -0,0 +1,1290 @@
+import React, {Component} from 'react';
+
+import MonacoEditor from 'react-monaco-editor';
+
+import {
+ Input,
+ Select,
+ Checkbox,
+ Modal,
+ Icon,
+ Upload,
+ Button,
+ Tooltip,
+ Form
+} from 'antd';
+
+import axios from 'axios';
+
+import TPMMDEditor from "../challengesnew/TPMMDEditor";
+
+import Bottomsubmit from "../../modals/Bottomsubmit";
+
+import {getUploadActionUrl} from 'educoder';
+
+import './css/TPMsettings.css';
+
+import '../newshixuns/css/Newshixuns.css';
+
+const Option = Select.Option;
+
+class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.contentMdRef = React.createRef();
+ this.state = {
+ NAME_COUNT: 60,
+ shixunmemoMDvalue: "",
+ testscripttiptype: false,
+ shixunName: '',
+ trainee: undefined,
+ choice_small_type: [],
+ simichecked: false,
+ Executivetyoe: false,
+ Executiveordervalue: "",
+ Compilecommandvalue: "",
+ shixun_service_configs: undefined,
+ fileList:[],
+ loading:false,
+ }
+ }
+
+ componentDidMount() {
+
+ }
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps.data != this.props.data) {
+
+ if (this.props.data ) {
+ if (this.props.data.shixun){
+ this.setState({
+ shixunName: this.props.data && this.props.data.shixun.name,
+ trainee: this.props.data && this.props.data.shixun.trainee,
+ choice_main_type: this.props.data && this.props.data.shixun.choice_main_type,
+ choice_small_type: this.props.data && this.props.data.shixun.choice_small_type,
+ choice_standard_scripts: this.props.data && this.props.data.shixun.choice_standard_scripts,
+ shixunmemoMDvalue: this.props.data && this.props.data.shixun.evaluate_script,
+ simichecked: this.props.data && this.props.data.shixun.is_secret_repository,
+ shixun_service_configs: this.props.data && this.props.data.shixun.shixun_service_configs,
+ standard_scripts: this.props.data && this.props.data.shixun.standard_scripts,
+ shixun_service_configlist: this.props.data && this.props.data.shixun.shixun_service_configs,
+ })
+
+ if (this.props.data && this.props.data.shixun.choice_standard_scripts === null) {
+ this.setState({
+ choice_standard_scripts: {id: this.props.data && this.props.data.shixun.standard_scripts[0].id, value: ""},
+ choice_standard_scriptssum: this.props.data && this.props.data.shixun.standard_scripts[0].id
+ })
+ this.props.form.setFieldsValue({
+ selectscripts: this.props.data && this.props.data.shixun.standard_scripts[0].id
+ })
+ this.get_mirror_script(this.props.data && this.props.data.shixun.standard_scripts[0].id)
+ } else {
+ this.props.form.setFieldsValue({
+ selectscripts: this.props.data && this.props.data.shixun.choice_standard_scripts
+ })
+ }
+
+ let newlist = ""
+ this.props.data && this.props.data.shixun.choice_small_type.map((item, key) => {
+ this.props.data && this.props.data.shixun.small_type.map((i, k) => {
+ if (item === i.id) {
+ newlist = newlist + `${i.description}`
+ }
+ })
+ })
+ this.setState({
+ subvalues: newlist
+ })
+
+ this.props.data && this.props.data.shixun.main_type.map((item, key) => {
+ if (item.id === this.props.data && this.props.data.shixun.choice_main_type) {
+ this.setState({
+ mainvalues: item.description,
+ })
+ }
+ })
+
+ this.props.form.setFieldsValue({
+ name: this.props.data && this.props.data.shixun.name,
+ trainee: this.props.data && this.props.data.shixun.trainee,
+ selectleft: this.props.data && this.props.data.shixun.choice_main_type,
+ selectright: this.props.data && this.props.data.shixun.choice_small_type,
+ })
+ this.contentMdRef.current.setValue(this.props.data && this.props.data.shixun.description);
+ }
+ }
+ }
+ }
+
+ getshixunmemoMDvalue = (value, e) => {
+
+ this.setState({
+ shixunmemoMDvalue: value
+ })
+ }
+
+ 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: []
+ })
+ }
+ this.props.showNotification("提交成功")
+
+ this.sendhideModaly()
+
+ }
+ } catch (e) {
+
+ }
+
+ })
+
+ }
+
+
+ setlanguage = (e) => {
+ this.setState({
+ language: e.target.value
+ })
+ if (e.target.value) {
+ this.setState({
+ languagewritetype: false
+ })
+ }
+ }
+ setruntime = (e) => {
+ this.setState({
+ runtime: e.target.value
+ })
+ if (e.target.value) {
+ this.setState({
+ systemenvironmenttype: false
+ })
+ }
+
+ }
+
+ setrun_method = (e) => {
+ this.setState({
+ run_method: e.target.value
+ })
+ if (e.target.value) {
+ this.setState({
+ testcoderunmodetype: false
+ })
+ }
+ }
+
+
+ // 附件相关 START
+ handleChange = (info) => {
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ let {fileList} = this.state;
+
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ console.log("handleChange1");
+ // if(fileList.length===0){
+ let fileLists = info.fileList;
+ this.setState({
+ // fileList:appendFileSizeToUploadFileAll(fileList),
+ fileList: fileLists,
+ deleteisnot: false
+ });
+ // }
+ }
+ }
+ }
+
+ onAttachmentRemove = (file) => {
+ if (!file.percent || file.percent == 100) {
+ Modal.confirm({
+ title: '确定要删除这个附件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ console.log("665")
+ this.deleteAttachment(file)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ return false;
+ }
+
+ }
+
+ deleteAttachment = (file) => {
+ console.log(file);
+ let id = file.response == undefined ? file.id : file.response.id
+ const url = `/attachments/${id}.json`
+ axios.delete(url, {})
+ .then((response) => {
+ if (response.data) {
+ const {status} = response.data;
+ if (status == 0) {
+ // console.log('--- success')
+
+ this.setState((state) => {
+
+ const index = state.fileList.indexOf(file);
+ const newFileList = state.fileList.slice();
+ newFileList.splice(index, 1);
+ return {
+ fileList: newFileList,
+ deleteisnot: true
+ };
+ });
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+
+
+ bigClass = (value,e) => {
+ this.setState({
+ mainvalues:e.props.name
+ })
+ let list = []
+ list.push(this.state.choice_main_type)
+ this.state.choice_small_type.map((item, key) => {
+ list.push(item)
+ })
+
+
+ let newshixun_service_configs = this.state.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
+ }
+ }
+ )
+
+
+
+
+ this.props.form.setFieldsValue({
+ selectleft: value,
+ })
+
+ let url = `/shixuns/get_mirror_script.json?mirror_id=` + value;
+ axios.get(url).then((response) => {
+ if (response.status === 200) {
+ this.setState({
+ choice_standard_scripts:{id: response.data[0].id, value: ""},
+ choice_standard_scriptssum:response.data[0].id
+ })
+ this.props.form.setFieldsValue({
+ selectscripts:response.data[0].id
+ })
+ this.get_mirror_script(response.data[0].id)
+ this.setState({
+ choice_main_type: value,
+ standard_scripts: response.data,
+ shixun_service_configs: newshixun_service_configsagin,
+ shixun_service_configlist: newshixun_service_configsagin,
+ })
+
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+ Deselectlittle = (value,e) => {
+
+ let {shixun_service_configs, choice_small_type} = this.state;
+ let newshixun_service_configs = shixun_service_configs;
+ let newchoice_small_type = choice_small_type;
+
+ newshixun_service_configs.some((item, key) => {
+ if (item.mirror_repository_id === value) {
+ newshixun_service_configs.splice(key, 1)
+ return true
+ }
+ }
+ )
+
+ newchoice_small_type.some((item, key) => {
+ if (item === value) {
+ newchoice_small_type.splice(key, 1)
+ return true
+ }
+ }
+ )
+
+
+ this.setState({
+ choice_small_type: newchoice_small_type,
+ shixun_service_configs: newshixun_service_configs,
+ shixun_service_configlist: newshixun_service_configs,
+ })
+ }
+
+ showlittleClass=(value,e)=>{
+ let newlist = ""
+ e.map((item, key) => {
+ if (item.props.name != "") {
+ newlist = newlist + `${item.props.name}`
+ }
+ })
+ this.setState({
+ subvalues: newlist
+ })
+
+ this.props.form.setFieldsValue({
+ selectright: value,
+ })
+ }
+ littleClass = (value,e) => {
+ let newshixun_service_configs = this.state.shixun_service_configs;
+ let newchoice_small_type = this.state.choice_small_type;
+ let list = []
+ list.push(this.state.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,
+ })
+ }
+
+ SelectScput = (value, e) => {
+ this.setState({
+ choice_standard_scriptssum: value,
+ language: e.props.name,
+ choice_standard_scripts: {id: e.props.value, value: ""},
+ standard_scriptsModal: true
+ })
+ }
+
+ hidestandard_scriptsModal = () => {
+ this.setState({
+ standard_scriptsModal: false,
+ standard_scriptsModals: false
+ })
+ }
+
+ get_mirror_script = (ids) => {
+ let {choice_standard_scriptssum} = this.state;
+ let id = this.props.match.params.shixunId;
+ let url = `/shixuns/${id}/get_script_contents.json`;
+ axios.get((url),{params:{
+ script_id:ids?ids:choice_standard_scriptssum
+ }}).then((response) => {
+ if (response.status === 200) {
+ // this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
+ if(ids==undefined){
+ this.setState({
+ standard_scriptsModal: false,
+ standard_scriptsModals: true,
+ })
+ }
+ this.setState({
+ shixunmemoMDvalue: response.data.content
+ })
+ }
+
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+
+ simionChange = (e) => {
+ this.setState({
+ simichecked: e.target.checked
+ })
+ }
+
+
+ showModal = () => {
+ this.setState({
+ visibleTemplate: true,
+ });
+ }
+
+ handleCancelTemplate = (e) => {
+ this.setState({
+ Executiveordervalue: "",
+ Compilecommandvalue: "",
+ visibleTemplate: false
+ })
+ }
+
+ hideModalTemplate = (e) => {
+ let id = this.props.match.params.shixunId;
+ let {Executiveordervalue, Compilecommandvalue} = this.state;
+
+ if (Executiveordervalue === "" || Executiveordervalue === undefined) {
+ this.setState({
+ Executivetyoe: true,
+ });
+ return
+ }
+ // Executiveordervalue=String(Executiveordervalue);
+ // Compilecommandvalue=String(Compilecommandvalue);
+ let trl = `/shixuns/${id}/get_custom_script.json?compile=${Executiveordervalue}&excutive=${Compilecommandvalue}`
+ axios.get(trl).then((response) => {
+ // this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD");
+ this.setState({
+ shixunmemoMDvalue: response.data.shixun_script
+ })
+ }).catch((error) => {
+ console.log(error)
+ });
+ this.setState({
+ visibleTemplate: false
+ })
+ }
+
+ Executiveorder = (e) => {
+ this.setState({
+ Executiveordervalue: e.target.value
+ })
+ }
+
+ Compilecommand = (e) => {
+ this.setState({
+ Compilecommandvalue: e.target.value
+ })
+ }
+
+ setConfigsInputs=(e,keys,str)=>{
+
+ let {shixun_service_configs}=this.state;
+ let newshixun_service_configs=shixun_service_configs;
+ newshixun_service_configs.map((item,key)=>{
+ if(key===keys){
+ switch (str) {
+ case 1:
+ item.cpu_limit=e.target.value
+ break;
+ case 2:
+ item.lower_cpu_limit=e.target.value
+ break;
+ case 3:
+ item.memory_limit=e.target.value
+ break;
+ case 4:
+ item.request_limit=e.target.value
+ break;
+ }
+ }
+ })
+
+ this.setState({
+ shixun_service_configs:newshixun_service_configs,
+ shixun_service_configlist:newshixun_service_configs,
+ })
+
+ }
+
+ onSubmits=()=>{
+ this.setState({
+ loading:true
+ })
+ const mdContnet = this.contentMdRef.current.getValue().trim();
+ let{choice_standard_scriptssum,choice_standard_scripts}=this.state;
+ this.props.form.validateFieldsAndScroll((err, values) => {
+ if (!err) {
+ console.log('Received values of form: ', values);
+ let url = `/shixuns/${this.props.match.params.shixunId}.json`;
+ let newshixun_service_configlist = this.state.shixun_service_configlist.map(v => {
+ let v1 = Object.assign({},v);
+ delete v1.name;
+ return v1
+ });
+
+ let data={
+ main_type:this.state.choice_main_type,
+ sub_type:this.state.choice_small_type,
+ is_secret_repository:this.state.simichecked,
+ shixun:{
+ name: values.name,
+ trainee: this.state.trainee,
+ is_jupyter: this.props.shixunsDetails.is_jupyter,
+ mirror_script_id: this.props.shixunsDetails.is_jupyter===true?null:this.state.choice_standard_scriptssum===undefined?this.state.choice_standard_scripts:this.state.choice_standard_scriptssum,
+ },
+ shixun_info: {
+ description: mdContnet,
+ evaluate_script: this.props.shixunsDetails.is_jupyter===true?"":this.state.shixunmemoMDvalue
+ },
+ shixun_service_configs:newshixun_service_configlist
+ }
+
+ axios.put(url, data).then((result) => {
+ if (result) {
+ if (result.data) {
+ this.props.getdatas("2")
+ if(result.data.shixun_identifier){
+ this.props.showNotification("基本信息更新成功!")
+ this.setState({
+ loading:false
+ })
+ }
+ }
+ }
+ }).catch((error) => {
+ this.setState({
+ loading:false
+ })
+ });
+ }else{
+ this.setState({
+ loading:false
+ })
+ }
+ });
+ this.setState({
+ loading: false
+ })
+ }
+
+ Selectthestudent = (value) => {
+ this.setState({
+ trainee: value
+ })
+ }
+ render() {
+
+
+ // console.log(operateauthority)
+ const {getFieldDecorator} = this.props.form;
+ const { fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
+
+ // console.log("1222")
+ // console.log(choice_standard_scripts)
+
+ const uploadProps = {
+ width: 600,
+ fileList,
+ multiple: true,
+ // https://github.com/ant-design/ant-design/issues/15505
+ // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
+ // showUploadList: false,
+ action: `${getUploadActionUrl()}`,
+ onChange: this.handleChange,
+ onRemove: this.onAttachmentRemove,
+ beforeUpload: (file, fileList) => {
+
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
+ // console.log('beforeUpload', file.name);
+ const isLt150M = file.size / 1024 / 1024 < 50;
+ if (!isLt150M) {
+ // this.props.showNotification(`文件大小必须小于50MB`);
+ this.props.showNotification("文件大小必须小于50MB")
+ }
+ if (this.state.file !== undefined) {
+ this.setState({
+ file: file
+ })
+ } else {
+ this.setState({
+ file: file
+ })
+ }
+ return isLt150M;
+ },
+ }
+ let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.props.data&&this.props.data.shixun.status == 0 ? true : false;
+ return (
+
+
+
+ {getFieldDecorator('name', {
+ rules: [{
+ required: true, message: '请输入选题名称',
+ }, {
+ max: 60, message: '请输入名称,最大限制60个字符',
+ }, {
+ whitespace: true, message: '请勿输入空格'
+ }],
+ })(
+
+ )}
+
+
+
+
+
+
+
+
+ {getFieldDecorator('trainee', {
+ rules: [{required: true, message: '请选择难易度'}],
+ })(
+
+
+
+
+ )}
+ (实训的难易程度)
+
+
+
+
+
+ {getFieldDecorator('selectleft', {
+ rules: [{required: true, message: '请选择主类别'}],
+ })(
+
+
+
+
+ )}
+
+
+
+
+
+
+ {getFieldDecorator('selectright', {
+ rules: [{required: false, message: '请选择小类别'}],
+ })(
+
+
+
+ )}
+
+
+ {this.state.mainvalues === undefined && this.state.subvalues === undefined || this.state.mainvalues === "" && 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}`}
+
}
+
+
+
+
+
+
+
+
+
+ { this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"":
+ {getFieldDecorator('selectscripts', {
+ rules: [{required: true, message: '请选择评测脚本'}],
+ })(
+
+
+
+ )}
+
+ this.showModal()}>使用自定义脚本
+ 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.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"":
}
+
+
+
+ { this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"":
私密版本库:
+
+ {this.state.simichecked===false?"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)":"已创建的私密版本库及其内容,将在“保存”时被删除"}
+ }
+
+ {this.props.identity < 3 ?
+
服务配置
+ {this.state.shixun_service_configs && this.state.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="请输入类别名称"/>
+
+
+
+
+
+
+ this.setConfigsInputs(e, key, 2)}
+ 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.attachmentidstype === true ? "请上传附件" : ""}
+
+
+ this.sendhideModaly()}
+ >取消
+
+
+
+
+
+
+ {this.props.identity < 5 ?
+
: ""}
+
+
+ );
+ }
+}
+
+const TopShixuninformation = Form.create({name: 'newshixun'})(Shixuninformation);
+
+export default TopShixuninformation;
+
+
+
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index 7acaf98d6..651818da7 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -1,2435 +1,232 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
-import MonacoEditor from 'react-monaco-editor';
-
-//MonacoDiffEditor 对比模式
-import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip} from 'antd';
-
-// import "antd/dist/antd.css";
-
-import locale from 'antd/lib/date-picker/locale/zh_CN';
-
-import moment from 'moment';
-
-import axios from 'axios';
+import {
+ Button,
+ Tabs,
+ Modal
+} from 'antd';
import './css/TPMsettings.css';
-import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
-
-let origin = getUrl();
+import TopShixuninformation from './Shixuninformation';
-let path = getUrl("/editormd/lib/")
+import Configuration from './Configuration';
-const $ = window.$;
+import LearningSettings from './LearningSettings';
-let timeout;
-
-let currentValue;
+import axios from 'axios';
-const Option = Select.Option;
+const {TabPane} = Tabs;
-const RadioGroup = Radio.Group;
-const confirm = Modal.confirm;
// 处理整点 半点
-// 取传入时间往后的第一个半点
-export function handleDateStrings(dateString) {
- if (!dateString) return dateString;
- const ar = dateString.split(':')
- if (ar[1] == '00' || ar[1] == '30') {
- return dateString
- }
- const miniute = parseInt(ar[1]);
- if (miniute < 30 || miniute == 60) {
- return [ar[0], '30'].join(':')
- }
- if (miniute < 60) {
- // 加一个小时
- const tempStr = [ar[0], '00'].join(':');
- const format = "YYYY-MM-DD HH:mm";
- const _moment = moment(tempStr, format)
- _moment.add(1, 'hours')
- return _moment.format(format)
- }
-
- return dateString
-}
-
-// 恢复数据
-function md_rec_data(k,mdu,id, editor){
- if(window.sessionStorage.getItem(k+mdu) !== null){
- editor.setValue(window.sessionStorage.getItem(k+mdu));
- md_clear_data(k,mdu,id);
- }
-}
-
-// 保存数据
-function md_add_data(k,mdu,d){
- window.sessionStorage.setItem(k+mdu,d);
-}
-
-// 清空保存的数据
-function md_clear_data(k,mdu,id){
- window.sessionStorage.removeItem(k+mdu);
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
- if(k == 'content'){
- $(id2).html("");
- }else{
- $(id1).html("");
- }
-}
-
-function md_elocalStorage(editor,mdu,id){
- if (window.sessionStorage){
- var oc = window.sessionStorage.getItem('content'+mdu);
- if(oc !== null ){
- $("#e_tips_"+id).data('editor', editor);
- var h = '您上次有已保存的数据,是否恢复 ? / 不恢复';
- $("#e_tips_"+id).html(h);
- }
- setInterval(function() {
- var d = new Date();
- var h = d.getHours();
- var m = d.getMinutes();
- var s = d.getSeconds();
- h = h < 10 ? '0' + h : h;
- m = m < 10 ? '0' + m : m;
- s = s < 10 ? '0' + s : s;
- if(editor.getValue().trim() != ""){
- md_add_data("content",mdu,editor.getValue());
- var id1 = "#e_tip_"+id;
- var id2 = "#e_tips_"+id;
-
- $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
- $(id2).html("");
- }
- },10000);
-
- }else{
- $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
- }
-}
-
-function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
- var editorName = window.editormd(id, {
- width: width,
- height: high,
- path: path, // "/editormd/lib/"
- markdown : initValue,
- syncScrolling: "single",
- tex: true,
- tocm: true,
- emoji: true,
- taskList: true,
- codeFold: true,
- searchReplace: true,
- htmlDecode: "style,script,iframe",
- sequenceDiagram: true,
- autoFocus: false,
- placeholder: placeholder,
- toolbarIcons: function () {
- // Or return editormd.toolbarModes[name]; // full, simple, mini
- // Using "||" set icons align right.
- return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
- },
- toolbarCustomIcons: {
- testIcon: "",
- testIcon1: ""
- },
- //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
- saveHTMLToTextarea: true,
- // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
- dialogMaskOpacity: 0.6,
- imageUpload: true,
- imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
- imageUploadURL: imageUrl,//url
- onload: function () {
- // this.previewing();
- $("#" + id + " [type=\"latex\"]").bind("click", function () {
- editorName.cm.replaceSelection("```latex");
- editorName.cm.replaceSelection("\n");
- editorName.cm.replaceSelection("\n");
- editorName.cm.replaceSelection("```");
- var __Cursor = editorName.cm.getDoc().getCursor();
- editorName.cm.setCursor(__Cursor.line - 1, 0);
- });
-
- $("#" + id + " [type=\"inline\"]").bind("click", function () {
- editorName.cm.replaceSelection("`$$$$`");
- var __Cursor = editorName.cm.getDoc().getCursor();
- editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
- editorName.cm.focus();
- });
- $("[type=\"inline\"]").attr("title", "行内公式");
- $("[type=\"latex\"]").attr("title", "多行公式");
- callback && callback()
- }
- });
- return editorName;
-}
-
-
-function updatamakedown(id){
- setTimeout(()=>{
- var shixunDescr = window.editormd.markdownToHTML(id, {
- htmlDecode: "style,script,iframe",
- taskList: true,
- tex: true,
- flowChart: true,
- sequenceDiagram: true
- });
- $("#"+id+" p:first").addClass("ReactMarkdown");
- $('#collaborators_list_info').show()
- }, 200)
-}
-
-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 TPMsettings extends Component {
constructor(props) {
super(props)
this.state = {
- fileList: [],
- commandLine: 0,
- Openpublic: 0,
- settingsData: undefined,
- webssh: 0,
- use_scope: 0,
- shixunsstatus: 0,
- shixunsID: undefined,
- exec_time: undefined,
- trainee: undefined,
- can_copy: undefined,
- task_pass: undefined,
- test_set_permission: undefined,
- code_edit_permission: undefined,
- hide_code: undefined,
- code_hidden: undefined,
- forbid_copy: undefined,
- vnc: undefined,
- name: undefined,
- scope_partment: undefined,
- scopetype: false,
- departmentslist: undefined,
- description: '',
- evaluate_script:undefined,
- standard_scripts: undefined,
- choice_main_type: "",
- choice_small_type: [],
- choice_standard_scripts:undefined,
- editordescriptios: undefined,
- editorevaluate_scripts: undefined,
- choice_standard_scriptssum: undefined,
- visibleTemplate: false,
- Executiveordervalue: "",
- Compilecommandvalue: "",
- Executivetyoe: false,
- postapplyvisible: false,
- sendsure_applyvalue: undefined,
- postapplytitle: false,
- shixunnametype: false,
- shixunmaintype: false,
- evaluate_scripttype: false,
- exec_timetype: false,
- traineetype: false,
- standard_scriptsModal:false,
- standard_scriptsModals:false,
- SelectTheCommandtype:false,
- multi_webssh:false,
- status:0,
- opers:false,
- operss:false,
- testscripttiptype:false,
- opersss:false,
- operateshixunstype:false,
- opening_time:"",
- opensmail:false,
- scope_partmenttype:false,
- newuse_scope:undefined,
- scope_partments:0,
- shixun_service_configs:undefined,
- shixun_service_configlist:undefined,
- pod_exist_time: undefined,
- pod_exist_timetype: false,
- shixunmemoMDvalue:"",
- language:"",
- deleteisnot:true
+ activeKeys:"1"
}
}
- descriptionMD=(initValue, id)=> {
-
- this.contentChanged = false;
- const placeholder = "";
-// amp;
-// 编辑时要传memoId
- const imageUrl = `/api/attachments.json`;
-// 创建editorMd
-
- const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
- setTimeout(() => {
- description_editormd.resize()
- description_editormd.cm && description_editormd.cm.refresh()
- }, 500)
-
- if (initValue != undefined) {
- description_editormd.setValue(initValue)
- }
- description_editormd.cm.on("change", (_cm, changeObj) => {
- console.log('....contentChanged')
- this.contentChanged = true;
- })
- });
- md_elocalStorage(description_editormd, `MemoQuestion_${id}`, `${id}Question`);
- this.description_editormd = description_editormd;
- window.description_editormd = description_editormd;
- }
-
- evaluate_scriptMD=(initValue, id)=> {
- this.contentChanged = false;
- const placeholder = "";
-// amp;
-// 编辑时要传memoId
- const imageUrl = `/api/attachments.json`;
-// 创建editorMd
-
- const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
- setTimeout(() => {
- evaluate_script_editormd.resize()
- evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh()
- }, 500)
-
- if (initValue != undefined) {
- evaluate_script_editormd.setValue(initValue)
- }
- evaluate_script_editormd.cm.on("change", (_cm, changeObj) => {
- console.log('....contentChanged')
- this.contentChanged = true;
- })
- });
- md_elocalStorage(evaluate_script_editormd, `MemoQuestion_${id}`, `${id}Question`);
- this.evaluate_script_editormd = evaluate_script_editormd;
- window.evaluate_script_editormd = evaluate_script_editormd;
-
- }
-
componentDidMount() {
+ this.getdatas("1")
+ }
- let id=this.props.match.params.shixunId;
-
- let Url=`/shixuns/`+id+`/settings.json`;
+ getdatas = (key) => {
- axios.get(Url).then((response)=> {
+ let id = this.props.match.params.shixunId;
+ let Url = `/shixuns/` + id + `/settings.json`;
+ axios.get(Url).then((response) => {
// alert(response.data.shixun.choice_standard_scripts)
- if(response.status===200){
- this.setState({
- shixunsID: id,
- settingsData: response.data,
- webssh: response.data.shixun.webssh,
- use_scope: response.data.shixun.use_scope,
- shixunsstatus: response.data.shixun.status,
- exec_time: response.data.shixun.exec_time,
- trainee: response.data.shixun.trainee,
- can_copy: response.data.shixun.can_copy,
- task_pass: response.data.shixun.task_pass,
- test_set_permission: response.data.shixun.test_set_permission,
- hide_code: response.data.shixun.hide_code,
- code_edit_permission: response.data.shixun.code_edit_permission,
- code_hidden: response.data.shixun.code_hidden,
- is_secret_repository: response.data.shixun.is_secret_repository,
- init_is_secret_repository: response.data.shixun.is_secret_repository,
- forbid_copy: response.data.shixun.forbid_copy,
- vnc: response.data.shixun.vnc,
- vnc_evaluate: response.data.shixun.vnc_evaluate,
- name: response.data.shixun.name,
- scope_partment: response.data.shixun.scope_partment,
- description: response.data.shixun.description,
- evaluate_script: response.data.shixun.evaluate_script,
- choice_main_type: response.data.shixun.choice_main_type,
- choice_small_type: response.data.shixun.choice_small_type,
- choice_standard_scripts: response.data.shixun.choice_standard_scripts,
- standard_scripts:response.data.shixun.standard_scripts,
- multi_webssh:response.data.shixun.multi_webssh,
- status:response.data.shixun.status,
- opening_time:response.data.shixun.opening_time,
- newuse_scope:response.data.shixun.use_scope,
- scope_partments: response.data.shixun.scope_partment.length,
- shixunmemoMDvalue:response.data.shixun.evaluate_script,
- shixun_service_configs:response.data.shixun.shixun_service_configs,
- shixun_service_configlist:response.data.shixun.shixun_service_configs,
- })
-
- // if(response.data.status===403){
- // message: "您没有权限进行该操作"
- // this.setState({
- // :true
- // message403:response.data.message
- // })
- // }
-
-
- if(response.data.shixun.multi_webssh===true){
- this.setState({
- SelectTheCommandtype:true
- })
- }else{
- this.setState({
- SelectTheCommandtype:false
- })
- }
- if (response.data.shixun.scope_partment.length > 0) {
- this.setState({
- scopetype: true
- })
- }
- // console.log(response.data.shixun.description)
- // console.log(response.data.shixun.evaluate_script)
- // console.log(response.data.shixun.description)
- // this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2
-
-
- // this.evaluate_scriptMD(response.data.shixun.evaluate_script, "shixunmemoMD");
-
- this.descriptionMD(response.data.shixun.description, "shixundescription");
-
- // this.bigClass()
- // if (response.data.shixun.status === 2) {
- //
- // } else if (response.data.shixun.status === 1) {
- // this.props.showSnackbar("这个实训已发布不能修改!");
- // } else if (response.data.shixun.status === 3) {
- // this.props.showSnackbar("这个实训已关闭不能修改!");
- // }
- }
-
- });
-
-
- let departmentsUrl = `/shixuns/departments.json`;
- axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
- if (response.data.message === undefined) {
- this.setState({
- departmentslist: response.data.shools_name
- });
- }
- }
- }).catch((error) => {
- console.log(error)
- });
-
-
-
- }
-
- SelectshixunCommand=(e)=>{
- // console.log( e.target.value)
- const webssh = e.target.value
- if (webssh == 2) {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: true,
- multi_webssh:false
- });
- } else {
- if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- })
- } else {
- if (!this.state.vnc) {
- this.setState({
- is_secret_repository: false,
- })
- }
- this.setState({
- webssh: webssh,
- SelectTheCommandtype: false,
- multi_webssh:false
- });
- }
- }
-
- // this.setState({
- // webssh: webssh,
- // });
- // if(webssh===2){
- // this.setState({
- // SelectTheCommandtype: true,
- // multi_webssh:false
- // });
- // }else{
- // this.setState({
- // SelectTheCommandtype: false,
- // multi_webssh:false
- // });
- // }
- }
-
- SelectOpenpublic=(e)=>{
- this.setState({
- Openpublic: e.target.value
- });
- }
-
- can_copy=(e)=>{
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- can_copy: sum,
- });
-
- }
-
- task_pass=(e)=>{
-
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- task_pass: sum,
- });
- }
-
- test_set_permission=(e)=>{
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- test_set_permission: sum,
- });
-
- }
-
- hide_code=(e)=>{
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- hide_code: sum,
- });
-
- }
- code_edit_permission = (e) => {
- this.setState({
- code_edit_permission: e.target.checked
- })
- }
- code_hidden=(e)=>{
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- code_hidden: sum,
- });
-
- }
- confirmDeleteSecretRepo = ({title, onOk}) => {
- confirm({
- title: title ||
-
已创建的私密版本库及其内容,将在“保存”时被删除。
-
是否确认取消勾选?
-
,
- okText: '确定',
- cancelText: '取消',
- onOk: () => {
- this.setState({ is_secret_repository: false })
- onOk && onOk()
- },
- onCancel() {
- },
- });
- }
- is_secret_repository = (e) => {
- const checked = e.target.checked
- if (!checked) {
- if (this.state.init_is_secret_repository) {
- this.confirmDeleteSecretRepo({
- })
- } else {
- this.setState({ is_secret_repository: false })
- }
- } else {
- this.setState({ is_secret_repository: true })
- }
- }
- forbid_copy = (e) => {
- let sum = ""
- if (e.target.checked === false) {
- sum = 0
- } else if (e.target.checked === true) {
- sum = 1
- }
- this.setState({
- forbid_copy: sum,
- });
- }
- shixun_vnc_evaluate=(e) => {
- this.setState({
- vnc_evaluate: e.target.checked,
- });
-
- }
-
- shixun_vnc=(e)=>{
- // let sum = ""
- // if (e.target.checked === false) {
- // sum = 0
- // } else if (e.target.checked === true) {
- // sum = 1
- // }
- const vnc = e.target.checked;
- if (!vnc) {
- if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
- this.confirmDeleteSecretRepo({
- onOk: () => {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- })
- } else {
- if (this.state.webssh != 2) {
- this.setState({
- is_secret_repository: false
- })
- }
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- } else {
- this.setState({
- vnc: e.target.checked,
- vnc_evaluate: false,
- });
- }
- }
- shixunsname = (e) => {
- // let {shixunsstatus}=this.state;
- // if(shixunsstatus>0){
- // return
- // }
- this.setState({
- name: e.target.value,
- shixunnametype:false
- })
- }
-
- bigClass = (value) => {
- // choice_main_type
- // choice_small_type
- let {settingsData,shixun_service_configs,choice_main_type,choice_small_type}=this.state;
-
- let list=[]
- list.push(choice_main_type)
- choice_small_type.map((item,key)=>{
- list.push(item)
- })
-
- let newshixun_service_configs=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)
- }
- })
- })
-
+ if(response.data){
+ if (response.data.shixun&&response.data.shixun.scope_partment.length > 0) {
+ this.setState({
+ scopetype: true
+ })
+ }
+ }
- settingsData.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,
+ data: response.data
})
}
- }).catch((error) => {
- console.log(error)
- });
-
-
- }
- Deselectlittle=(value)=>{
-
- let {shixun_service_configs,choice_small_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
-
- newshixun_service_configs.some((item,key)=> {
- if (item.mirror_repository_id === value) {
- newshixun_service_configs.splice(key, 1)
- return true
- }
- }
- )
-
- newchoice_small_type.some((item,key)=> {
- if (item === value) {
- newchoice_small_type.splice(key, 1)
- return true
- }
- }
- )
-
-
- this.setState({
- choice_small_type: newchoice_small_type,
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
- }
- littleClass = (value) => {
-
- let {settingsData,shixun_service_configs,choice_small_type,choice_main_type}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- let newchoice_small_type=choice_small_type;
- // if(Array.isArray(value)===true){
- // value.map((item,key)=>{
- // settingsData.shixun.small_type.some((items,keys)=> {
- // if (items.id === item) {
- // newshixun_service_configs.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
- // }
- // }
- // )
- // })
- // }
-
- let list=[]
- list.push(choice_main_type)
- choice_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)
- }
- })
- })
-
- settingsData.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,
- })
- }
- onPodExistTimeChange = (e) => {
- this.setState({
- pod_exist_time: e.target.value,
- pod_exist_timetype: false,
- })
- }
- Timevalue = (e) => {
- this.setState({
- exec_time: e.target.value
- })
- }
- SelectOpenpublic = (e) => {
- this.setState({
- scopetype: false,
- use_scope: e.target.value,
});
- if (e.target.value === 1) {
- this.setState({
- scopetype: true
- });
- }
- }
- deleteScopeInput = (key) => {
- let {scope_partment} = this.state;
- let datalist = scope_partment;
- datalist.splice(key, 1);
- this.setState({
- scope_partment: datalist
- });
- }
-
- shixunScopeInput = (e) => {
- let {scope_partment} = this.state;
- let datalist = scope_partment;
- if (datalist===undefined) {
- datalist=[]
- }
-
- datalist.push(e)
- // else {
- // datalist[id] = e
- // }
- this.setState({
- scope_partment: datalist
- });
- }
- // adduse_scopeinput = () => {
- // let {scope_partment} = this.state;
- // let array = scope_partment;
- // let newarray = ""
- // array.push(newarray)
- // this.setState({
- // scope_partment: array,
- // });
- // }
- submit_edit_shixun = () => {
- if (this.saving == true) return;
- this.saving = true;
- if(this.state.status===-1){
- this.props.showSnackbar("该实训已被删除,保存失败!");
- return
- }
-
- let {
- name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
- evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
- opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
- } = this.state;
-
- let newshixun_service_configlist = shixun_service_configlist.map(v => {
- let v1 = Object.assign({},v);
- delete v1.name;
- return v1
- });
-
- // let operateauthority=
- // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
- // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
-
- const description_editormd = this.description_editormd.getValue();
-
- let evaluate_script_editormd;
-
- if(this.state.status==0||this.state.status==1||this.state.status==2&&this.props.identity===1){
- // evaluate_script_editormd = this.evaluate_script_editormd.getValue();
- evaluate_script_editormd = shixunmemoMDvalue
+ if(key==="3"&&this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true){
+ this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`);
}else{
- evaluate_script_editormd = evaluate_script;
- }
-
-
-
- if (name === "") {
- this.setState({
- shixunnametype: true
- })
- $('html').animate({
- scrollTop: 10
- }, 1000);
- return
- }
- if (choice_main_type === "") {
- this.setState({
- shixunmaintype: true
- })
- $('html').animate({
- scrollTop: 800
- }, 1000);
- return
- }
- if (evaluate_script_editormd === "") {
- this.setState({
- evaluate_scripttype: true
- })
- $('html').animate({
- scrollTop: 1200
- }, 1000);
- return
- }
- if(use_scope===1){
-
- if(scope_partment===undefined||scope_partment.length===0){
+ if(key){
this.setState({
- scope_partmenttype: true
+ activeKeys:key
})
- $('html').animate({
- scrollTop: 2500
- }, 1000);
- this.props.showSnackbar("公开程度,指定单位为空");
- return
+ }else{
+ this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`);
}
- }
- // if (exec_time === "") {
- // this.setState({
- // exec_timetype: true
- // })
- // $('html').animate({
- // scrollTop: 1500
- // }, 1000);
- // return
- // }
- // if (!pod_exist_time) {
- // this.setState({
- // pod_exist_timetype: true
- // })
- // $("html, body").animate({ scrollTop: $('#pod_exist_time').offset().top - 100 }, 1000)
- // return
- // }
-
- if (trainee === "") {
- this.setState({
- traineetype: true
- })
- return
}
- let id = this.props.match.params.shixunId;
-
- let newmulti_webssh=multi_webssh;
-
-
- if(newmulti_webssh===null){
- newmulti_webssh=false
- }
-
- //exec_time: exec_time,
- let Url = `/shixuns/` + id + `.json`;
- let data = {
- shixun:{
-
- name: name,
- webssh: webssh,
- use_scope: use_scope,
- can_copy: can_copy,
- vnc: vnc===null?undefined:vnc,
- vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
- test_set_permission: test_set_permission,
- code_hidden: code_hidden,
- code_edit_permission: code_edit_permission,
- trainee: trainee,
- task_pass: task_pass,
- hide_code: hide_code,
- forbid_copy: forbid_copy,
- multi_webssh:newmulti_webssh,
- opening_time:opening_time,
- mirror_script_id:choice_standard_scriptssum===undefined?choice_standard_scripts:choice_standard_scriptssum,
- },
- shixun_info:{
- description: description_editormd,
- evaluate_script: evaluate_script_editormd,
- },
- is_secret_repository: is_secret_repository,
- main_type: choice_main_type,
- small_type: choice_small_type,
- scope_partment: scope_partment,
- shixun_service_configs:newshixun_service_configlist
- }
-
- axios.put(Url, data).then((response) => {
- // console.log(response)
- this.saving = false;
- if(response.status){
- if (response.data.status === -1) {
- this.props.showSnackbar(response.data.message);
- return
- } else {
- window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
- }
- }
+ }
- }).catch((error) => {
- console.log(error)
- this.saving = false;
+ operateshixuns = (value) => {
+ this.setState({
+ operateshixunstype: true,
+ delType: value
})
-
-
}
- shixunsfetch = (value, callback) => {
- if (timeout) {
- clearTimeout(timeout);
- timeout = null;
- }
- currentValue = value;
- function fake() {
- let departmentsUrl = `/shixuns/departments.json?q=` + currentValue;
- axios.get(departmentsUrl).then((response) => {
- callback(response.data.shools_name);
- }).catch((error) => {
- console.log(error)
- });
- }
-
- timeout = setTimeout(fake, 300);
- }
- shixunHandleSearch = (value) => {
- this.shixunsfetch(value, departmentslist => this.setState({departmentslist}));
+ hideoperateshixuns = () => {
+ this.setState({
+ operateshixunstype: false
+ })
}
-
-
- shixunsclose = () => {
+ shixunsdel = () => {
let id = this.props.match.params.shixunId;
- let cul = `/shixuns/` + id + `/close.json`;
- axios.post(cul).then((response) => {
- if(response.data.status===1){
+ let cul = `/shixuns/` + id + `.json`;
+
+ axios.delete(cul).then((response) => {
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
});
- window.location.href = "/shixuns/" + id + "/challenges";
+ window.location.href = "/shixuns";
+ // this.props.history.replace( "/shixuns/");
}
}).catch((error) => {
console.log(error)
})
}
- shixunsdel= () => {
+ shixunsclose = () => {
let id = this.props.match.params.shixunId;
- let cul = `/shixuns/` + id +`.json`;
-
- axios.delete(cul).then((response) => {
- if(response.data.status===1){
+ let cul = `/shixuns/` + id + `/close.json`;
+ axios.post(cul).then((response) => {
+ if (response.data.status === 1) {
this.props.showSnackbar("操作成功");
this.setState({
operateshixunstype: false,
});
- window.location.href = "/shixuns";
- }
- }).catch((error) => {
- console.log(error)
- })
- }
-
- Executiveorder = (e) => {
- this.setState({
- Executiveordervalue: e.target.value
- })
- }
-
- Compilecommand = (e) => {
- this.setState({
- Compilecommandvalue: e.target.value
- })
- }
-
- handleCancelTemplate = (e) => {
- this.setState({
- Executiveordervalue: "",
- Compilecommandvalue: "",
- visibleTemplate: false
- })
- }
-
- hideModalTemplate = (e) => {
- let id = this.props.match.params.shixunId;
- let {Executiveordervalue, Compilecommandvalue} = this.state;
-
- if (Executiveordervalue === "") {
- this.setState({
- Executivetyoe: true,
- });
- return
- }
- // Executiveordervalue=String(Executiveordervalue);
- // Compilecommandvalue=String(Compilecommandvalue);
- let trl = `/shixuns/${id}/get_custom_script.json?compile=${Executiveordervalue}&excutive=${Compilecommandvalue}`
- axios.get(trl).then((response) => {
- // this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD");
- this.setState({
- shixunmemoMDvalue:response.data.shixun_script
- })
- }).catch((error) => {
- console.log(error)
- });
- this.setState({
- visibleTemplate: false
- })
- }
-
- showModal = () => {
- this.setState({
- visibleTemplate: true,
- });
- }
- Selecttrainee = (value) => {
- this.setState({
- trainee: value,
- });
- }
-
- post_apply = () => {
- this.setState({
- postapplyvisible: true
- })
- }
-
- sendsure_applyvalues = (e) => {
- this.setState({
- sendsure_applyvalue: e.target.value
- })
- }
-
- setlanguagewrite = (e)=>{
- this.setState({
- languagewrite: e.target.value
- })
- }
-
- setsystemenvironment = (e) => {
- this.setState({
- systemenvironment: e.target.value
- })
- }
-
- settestcoderunmode = (e) => {
- this.setState({
- testcoderunmode: e.target.value
- })
-
- }
-
- sendsure_apply = () => {
- let {languagewrite,systemenvironment,testcoderunmode} = this.state;
- // console.log("点击确定")
- // console.log("languagewrite"+languagewrite);
- // console.log("systemenvironment"+systemenvironment);
- // console.log("testcoderunmode"+testcoderunmode);
-
- // let attachment_ids = undefined
- // if (this.state.fileList) {
- // attachment_ids = this.state.fileList.map(item => {
- // return item.response ? item.response.id : item.id
- // })
- // }
- if(languagewrite === undefined || languagewrite === "" ){
- // this.props.showNotification(`请填写该镜像是基于什么语言`);
- this.setState({
- languagewritetype:true
- })
- return
- }
- if(systemenvironment === undefined || systemenvironment === ""){
- // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
- this.setState({
- systemenvironmenttype:true
- })
- return;
-
- }
- if(testcoderunmode === undefined || testcoderunmode === "") {
- // 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){
-
- // notification.open(
- // {
- // message: '提示',
- // description:
- // '请上传附件!',
- //
- // }
- // )
- this.setState({
- attachmentidstype:true
- })
- return;
- }
- // console.log("attachment_ids"+attachment_ids);
-
- // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
-
- var data={
- language:languagewrite,
- runtime:systemenvironment,
- run_method:testcoderunmode,
- attachment_id:attachment_ids[0],
- }
- var url =`/shixuns/apply_shixun_mirror.json`;
- axios.post(url,data
- ).then((response) => {
-
- try {
- if (response.data) {
- // const { id } = response.data;
- // if (id) {
- if(this.state.file !== undefined){
- console.log("549");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- // this.props.showNotification('提交成功!');
- notification.open(
- {
- message: '提示',
- description:
- '提交成功!',
-
- }
- )
- this.sendhideModaly()
- // this.props.history.push(`/courses/${cid}/graduation_topics`);
- // }
- }
- }catch (e) {
-
- }
-
- })
-
- }
-
- sendhideModaly = () => {
- this.setState({
- postapplyvisible: false,
- })
- if(this.state.file !== undefined){
- console.log("580");
- // this.deleteAttachment(this.state.file);
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }else {
- this.setState({
- file:undefined,
- deleteisnot:true,
- languagewrite:"",
- systemenvironment:"",
- testcoderunmode:"",
- fileList:[]
- })
- }
- }
-
- yeshidemodel = () => {
- this.setState({
- postapplytitle: false
- })
- }
-
- SelectScput = (value, e) => {
- this.setState({
- choice_standard_scriptssum: value,
- language:e.props.name,
- choice_standard_scripts: {id:e.props.value,value:""},
- standard_scriptsModal:true
- })
- }
-
- hidestandard_scriptsModal=()=>{
- this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:false
- })
- }
-
- get_mirror_script=()=>{
- let {choice_standard_scriptssum}=this.state;
- let id = this.props.match.params.shixunId;
- let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum;
- axios.get(pul).then((response) => {
- if(response.status===200){
- // this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
- this.setState({
- standard_scriptsModal:false,
- standard_scriptsModals:true,
- shixunmemoMDvalue:response.data.content
- })
+ window.location.href = "/shixuns/" + id + "/challenges";
+ // this.props.history.replace( "/shixuns/" + id + "/challenges");
}
-
}).catch((error) => {
console.log(error)
})
}
-
- SelectTheCommandonChange=(e)=>{
+ callback = (key) => {
this.setState({
- multi_webssh:e.target.checked
+ activeKeys:key
})
}
- bigopen=()=>{
- this.setState({
- opers:true
- })
-
- }
-
- bigopens=()=>{
- this.setState({
- opers:false,
- operss:false,
- opersss:false,
- opensmail:false
- })
+ render() {
- }
- bigopensmal=(e)=>{
- this.setState({
- opensmail:true
- })
+ let showtabs = this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true ? "" : "学习页面设置"
- }
- sbigopen=(e)=>{
- this.setState({
- operss:true
- })
-
- }
-
- sbigopens=()=>{
- this.setState({
- operss:false
- })
- }
- sbigopenss=(e)=>{
- this.setState({
- opersss:true
- })
-
- }
-
- sbigopensss=()=>{
- this.setState({
- opersss:false
- })
- }
- testscripttip=(val)=>{
- if(val===0){
- this.setState({
- testscripttiptype:true
- })
- }else if(val===1){
- this.setState({
- testscripttiptype:false
- })
- }
- }
-
- operateshixuns=(value)=>{
- this.setState({
- operateshixunstype:true,
- delType:value
- })
- }
-
- hideoperateshixuns=()=>{
- this.setState({
- operateshixunstype:false
- })
- }
- onChangeTimePicker =(value, dateString)=> {
- this.setState({
- opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
- })
- }
-
- getshixunmemoMDvalue=(value, e)=>{
-
- this.setState({
- shixunmemoMDvalue:value
- })
- }
-
- setConfigsInputs=(e,keys,str)=>{
-
- let {shixun_service_configs}=this.state;
- let newshixun_service_configs=shixun_service_configs;
- newshixun_service_configs.map((item,key)=>{
- if(key===keys){
- switch (str) {
- case 1:
- item.cpu_limit=e.target.value
- break;
- case 2:
- item.lower_cpu_limit=e.target.value
- break;
- case 3:
- item.memory_limit=e.target.value
- break;
- case 4:
- item.request_limit=e.target.value
- break;
- }
- }
- })
-
- this.setState({
- shixun_service_configs:newshixun_service_configs,
- shixun_service_configlist:newshixun_service_configs,
- })
-
- }
-
- handleChange = (info) => {
- let {fileList}=this.state;
-
- if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
- console.log("handleChange1");
-
- // if(fileList.length===0){
- let fileLists = info.fileList;
- this.setState({ fileList:fileLists,
- deleteisnot:false});
- // }
- }
- }
-
- onAttachmentRemove = (file) => {
- if(!file.percent || file.percent == 100){
- confirm({
- title: '确定要删除这个附件吗?',
- okText: '确定',
- cancelText: '取消',
- // content: 'Some descriptions',
- onOk: () => {
- console.log("665")
- this.deleteAttachment(file)
- },
- onCancel() {
- console.log('Cancel');
- },
- });
- return false;
- }
-
- }
-
- deleteAttachment = (file) => {
- console.log(file);
- let id=file.response ==undefined ? file.id : file.response.id
- const url = `/attachments/${id}.json`
- axios.delete(url, {
- })
- .then((response) => {
- if (response.data) {
- const { status } = response.data;
- if (status == 0) {
- // console.log('--- success')
-
- this.setState((state) => {
-
- const index = state.fileList.indexOf(file);
- const newFileList = state.fileList.slice();
- newFileList.splice(index, 1);
- return {
- fileList: newFileList,
- deleteisnot:true
- };
- });
- }
- }
- })
- .catch(function (error) {
- console.log(error);
- });
- }
-
-
-
- render() {
- let {
- postapplyvisible,
- postapplytitle,
- shixunnametype,
- shixunmaintype,
- evaluate_scripttype,
- traineetype,
- standard_scripts,
- name,
- settingsData,
- webssh,
- is_secret_repository,
- use_scope,
- shixunsID,
- can_copy,
- choice_standard_scripts,
- Executiveordervalue,
- Executivetyoe,
- Compilecommandvalue,
- task_pass,
- test_set_permission,
- hide_code,
- forbid_copy,
- code_edit_permission,
- code_hidden,
- vnc,
- vnc_evaluate,
- scopetype,
- scope_partment,
- departmentslist,
- trainee,
- choice_main_type,
- choice_small_type,
- standard_scriptsModal,
- standard_scriptsModals,
- SelectTheCommandtype,
- testscripttiptype,
- operateshixunstype,
- opening_time,
- scope_partmenttype,
- newuse_scope,
- scope_partments,
- shixunmemoMDvalue,delType,
- shixun_service_configs,
- fileList,
- } = this.state;
-
- let options;
-
- if (departmentslist != undefined) {
- options = this.state.departmentslist.map((d, k) => {
- return (
-
- )
- })
- }
- const uploadProps = {
- width: 600,
- fileList,
- multiple: true,
- // https://github.com/ant-design/ant-design/issues/15505
- // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
- action: `${getUploadActionUrl()}`,
- onChange: this.handleChange,
- onRemove: this.onAttachmentRemove,
- beforeUpload: (file, fileList) => {
- if (this.state.fileList.length >= 1) {
- return false
- }
- // console.log('beforeUpload', file.name);
- const isLt150M = file.size / 1024 / 1024 < 50;
- if (!isLt150M) {
- // this.props.showNotification(`文件大小必须小于50MB`);
- notification.open(
- {
- message: '提示',
- description:
- '文件大小必须小于50MB',
-
- }
- )
- }
- if(this.state.file !== undefined){
- console.log("763")
- this.setState({
- file:file
- })
- }else {
- this.setState({
- file:file
- })
- }
-
- console.log("handleChange2");
- return isLt150M;
- },
- }
- const dateFormat = 'YYYY-MM-DD HH:mm:ss';
- let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ // let a="isvnc";
+ // let b="isVNC";
+ // console.log(a.indexOf("vnc"))
+ // console.log(b.indexOf("vnc"))
+ // console.log( this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails.is_jupyter === false ? "学习页面设置" : "")
return (
-
-
- 实训详情
- 配置
-
-
-
-
-
-
-
-
实训名称
-
-
-
*
-
-
- {settingsData === undefined ? "" :
- }
-
-
- 必填项
-
-
-
-
-
-
-
-
-
-
-
-
-
-
技术平台
-
-
-
-
*
-
-
-
- 列表中没有?
- 申请新建
-
-
-
-
-
-
-
-
-
{this.state.languagewritetype===true?"请填写该镜像语言":""}
-
-
-
-
-
{this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}
-
-
-
-
-
-
{this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}
-
-
-
-
-
- 上传附件
- (单个文件50M以内)
-
-
-
-
- {this.state.attachmentidstype===true?"请上传附件":""}
-
-
- this.sendhideModaly()}
- >取消
-
-
-
-
-
-
-
-
-
-
-
-
-
新建申请已提交,请等待管理员的审核
-
我们将在1-2个工作日内与您联系
-
-
-
-
-
-
-
-
-
-
-
- 必填项
-
- {/*
请在配置页面完成后续的评测脚本设置操作
*/}
-
-
-
- {/*
*/}
- {/*
*/}
-
-
评测脚本
-
-
-
-
-
原有脚本将被新的脚本覆盖,无法撤销
-
是否确认执行覆盖操作
-
-
-
-
-
-
-
-
-
-
- {
- this.props.identity<5||this.props.power==true?
-
使用自定义脚本 : ""
- }
-
-
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)}>知道了
-
-
-
-
-
-
-
-
-
- 执行命令不能为空
-
-
-
-
-
-
-
-
-
-
-
-
-
-
*
-
-
-
-
- {/**/}
-
-
-
-
- {/*
*/}
- {/*{evaluate_script===undefined?"":evaluate_script}*/}
-
- {/*
*/}
-
-
-
-
-
-
-
-
-
- {/*
*/}
- {/*
**/}
-
- {/*
程序最大执行时间
*/}
-
- {/*
秒*/}
-
- {/*
*/}
- {/*必填项*/}
- {/*
*/}
- {/*
*/}
-
- {/*
-
*
-
-
Pod存活时间
-
-
秒
-
-
- 必填项
-
-
*/}
-
-
-
-
命令行
-
- 无命令行窗口 (选中则不给学员的实践任务提供命令窗口)
- 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口)
- 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口)
-
- 多个命令行窗口(选中则允许学员同时开启多个命令行窗口)
-
-
-
-
-
-
公开程度
-
- 对所有公开 (选中则所有已被试用授权的用户可以学习)
- 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习)
-
-
-
-
-
-
-
-
- {/*{*/}
- {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/}
- {/*return(*/}
- {/*
*/}
- {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/}
- {/*value={item}*/}
- {/*/>*/}
- {/*
*/}
-
- {/*)*/}
- {/*})*/}
- {/*}*/}
-
-
-
- 请选择需要公开的单位
-
-
-
-
-
-
-
发布信息
-
-
-
*
-
面向学员:
-
-
-
-
-
实训难易度定位,不限定用户群体
-
- 必填项
-
-
-
-
- 复制:
-
-
-
-
-
-
-
- 跳关:
-
-
-
-
-
-
- 测试集解锁:
-
-
-
-
-
-
- {!code_hidden && !hide_code &&
- 代码开放修改:
-
-
-
-
-
}
-
-
- 隐藏代码窗口:
-
-
-
-
-
-
-
- 代码目录隐藏:
-
-
-
-
-
-
- { (vnc || webssh == 2) &&
- 私密版本库:
-
-
-
-
-
}
-
-
- 禁用复制粘贴:
-
-
-
-
-
-
-
- 开启时间:
-
-
-
-
-
-
- {this.props.identity<3?
- VNC图形化:
-
-
-
-
-
:""}
- {this.props.identity<3 && vnc ?
- VNC图形化评测:
-
-
-
-
-
:""}
-
-
-
-
-
- {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="请输入类别名称" />
-
-
-
-
-
-
- this.setConfigsInputs(e,key,2)}
- 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="请输入类别名称" />
-
-
-
-
-
-
- )
-
- })}
-
:""}
-
-
- {
- // this.props.identity<4&&this.props.status==0?
- this.props.identity<5?
-
:""
- }
-
+
+
+
+
+
+ {
+ this.props.identity < 5 && this.state.data && this.state.data.shixun.status == 0 ?
+
+ : ""
+ }
+ {
+ this.props.identity == 1 && this.state.data && this.state.data.shixun.status == 2 ?
+ : ""
+ }
+ {
+ this.props.identity === 1 && this.state.data && this.state.data.shixun.status == 2 ?
+ : ""
+ }
+
+ }>
+
+ this.getdatas(key)}
+ />
+
+
+ this.getdatas(key)}
+ />
+
+ {this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === false ?
+
+ this.getdatas(key)}
+ />
+ :"" }
+
+
+
+ {this.state.delType === 1 ?
是否确认删除 ?
:
+
关闭后,
用户不能再开始挑战了是否确认关闭 ?
}
+
+
+
取消
+ {this.state.delType === 1 ?
确定 :
+
确定}
+
+
+
-
);
}
}
diff --git a/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
index 8047bbde8..7abf2c70b 100644
--- a/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
+++ b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
@@ -111,3 +111,43 @@ a.newuse_scope-btn {
.ml82{
margin-left:82px;
}
+
+.Permanentban{
+ color:#5091FF !important;
+ border-color: #5091FF !important;
+}
+
+/*tab*/
+.ant-tabs-nav{
+ padding-bottom:18px;
+ padding-top: 18px;
+}
+
+.ant-tabs-extra-content{
+ margin-top: 18px;
+}
+
+.pdb30{
+ padding-bottom: 30px;
+}
+
+.openrenyuan{
+ margin-top: 5px !important;
+ display: inline-block;
+}
+
+.ml81{
+ margin-left:81px;
+}
+
+.ml32s{
+ margin-left: 32px;
+}
+
+.ml64{
+ margin-left: 64px;
+}
+
+.ml160{
+ margin-left: 160px;
+}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js b/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js
new file mode 100644
index 000000000..8688e9669
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js
@@ -0,0 +1,2437 @@
+import React, { Component } from 'react';
+
+import MonacoEditor from 'react-monaco-editor';
+
+//MonacoDiffEditor 对比模式
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip} from 'antd';
+
+// import "antd/dist/antd.css";
+
+import locale from 'antd/lib/date-picker/locale/zh_CN';
+
+import moment from 'moment';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+let origin = getUrl();
+
+let path = getUrl("/editormd/lib/")
+
+const $ = window.$;
+
+let timeout;
+
+let currentValue;
+
+const Option = Select.Option;
+
+const RadioGroup = Radio.Group;
+const confirm = Modal.confirm;
+// 处理整点 半点
+// 取传入时间往后的第一个半点
+export function handleDateStrings(dateString) {
+ if (!dateString) return dateString;
+ const ar = dateString.split(':')
+ if (ar[1] == '00' || ar[1] == '30') {
+ return dateString
+ }
+ const miniute = parseInt(ar[1]);
+ if (miniute < 30 || miniute == 60) {
+ return [ar[0], '30'].join(':')
+ }
+ if (miniute < 60) {
+ // 加一个小时
+ const tempStr = [ar[0], '00'].join(':');
+ const format = "YYYY-MM-DD HH:mm";
+ const _moment = moment(tempStr, format)
+ _moment.add(1, 'hours')
+ return _moment.format(format)
+ }
+
+ return dateString
+}
+
+// 恢复数据
+function md_rec_data(k,mdu,id, editor){
+ if(window.sessionStorage.getItem(k+mdu) !== null){
+ editor.setValue(window.sessionStorage.getItem(k+mdu));
+ md_clear_data(k,mdu,id);
+ }
+}
+
+// 保存数据
+function md_add_data(k,mdu,d){
+ window.sessionStorage.setItem(k+mdu,d);
+}
+
+// 清空保存的数据
+function md_clear_data(k,mdu,id){
+ window.sessionStorage.removeItem(k+mdu);
+ var id1 = "#e_tip_"+id;
+ var id2 = "#e_tips_"+id;
+ if(k == 'content'){
+ $(id2).html("");
+ }else{
+ $(id1).html("");
+ }
+}
+
+function md_elocalStorage(editor,mdu,id){
+ if (window.sessionStorage){
+ var oc = window.sessionStorage.getItem('content'+mdu);
+ if(oc !== null ){
+ $("#e_tips_"+id).data('editor', editor);
+ var h = '您上次有已保存的数据,是否
恢复 ? /
不恢复';
+ $("#e_tips_"+id).html(h);
+ }
+ setInterval(function() {
+ var d = new Date();
+ var h = d.getHours();
+ var m = d.getMinutes();
+ var s = d.getSeconds();
+ h = h < 10 ? '0' + h : h;
+ m = m < 10 ? '0' + m : m;
+ s = s < 10 ? '0' + s : s;
+ if(editor.getValue().trim() != ""){
+ md_add_data("content",mdu,editor.getValue());
+ var id1 = "#e_tip_"+id;
+ var id2 = "#e_tips_"+id;
+
+ $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
+ $(id2).html("");
+ }
+ },10000);
+
+ }else{
+ $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
+ }
+}
+
+function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
+ var editorName = window.editormd(id, {
+ width: width,
+ height: high,
+ path: path, // "/editormd/lib/"
+ markdown : initValue,
+ syncScrolling: "single",
+ tex: true,
+ tocm: true,
+ emoji: true,
+ taskList: true,
+ codeFold: true,
+ searchReplace: true,
+ htmlDecode: "style,script,iframe",
+ sequenceDiagram: true,
+ autoFocus: false,
+ placeholder: placeholder,
+ toolbarIcons: function () {
+ // Or return editormd.toolbarModes[name]; // full, simple, mini
+ // Using "||" set icons align right.
+ return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
+ },
+ toolbarCustomIcons: {
+ testIcon: "
",
+ testIcon1: "
"
+ },
+ //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
+ saveHTMLToTextarea: true,
+ // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
+ dialogMaskOpacity: 0.6,
+ imageUpload: true,
+ imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
+ imageUploadURL: imageUrl,//url
+ onload: function () {
+ // this.previewing();
+ $("#" + id + " [type=\"latex\"]").bind("click", function () {
+ editorName.cm.replaceSelection("```latex");
+ editorName.cm.replaceSelection("\n");
+ editorName.cm.replaceSelection("\n");
+ editorName.cm.replaceSelection("```");
+ var __Cursor = editorName.cm.getDoc().getCursor();
+ editorName.cm.setCursor(__Cursor.line - 1, 0);
+ });
+
+ $("#" + id + " [type=\"inline\"]").bind("click", function () {
+ editorName.cm.replaceSelection("`$$$$`");
+ var __Cursor = editorName.cm.getDoc().getCursor();
+ editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
+ editorName.cm.focus();
+ });
+ $("[type=\"inline\"]").attr("title", "行内公式");
+ $("[type=\"latex\"]").attr("title", "多行公式");
+
+ callback && callback()
+ }
+ });
+ return editorName;
+}
+
+
+function updatamakedown(id){
+ setTimeout(()=>{
+ var shixunDescr = window.editormd.markdownToHTML(id, {
+ htmlDecode: "style,script,iframe",
+ taskList: true,
+ tex: true,
+ flowChart: true,
+ sequenceDiagram: true
+ });
+ $("#"+id+" p:first").addClass("ReactMarkdown");
+ $('#collaborators_list_info').show()
+ }, 200)
+}
+
+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 TPMsettings extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ fileList: [],
+ commandLine: 0,
+ Openpublic: 0,
+ settingsData: undefined,
+ webssh: 0,
+ use_scope: 0,
+ shixunsstatus: 0,
+ shixunsID: undefined,
+ exec_time: undefined,
+ trainee: undefined,
+ can_copy: undefined,
+ task_pass: undefined,
+ test_set_permission: undefined,
+ code_edit_permission: undefined,
+ hide_code: undefined,
+ code_hidden: undefined,
+ forbid_copy: undefined,
+ vnc: undefined,
+ name: undefined,
+ scope_partment: undefined,
+ scopetype: false,
+ departmentslist: undefined,
+ description: '',
+ evaluate_script:undefined,
+ standard_scripts: undefined,
+ choice_main_type: "",
+ choice_small_type: [],
+ choice_standard_scripts:undefined,
+ editordescriptios: undefined,
+ editorevaluate_scripts: undefined,
+ choice_standard_scriptssum: undefined,
+ visibleTemplate: false,
+ Executiveordervalue: "",
+ Compilecommandvalue: "",
+ Executivetyoe: false,
+ postapplyvisible: false,
+ sendsure_applyvalue: undefined,
+ postapplytitle: false,
+ shixunnametype: false,
+ shixunmaintype: false,
+ evaluate_scripttype: false,
+ exec_timetype: false,
+ traineetype: false,
+ standard_scriptsModal:false,
+ standard_scriptsModals:false,
+ SelectTheCommandtype:false,
+ multi_webssh:false,
+ status:0,
+ opers:false,
+ operss:false,
+ testscripttiptype:false,
+ opersss:false,
+ operateshixunstype:false,
+ opening_time:"",
+ opensmail:false,
+ scope_partmenttype:false,
+ newuse_scope:undefined,
+ scope_partments:0,
+ shixun_service_configs:undefined,
+ shixun_service_configlist:undefined,
+ pod_exist_time: undefined,
+ pod_exist_timetype: false,
+ shixunmemoMDvalue:"",
+ language:"",
+ deleteisnot:true
+ }
+ }
+ descriptionMD=(initValue, id)=> {
+
+ this.contentChanged = false;
+ const placeholder = "";
+// amp;
+// 编辑时要传memoId
+ const imageUrl = `/api/attachments.json`;
+// 创建editorMd
+
+ const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ setTimeout(() => {
+ description_editormd.resize()
+ description_editormd.cm && description_editormd.cm.refresh()
+ }, 500)
+
+ if (initValue != undefined) {
+ description_editormd.setValue(initValue)
+ }
+ description_editormd.cm.on("change", (_cm, changeObj) => {
+ console.log('....contentChanged')
+ this.contentChanged = true;
+ })
+ });
+ md_elocalStorage(description_editormd, `MemoQuestion_${id}`, `${id}Question`);
+ this.description_editormd = description_editormd;
+ window.description_editormd = description_editormd;
+ }
+
+ evaluate_scriptMD=(initValue, id)=> {
+ this.contentChanged = false;
+ const placeholder = "";
+// amp;
+// 编辑时要传memoId
+ const imageUrl = `/api/attachments.json`;
+// 创建editorMd
+
+ const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
+ setTimeout(() => {
+ evaluate_script_editormd.resize()
+ evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh()
+ }, 500)
+
+ if (initValue != undefined) {
+ evaluate_script_editormd.setValue(initValue)
+ }
+ evaluate_script_editormd.cm.on("change", (_cm, changeObj) => {
+ console.log('....contentChanged')
+ this.contentChanged = true;
+ })
+ });
+ md_elocalStorage(evaluate_script_editormd, `MemoQuestion_${id}`, `${id}Question`);
+ this.evaluate_script_editormd = evaluate_script_editormd;
+ window.evaluate_script_editormd = evaluate_script_editormd;
+
+ }
+
+
+
+ componentDidMount() {
+
+ let id=this.props.match.params.shixunId;
+
+ let Url=`/shixuns/`+id+`/settings.json`;
+
+ axios.get(Url).then((response)=> {
+ // alert(response.data.shixun.choice_standard_scripts)
+ if(response.status===200){
+ this.setState({
+ shixunsID: id,
+ settingsData: response.data,
+ webssh: response.data.shixun.webssh,
+ use_scope: response.data.shixun.use_scope,
+ shixunsstatus: response.data.shixun.status,
+ exec_time: response.data.shixun.exec_time,
+ trainee: response.data.shixun.trainee,
+ can_copy: response.data.shixun.can_copy,
+ task_pass: response.data.shixun.task_pass,
+ test_set_permission: response.data.shixun.test_set_permission,
+ hide_code: response.data.shixun.hide_code,
+ code_edit_permission: response.data.shixun.code_edit_permission,
+ code_hidden: response.data.shixun.code_hidden,
+ is_secret_repository: response.data.shixun.is_secret_repository,
+ init_is_secret_repository: response.data.shixun.is_secret_repository,
+ forbid_copy: response.data.shixun.forbid_copy,
+ vnc: response.data.shixun.vnc,
+ vnc_evaluate: response.data.shixun.vnc_evaluate,
+ name: response.data.shixun.name,
+ scope_partment: response.data.shixun.scope_partment,
+ description: response.data.shixun.description,
+ evaluate_script: response.data.shixun.evaluate_script,
+ choice_main_type: response.data.shixun.choice_main_type,
+ choice_small_type: response.data.shixun.choice_small_type,
+ choice_standard_scripts: response.data.shixun.choice_standard_scripts,
+ standard_scripts:response.data.shixun.standard_scripts,
+ multi_webssh:response.data.shixun.multi_webssh,
+ status:response.data.shixun.status,
+ opening_time:response.data.shixun.opening_time,
+ newuse_scope:response.data.shixun.use_scope,
+ scope_partments: response.data.shixun.scope_partment.length,
+ shixunmemoMDvalue:response.data.shixun.evaluate_script,
+ shixun_service_configs:response.data.shixun.shixun_service_configs,
+ shixun_service_configlist:response.data.shixun.shixun_service_configs,
+ })
+
+ // if(response.data.status===403){
+ // message: "您没有权限进行该操作"
+ // this.setState({
+ // :true
+ // message403:response.data.message
+ // })
+ // }
+
+
+ if(response.data.shixun.multi_webssh===true){
+ this.setState({
+ SelectTheCommandtype:true
+ })
+ }else{
+ this.setState({
+ SelectTheCommandtype:false
+ })
+ }
+ if (response.data.shixun.scope_partment.length > 0) {
+ this.setState({
+ scopetype: true
+ })
+ }
+ // console.log(response.data.shixun.description)
+ // console.log(response.data.shixun.evaluate_script)
+ // console.log(response.data.shixun.description)
+ // this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2
+
+
+ // this.evaluate_scriptMD(response.data.shixun.evaluate_script, "shixunmemoMD");
+
+ this.descriptionMD(response.data.shixun.description, "shixundescription");
+
+ // this.bigClass()
+ // if (response.data.shixun.status === 2) {
+ //
+ // } else if (response.data.shixun.status === 1) {
+ // this.props.showSnackbar("这个实训已发布不能修改!");
+ // } else if (response.data.shixun.status === 3) {
+ // this.props.showSnackbar("这个实训已关闭不能修改!");
+ // }
+ }
+
+ });
+
+
+ let departmentsUrl = `/shixuns/departments.json`;
+ axios.get(departmentsUrl).then((response) => {
+ if (response.status === 200) {
+ if (response.data.message === undefined) {
+ this.setState({
+ departmentslist: response.data.shools_name
+ });
+ }
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+
+
+
+ }
+
+ SelectshixunCommand=(e)=>{
+ // console.log( e.target.value)
+ const webssh = e.target.value
+ if (webssh == 2) {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: true,
+ multi_webssh:false
+ });
+ } else {
+ if (this.state.init_is_secret_repository && !this.state.vnc && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh:false
+ });
+ }
+ })
+ } else {
+ if (!this.state.vnc) {
+ this.setState({
+ is_secret_repository: false,
+ })
+ }
+ this.setState({
+ webssh: webssh,
+ SelectTheCommandtype: false,
+ multi_webssh:false
+ });
+ }
+ }
+
+ // this.setState({
+ // webssh: webssh,
+ // });
+ // if(webssh===2){
+ // this.setState({
+ // SelectTheCommandtype: true,
+ // multi_webssh:false
+ // });
+ // }else{
+ // this.setState({
+ // SelectTheCommandtype: false,
+ // multi_webssh:false
+ // });
+ // }
+ }
+
+ SelectOpenpublic=(e)=>{
+ this.setState({
+ Openpublic: e.target.value
+ });
+ }
+
+ can_copy=(e)=>{
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ can_copy: sum,
+ });
+
+ }
+
+ task_pass=(e)=>{
+
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ task_pass: sum,
+ });
+ }
+
+ test_set_permission=(e)=>{
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ test_set_permission: sum,
+ });
+
+ }
+
+ hide_code=(e)=>{
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ hide_code: sum,
+ });
+
+ }
+ code_edit_permission = (e) => {
+ this.setState({
+ code_edit_permission: e.target.checked
+ })
+ }
+ code_hidden=(e)=>{
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ code_hidden: sum,
+ });
+
+ }
+ confirmDeleteSecretRepo = ({title, onOk}) => {
+ confirm({
+ title: title ||
+
已创建的私密版本库及其内容,将在“保存”时被删除。
+
是否确认取消勾选?
+
,
+ okText: '确定',
+ cancelText: '取消',
+ onOk: () => {
+ this.setState({ is_secret_repository: false })
+ onOk && onOk()
+ },
+ onCancel() {
+ },
+ });
+ }
+ is_secret_repository = (e) => {
+ const checked = e.target.checked
+ if (!checked) {
+ if (this.state.init_is_secret_repository) {
+ this.confirmDeleteSecretRepo({
+ })
+ } else {
+ this.setState({ is_secret_repository: false })
+ }
+ } else {
+ this.setState({ is_secret_repository: true })
+ }
+ }
+ forbid_copy = (e) => {
+ let sum = ""
+ if (e.target.checked === false) {
+ sum = 0
+ } else if (e.target.checked === true) {
+ sum = 1
+ }
+ this.setState({
+ forbid_copy: sum,
+ });
+ }
+ shixun_vnc_evaluate=(e) => {
+ this.setState({
+ vnc_evaluate: e.target.checked,
+ });
+
+ }
+
+ shixun_vnc=(e)=>{
+ // let sum = ""
+ // if (e.target.checked === false) {
+ // sum = 0
+ // } else if (e.target.checked === true) {
+ // sum = 1
+ // }
+ const vnc = e.target.checked;
+ if (!vnc) {
+ if (this.state.init_is_secret_repository && this.state.webssh != 2 && this.state.is_secret_repository == true) {
+ this.confirmDeleteSecretRepo({
+ onOk: () => {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ })
+ } else {
+ if (this.state.webssh != 2) {
+ this.setState({
+ is_secret_repository: false
+ })
+ }
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ } else {
+ this.setState({
+ vnc: e.target.checked,
+ vnc_evaluate: false,
+ });
+ }
+ }
+ shixunsname = (e) => {
+ // let {shixunsstatus}=this.state;
+ // if(shixunsstatus>0){
+ // return
+ // }
+ this.setState({
+ name: e.target.value,
+ shixunnametype:false
+ })
+ }
+
+ bigClass = (value) => {
+ // choice_main_type
+ // choice_small_type
+ let {settingsData,shixun_service_configs,choice_main_type,choice_small_type}=this.state;
+
+ let list=[]
+ list.push(choice_main_type)
+ choice_small_type.map((item,key)=>{
+ list.push(item)
+ })
+
+ let newshixun_service_configs=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)
+ }
+ })
+ })
+
+
+ settingsData.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)
+ });
+
+
+
+ }
+ Deselectlittle=(value)=>{
+
+ let {shixun_service_configs,choice_small_type}=this.state;
+ let newshixun_service_configs=shixun_service_configs;
+ let newchoice_small_type=choice_small_type;
+
+ newshixun_service_configs.some((item,key)=> {
+ if (item.mirror_repository_id === value) {
+ newshixun_service_configs.splice(key, 1)
+ return true
+ }
+ }
+ )
+
+ newchoice_small_type.some((item,key)=> {
+ if (item === value) {
+ newchoice_small_type.splice(key, 1)
+ return true
+ }
+ }
+ )
+
+
+ this.setState({
+ choice_small_type: newchoice_small_type,
+ shixun_service_configs:newshixun_service_configs,
+ shixun_service_configlist:newshixun_service_configs,
+ })
+ }
+ littleClass = (value) => {
+
+ let {settingsData,shixun_service_configs,choice_small_type,choice_main_type}=this.state;
+ let newshixun_service_configs=shixun_service_configs;
+ let newchoice_small_type=choice_small_type;
+ // if(Array.isArray(value)===true){
+ // value.map((item,key)=>{
+ // settingsData.shixun.small_type.some((items,keys)=> {
+ // if (items.id === item) {
+ // newshixun_service_configs.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
+ // }
+ // }
+ // )
+ // })
+ // }
+
+ let list=[]
+ list.push(choice_main_type)
+ choice_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)
+ }
+ })
+ })
+
+ settingsData.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,
+ })
+ }
+ onPodExistTimeChange = (e) => {
+ this.setState({
+ pod_exist_time: e.target.value,
+ pod_exist_timetype: false,
+ })
+ }
+ Timevalue = (e) => {
+ this.setState({
+ exec_time: e.target.value
+ })
+ }
+ SelectOpenpublic = (e) => {
+ this.setState({
+ scopetype: false,
+ use_scope: e.target.value,
+ });
+ if (e.target.value === 1) {
+ this.setState({
+ scopetype: true
+ });
+ }
+
+ }
+ deleteScopeInput = (key) => {
+ let {scope_partment} = this.state;
+ let datalist = scope_partment;
+ datalist.splice(key, 1);
+ this.setState({
+ scope_partment: datalist
+ });
+ }
+
+ shixunScopeInput = (e) => {
+ let {scope_partment} = this.state;
+ let datalist = scope_partment;
+ if (datalist===undefined) {
+ datalist=[]
+ }
+
+ datalist.push(e)
+ // else {
+ // datalist[id] = e
+ // }
+ this.setState({
+ scope_partment: datalist
+ });
+ }
+ // adduse_scopeinput = () => {
+ // let {scope_partment} = this.state;
+ // let array = scope_partment;
+ // let newarray = ""
+ // array.push(newarray)
+ // this.setState({
+ // scope_partment: array,
+ // });
+ // }
+ submit_edit_shixun = () => {
+ if (this.saving == true) return;
+ this.saving = true;
+ if(this.state.status===-1){
+ this.props.showSnackbar("该实训已被删除,保存失败!");
+ return
+ }
+
+ let {
+ name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
+ evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
+ opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
+ } = this.state;
+
+ let newshixun_service_configlist = shixun_service_configlist.map(v => {
+ let v1 = Object.assign({},v);
+ delete v1.name;
+ return v1
+ });
+
+ // let operateauthority=
+ // this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+ // this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
+
+ const description_editormd = this.description_editormd.getValue();
+
+ let evaluate_script_editormd;
+
+ if(this.state.status==0||this.state.status==1||this.state.status==2&&this.props.identity===1){
+ // evaluate_script_editormd = this.evaluate_script_editormd.getValue();
+ evaluate_script_editormd = shixunmemoMDvalue
+ }else{
+ evaluate_script_editormd = evaluate_script;
+ }
+
+
+
+ if (name === "") {
+ this.setState({
+ shixunnametype: true
+ })
+ $('html').animate({
+ scrollTop: 10
+ }, 1000);
+ return
+ }
+ if (choice_main_type === "") {
+ this.setState({
+ shixunmaintype: true
+ })
+ $('html').animate({
+ scrollTop: 800
+ }, 1000);
+ return
+ }
+ if (evaluate_script_editormd === "") {
+ this.setState({
+ evaluate_scripttype: true
+ })
+ $('html').animate({
+ scrollTop: 1200
+ }, 1000);
+ return
+ }
+ if(use_scope===1){
+
+ if(scope_partment===undefined||scope_partment.length===0){
+ this.setState({
+ scope_partmenttype: true
+ })
+ $('html').animate({
+ scrollTop: 2500
+ }, 1000);
+ this.props.showSnackbar("公开程度,指定单位为空");
+ return
+ }
+ }
+ // if (exec_time === "") {
+ // this.setState({
+ // exec_timetype: true
+ // })
+ // $('html').animate({
+ // scrollTop: 1500
+ // }, 1000);
+ // return
+ // }
+
+ // if (!pod_exist_time) {
+ // this.setState({
+ // pod_exist_timetype: true
+ // })
+ // $("html, body").animate({ scrollTop: $('#pod_exist_time').offset().top - 100 }, 1000)
+ // return
+ // }
+
+ if (trainee === "") {
+ this.setState({
+ traineetype: true
+ })
+ return
+ }
+
+ let id = this.props.match.params.shixunId;
+
+ let newmulti_webssh=multi_webssh;
+
+
+ if(newmulti_webssh===null){
+ newmulti_webssh=false
+ }
+
+ //exec_time: exec_time,
+ let Url = `/shixuns/` + id + `.json`;
+ let data = {
+ shixun:{
+
+ name: name,
+ webssh: webssh,
+ use_scope: use_scope,
+ can_copy: can_copy,
+ vnc: vnc===null?undefined:vnc,
+ vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
+ test_set_permission: test_set_permission,
+ code_hidden: code_hidden,
+ code_edit_permission: code_edit_permission,
+ trainee: trainee,
+ task_pass: task_pass,
+ hide_code: hide_code,
+ forbid_copy: forbid_copy,
+ multi_webssh:newmulti_webssh,
+ opening_time:opening_time,
+ mirror_script_id:choice_standard_scriptssum===undefined?choice_standard_scripts:choice_standard_scriptssum,
+ },
+ shixun_info:{
+ description: description_editormd,
+ evaluate_script: evaluate_script_editormd,
+ },
+ is_secret_repository: is_secret_repository,
+ main_type: choice_main_type,
+ small_type: choice_small_type,
+ scope_partment: scope_partment,
+ shixun_service_configs:newshixun_service_configlist
+ }
+
+ axios.put(Url, data).then((response) => {
+ // console.log(response)
+ this.saving = false;
+ if(response.status){
+ if (response.data.status === -1) {
+ this.props.showSnackbar(response.data.message);
+ return
+ } else {
+ window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
+ }
+ }
+
+ }).catch((error) => {
+ console.log(error)
+ this.saving = false;
+ })
+
+
+ }
+ shixunsfetch = (value, callback) => {
+ if (timeout) {
+ clearTimeout(timeout);
+ timeout = null;
+ }
+ currentValue = value;
+
+ function fake() {
+ let departmentsUrl = `/shixuns/departments.json?q=` + currentValue;
+ axios.get(departmentsUrl).then((response) => {
+ callback(response.data.shools_name);
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
+
+ timeout = setTimeout(fake, 300);
+ }
+ shixunHandleSearch = (value) => {
+ this.shixunsfetch(value, departmentslist => this.setState({departmentslist}));
+ }
+
+
+
+
+ shixunsclose = () => {
+ let id = this.props.match.params.shixunId;
+ let cul = `/shixuns/` + id + `/close.json`;
+ axios.post(cul).then((response) => {
+ if(response.data.status===1){
+ this.props.showSnackbar("操作成功");
+ this.setState({
+ operateshixunstype: false,
+ });
+
+ window.location.href = "/shixuns/" + id + "/challenges";
+ }
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+
+ shixunsdel= () => {
+ let id = this.props.match.params.shixunId;
+ let cul = `/shixuns/` + id +`.json`;
+
+ axios.delete(cul).then((response) => {
+ if(response.data.status===1){
+ this.props.showSnackbar("操作成功");
+ this.setState({
+ operateshixunstype: false,
+ });
+
+ window.location.href = "/shixuns";
+ }
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+
+ Executiveorder = (e) => {
+ this.setState({
+ Executiveordervalue: e.target.value
+ })
+ }
+
+ Compilecommand = (e) => {
+ this.setState({
+ Compilecommandvalue: e.target.value
+ })
+ }
+
+ handleCancelTemplate = (e) => {
+ this.setState({
+ Executiveordervalue: "",
+ Compilecommandvalue: "",
+ visibleTemplate: false
+ })
+ }
+
+ hideModalTemplate = (e) => {
+ let id = this.props.match.params.shixunId;
+ let {Executiveordervalue, Compilecommandvalue} = this.state;
+
+ if (Executiveordervalue === "") {
+ this.setState({
+ Executivetyoe: true,
+ });
+ return
+ }
+ // Executiveordervalue=String(Executiveordervalue);
+ // Compilecommandvalue=String(Compilecommandvalue);
+ let trl = `/shixuns/${id}/get_custom_script.json?compile=${Executiveordervalue}&excutive=${Compilecommandvalue}`
+ axios.get(trl).then((response) => {
+ // this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD");
+ this.setState({
+ shixunmemoMDvalue:response.data.shixun_script
+ })
+ }).catch((error) => {
+ console.log(error)
+ });
+ this.setState({
+ visibleTemplate: false
+ })
+ }
+
+ showModal = () => {
+ this.setState({
+ visibleTemplate: true,
+ });
+ }
+ Selecttrainee = (value) => {
+ this.setState({
+ trainee: value,
+ });
+ }
+
+ post_apply = () => {
+ this.setState({
+ postapplyvisible: true
+ })
+ }
+
+ sendsure_applyvalues = (e) => {
+ this.setState({
+ sendsure_applyvalue: e.target.value
+ })
+ }
+
+ setlanguagewrite = (e)=>{
+ this.setState({
+ languagewrite: e.target.value
+ })
+ }
+
+ setsystemenvironment = (e) => {
+ this.setState({
+ systemenvironment: e.target.value
+ })
+ }
+
+ settestcoderunmode = (e) => {
+ this.setState({
+ testcoderunmode: e.target.value
+ })
+
+ }
+
+ sendsure_apply = () => {
+ let {languagewrite,systemenvironment,testcoderunmode} = this.state;
+ // console.log("点击确定")
+ // console.log("languagewrite"+languagewrite);
+ // console.log("systemenvironment"+systemenvironment);
+ // console.log("testcoderunmode"+testcoderunmode);
+
+ // let attachment_ids = undefined
+ // if (this.state.fileList) {
+ // attachment_ids = this.state.fileList.map(item => {
+ // return item.response ? item.response.id : item.id
+ // })
+ // }
+ if(languagewrite === undefined || languagewrite === "" ){
+ // this.props.showNotification(`请填写该镜像是基于什么语言`);
+ this.setState({
+ languagewritetype:true
+ })
+ return
+ }
+ if(systemenvironment === undefined || systemenvironment === ""){
+ // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
+ this.setState({
+ systemenvironmenttype:true
+ })
+ return;
+
+ }
+ if(testcoderunmode === undefined || testcoderunmode === "") {
+ // 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){
+
+ // notification.open(
+ // {
+ // message: '提示',
+ // description:
+ // '请上传附件!',
+ //
+ // }
+ // )
+ this.setState({
+ attachmentidstype:true
+ })
+ return;
+ }
+ // console.log("attachment_ids"+attachment_ids);
+
+ // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids);
+
+ var data={
+ language:languagewrite,
+ runtime:systemenvironment,
+ run_method:testcoderunmode,
+ attachment_id:attachment_ids[0],
+ }
+ var url =`/shixuns/apply_shixun_mirror.json`;
+ axios.post(url,data
+ ).then((response) => {
+
+ try {
+ if (response.data) {
+ // const { id } = response.data;
+ // if (id) {
+ if(this.state.file !== undefined){
+ console.log("549");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file:undefined,
+ deleteisnot:true,
+ languagewrite:"",
+ systemenvironment:"",
+ testcoderunmode:"",
+ fileList:[]
+ })
+ }else {
+ this.setState({
+ file:undefined,
+ deleteisnot:true,
+ languagewrite:"",
+ systemenvironment:"",
+ testcoderunmode:"",
+ fileList:[]
+ })
+ }
+ // this.props.showNotification('提交成功!');
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '提交成功!',
+
+ }
+ )
+ this.sendhideModaly()
+ // this.props.history.push(`/courses/${cid}/graduation_topics`);
+ // }
+ }
+ }catch (e) {
+
+ }
+
+ })
+
+ }
+
+ sendhideModaly = () => {
+ this.setState({
+ postapplyvisible: false,
+ })
+ if(this.state.file !== undefined){
+ console.log("580");
+ // this.deleteAttachment(this.state.file);
+ this.setState({
+ file:undefined,
+ deleteisnot:true,
+ languagewrite:"",
+ systemenvironment:"",
+ testcoderunmode:"",
+ fileList:[]
+ })
+ }else {
+ this.setState({
+ file:undefined,
+ deleteisnot:true,
+ languagewrite:"",
+ systemenvironment:"",
+ testcoderunmode:"",
+ fileList:[]
+ })
+ }
+ }
+
+ yeshidemodel = () => {
+ this.setState({
+ postapplytitle: false
+ })
+ }
+
+ SelectScput = (value, e) => {
+ this.setState({
+ choice_standard_scriptssum: value,
+ language:e.props.name,
+ choice_standard_scripts: {id:e.props.value,value:""},
+ standard_scriptsModal:true
+ })
+ }
+
+ hidestandard_scriptsModal=()=>{
+ this.setState({
+ standard_scriptsModal:false,
+ standard_scriptsModals:false
+ })
+ }
+
+ get_mirror_script=()=>{
+ let {choice_standard_scriptssum}=this.state;
+ let id = this.props.match.params.shixunId;
+ let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum;
+ axios.get(pul).then((response) => {
+ if(response.status===200){
+ // this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
+ this.setState({
+ standard_scriptsModal:false,
+ standard_scriptsModals:true,
+ shixunmemoMDvalue:response.data.content
+ })
+ }
+
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+
+
+ SelectTheCommandonChange=(e)=>{
+ this.setState({
+ multi_webssh:e.target.checked
+ })
+ }
+
+ bigopen=()=>{
+ this.setState({
+ opers:true
+ })
+
+ }
+
+ bigopens=()=>{
+ this.setState({
+ opers:false,
+ operss:false,
+ opersss:false,
+ opensmail:false
+ })
+
+ }
+ bigopensmal=(e)=>{
+ this.setState({
+ opensmail:true
+ })
+
+ }
+ sbigopen=(e)=>{
+ this.setState({
+ operss:true
+ })
+
+ }
+
+ sbigopens=()=>{
+ this.setState({
+ operss:false
+ })
+ }
+ sbigopenss=(e)=>{
+ this.setState({
+ opersss:true
+ })
+
+ }
+
+ sbigopensss=()=>{
+ this.setState({
+ opersss:false
+ })
+ }
+ testscripttip=(val)=>{
+ if(val===0){
+ this.setState({
+ testscripttiptype:true
+ })
+ }else if(val===1){
+ this.setState({
+ testscripttiptype:false
+ })
+ }
+ }
+
+ operateshixuns=(value)=>{
+ this.setState({
+ operateshixunstype:true,
+ delType:value
+ })
+ }
+
+ hideoperateshixuns=()=>{
+ this.setState({
+ operateshixunstype:false
+ })
+ }
+ onChangeTimePicker =(value, dateString)=> {
+ this.setState({
+ opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
+ })
+ }
+
+ getshixunmemoMDvalue=(value, e)=>{
+
+ this.setState({
+ shixunmemoMDvalue:value
+ })
+ }
+
+ setConfigsInputs=(e,keys,str)=>{
+
+ let {shixun_service_configs}=this.state;
+ let newshixun_service_configs=shixun_service_configs;
+ newshixun_service_configs.map((item,key)=>{
+ if(key===keys){
+ switch (str) {
+ case 1:
+ item.cpu_limit=e.target.value
+ break;
+ case 2:
+ item.lower_cpu_limit=e.target.value
+ break;
+ case 3:
+ item.memory_limit=e.target.value
+ break;
+ case 4:
+ item.request_limit=e.target.value
+ break;
+ }
+ }
+ })
+
+ this.setState({
+ shixun_service_configs:newshixun_service_configs,
+ shixun_service_configlist:newshixun_service_configs,
+ })
+
+ }
+
+ handleChange = (info) => {
+ let {fileList}=this.state;
+
+ if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
+ console.log("handleChange1");
+
+ // if(fileList.length===0){
+ let fileLists = info.fileList;
+ this.setState({ fileList:fileLists,
+ deleteisnot:false});
+ // }
+ }
+ }
+
+ onAttachmentRemove = (file) => {
+ if(!file.percent || file.percent == 100){
+ confirm({
+ title: '确定要删除这个附件吗?',
+ okText: '确定',
+ cancelText: '取消',
+ // content: 'Some descriptions',
+ onOk: () => {
+ console.log("665")
+ this.deleteAttachment(file)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ return false;
+ }
+
+ }
+
+ deleteAttachment = (file) => {
+ console.log(file);
+ let id=file.response ==undefined ? file.id : file.response.id
+ const url = `/attachments/${id}.json`
+ axios.delete(url, {
+ })
+ .then((response) => {
+ if (response.data) {
+ const { status } = response.data;
+ if (status == 0) {
+ // console.log('--- success')
+
+ this.setState((state) => {
+
+ const index = state.fileList.indexOf(file);
+ const newFileList = state.fileList.slice();
+ newFileList.splice(index, 1);
+ return {
+ fileList: newFileList,
+ deleteisnot:true
+ };
+ });
+ }
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+
+
+ render() {
+ let {
+ postapplyvisible,
+ postapplytitle,
+ shixunnametype,
+ shixunmaintype,
+ evaluate_scripttype,
+ traineetype,
+ standard_scripts,
+ name,
+ settingsData,
+ webssh,
+ is_secret_repository,
+ use_scope,
+ shixunsID,
+ can_copy,
+ choice_standard_scripts,
+ Executiveordervalue,
+ Executivetyoe,
+ Compilecommandvalue,
+ task_pass,
+ test_set_permission,
+ hide_code,
+ forbid_copy,
+ code_edit_permission,
+ code_hidden,
+ vnc,
+ vnc_evaluate,
+ scopetype,
+ scope_partment,
+ departmentslist,
+ trainee,
+ choice_main_type,
+ choice_small_type,
+ standard_scriptsModal,
+ standard_scriptsModals,
+ SelectTheCommandtype,
+ testscripttiptype,
+ operateshixunstype,
+ opening_time,
+ scope_partmenttype,
+ newuse_scope,
+ scope_partments,
+ shixunmemoMDvalue,delType,
+ shixun_service_configs,
+ fileList,
+ } = this.state;
+
+ let options;
+
+ if (departmentslist != undefined) {
+ options = this.state.departmentslist.map((d, k) => {
+ return (
+
+ )
+ })
+ }
+ const uploadProps = {
+ width: 600,
+ fileList,
+ multiple: true,
+ // https://github.com/ant-design/ant-design/issues/15505
+ // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
+ // showUploadList: false,
+ action: `${getUploadActionUrl()}`,
+ onChange: this.handleChange,
+ onRemove: this.onAttachmentRemove,
+ beforeUpload: (file, fileList) => {
+ if (this.state.fileList.length >= 1) {
+ return false
+ }
+ // console.log('beforeUpload', file.name);
+ const isLt150M = file.size / 1024 / 1024 < 50;
+ if (!isLt150M) {
+ // this.props.showNotification(`文件大小必须小于50MB`);
+ notification.open(
+ {
+ message: '提示',
+ description:
+ '文件大小必须小于50MB',
+
+ }
+ )
+ }
+ if(this.state.file !== undefined){
+ console.log("763")
+ this.setState({
+ file:file
+ })
+ }else {
+ this.setState({
+ file:file
+ })
+ }
+
+ console.log("handleChange2");
+ return isLt150M;
+ },
+ }
+ const dateFormat = 'YYYY-MM-DD HH:mm:ss';
+ let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
+
+ return (
+
+
+ 实训详情
+ 配置
+
+
+
+
+
+
+
+
实训名称
+
+
+
*
+
+
+ {settingsData === undefined ? "" :
+ }
+
+
+ 必填项
+
+
+
+
+
+
+
+
+
+
+
+
+
+
技术平台
+
+
+
+
*
+
+
+
+ 列表中没有?
+ 申请新建
+
+
+
+
+
+
+
+
+
{this.state.languagewritetype===true?"请填写该镜像语言":""}
+
+
+
+
+
{this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}
+
+
+
+
+
+
{this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}
+
+
+
+
+
+ 上传附件
+ (单个文件50M以内)
+
+
+
+
+ {this.state.attachmentidstype===true?"请上传附件":""}
+
+
+ this.sendhideModaly()}
+ >取消
+
+
+
+
+
+
+
+
+
+
+
+
+
新建申请已提交,请等待管理员的审核
+
我们将在1-2个工作日内与您联系
+
+
+
+
+
+
+
+
+
+
+
+ 必填项
+
+ {/*
请在配置页面完成后续的评测脚本设置操作
*/}
+
+
+
+ {/*
*/}
+ {/*
*/}
+
+
评测脚本
+
+
+
+
+
原有脚本将被新的脚本覆盖,无法撤销
+
是否确认执行覆盖操作
+
+
+
+
+
+
+
+
+
+
+ {
+ this.props.identity<5||this.props.power==true?
+
使用自定义脚本 : ""
+ }
+
+
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)}>知道了
+
+
+
+
+
+
+
+
+
+ 执行命令不能为空
+
+
+
+
+
+
+
+
+
+
+
+
+
+
*
+
+
+
+
+ {/**/}
+
+
+
+
+ {/*
*/}
+ {/*{evaluate_script===undefined?"":evaluate_script}*/}
+
+ {/*
*/}
+
+
+
+
+
+
+
+
+
+ {/*
*/}
+ {/*
**/}
+
+ {/*
程序最大执行时间
*/}
+
+ {/*
秒*/}
+
+ {/*
*/}
+ {/*必填项*/}
+ {/*
*/}
+ {/*
*/}
+
+ {/*
+
*
+
+
Pod存活时间
+
+
秒
+
+
+ 必填项
+
+
*/}
+
+
+
+
命令行
+
+ 无命令行窗口 (选中则不给学员的实践任务提供命令窗口)
+ 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口)
+ 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口)
+
+ 多个命令行窗口(选中则允许学员同时开启多个命令行窗口)
+
+
+
+
+
+
公开程度
+
+ 对所有公开 (选中则所有已被试用授权的用户可以学习)
+ 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习)
+
+
+
+
+
+
+
+
+ {/*{*/}
+ {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/}
+ {/*return(*/}
+ {/*
*/}
+ {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/}
+ {/*value={item}*/}
+ {/*/>*/}
+ {/*
*/}
+
+ {/*)*/}
+ {/*})*/}
+ {/*}*/}
+
+
+
+ 请选择需要公开的单位
+
+
+
+
+
+
+
发布信息
+
+
+
*
+
面向学员:
+
+
+
+
+
实训难易度定位,不限定用户群体
+
+ 必填项
+
+
+
+
+ 复制:
+
+
+
+
+
+
+
+ 跳关:
+
+
+
+
+
+
+ 测试集解锁:
+
+
+
+
+
+
+ {!code_hidden && !hide_code &&
+ 代码开放修改:
+
+
+
+
+
}
+
+
+ 隐藏代码窗口:
+
+
+
+
+
+
+
+ 代码目录隐藏:
+
+
+
+
+
+
+ { (vnc || webssh == 2) &&
+ 私密版本库:
+
+
+
+
+
}
+
+
+ 禁用复制粘贴:
+
+
+
+
+
+
+
+ 开启时间:
+
+
+
+
+
+
+ {this.props.identity<3?
+ VNC图形化:
+
+
+
+
+
:""}
+ {this.props.identity<3 && vnc ?
+ VNC图形化评测:
+
+
+
+
+
:""}
+
+
+
+
+
+ {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="请输入类别名称" />
+
+
+
+
+
+
+ this.setConfigsInputs(e,key,2)}
+ 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="请输入类别名称" />
+
+
+
+
+
+
+ )
+
+ })}
+
:""}
+
+
+ {
+ // this.props.identity<4&&this.props.status==0?
+ this.props.identity<5?
+
:""
+ }
+
+
+
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
index 11b88a037..22326e9e7 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
@@ -344,7 +344,7 @@ export default class TPMMDEditor extends Component {