+
+
+ 普通实训
+ 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/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index b660001c6..d025443cf 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -55,8 +55,9 @@ class TPMBanner extends Component {
isIE:false,
Forkvisibletype: false,
isSpin:false,
- Senttothevcaluetype:false
- }
+ Senttothevcaluetype:false,
+ jupyterbool:false,
+ }
}
// star_info:[0, 0, 0, 0, 0, 0],
@@ -656,7 +657,7 @@ class TPMBanner extends Component {
{/*{shixunsDetails.experience}*/}
{/**/}
- 难度系数
+ 难度级别
{shixunsDetails.diffcult}
diff --git a/public/react/src/modules/tpm/TPMChallenge.js b/public/react/src/modules/tpm/TPMChallenge.js
index 847e8b965..630a233fd 100644
--- a/public/react/src/modules/tpm/TPMChallenge.js
+++ b/public/react/src/modules/tpm/TPMChallenge.js
@@ -1,54 +1,61 @@
-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
+ } = this.props;
+ return (
+
+
+
+
+
+ {
+ jupyterbool===true?
+
+ :
+ }
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default TPMChallenge;
diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js
new file mode 100644
index 000000000..909883317
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMDataset.js
@@ -0,0 +1,531 @@
+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 {getUploadActionUrl} from 'educoder';
+import moment from 'moment';
+
+const confirm = Modal.confirm;
+
+class TPMDataset extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ datas: [0, 1, 2, 3, 4, 5],
+ value: undefined,
+ columns: [
+ {
+ title: '文件',
+ dataIndex: 'number',
+ key: 'number',
+ align: 'left',
+ className: " font-14 wenjiantit",
+ width: '200px',
+ render: (text, record) => (
+
+ {record.title}
+
+ )
+ },
+ {
+ title: '最后修改时间',
+ dataIndex: 'number',
+ key: 'number',
+ align: 'center',
+ className: "edu-txt-center font-14 zuihoushijian",
+ width: '150px',
+ render: (text, record) => (
+
+ {record.timedata}
+
+ )
+ },
+ {
+ title: '最后修改人',
+ dataIndex: 'number',
+ key: 'number',
+ align: 'center',
+ className: "edu-txt-center font-14 ",
+ render: (text, record) => (
+
+ {record.author}
+
+ )
+ },
+ {
+ title: '文件大小',
+ dataIndex: 'number',
+ key: 'number',
+ align: 'center',
+ className: "edu-txt-center font-14 ",
+ render: (text, record) => (
+
+ {record.filesize}
+
+ )
+ },
+ ],
+ page: 1,
+ limit: 10,
+ selectedRowKeys: [],
+ mylistansum:30,
+ collaboratorList:[],
+ fileList:[],
+ file:null,
+ datalist:[],
+ data_sets_count:0,
+ selectedRowKeysdata:[],
+ }
+ }
+
+ componentDidMount() {
+ 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}/jupyter_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{
+ 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{
+ console.log(error)
+ });
+
+ }
+
+ showModal = (id, status) => {
+
+ };
+
+ handleOk = (id, editid) => {
+
+ };
+
+ handleCancel = (e) => {
+
+ };
+ paginationonChanges = (pageNumber) => {
+ // //console.log('Page: ');
+ this.setState({
+ page: pageNumber,
+ })
+ 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;
+ }
+
+ // 附件相关 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
+ });
+ this.getdatas();
+ // }
+ }
+ }
+ }
+
+ 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;
+ }
+
+ }
+
+ deleteRemovedata(){
+ debugger
+ console.log("删除");
+ console.log(this.state.selectedRowKeysdata);
+ const url = `/attachments/destroy_files.json`;
+ axios.delete(url, {
+ 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);
+ });
+ }
+ 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);
+ });
+ }
+
+
+
+ render() {
+ const {tpmLoading, shixun, user, match} = this.props;
+ const {columns, datas, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count} = 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,
+ data:{
+ attachtype: 2,
+ container_id:this.props.match.params.shixunId,
+ container_type: "Shixun",
+ },
+ 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;
+ },
+ }
+ return (
+
+
+
+
+
+
+
+
+
+
+ { data_sets_count>0?
+ 全选:""}
+
+
+
+
+ {
+ 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/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..9c82e987d 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -27,7 +27,7 @@ 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'
const $ = window.$
@@ -142,6 +142,7 @@ class TPMIndex extends Component {
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
+ tpmindexjupyterbool:false,
}
}
@@ -192,7 +193,7 @@ class TPMIndex extends Component {
propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status,
secret_repository: response.data.secret_repository,
-
+
});
}
}).catch((error) => {
@@ -259,8 +260,8 @@ class TPMIndex extends Component {
axios.interceptors.request.eject(this.tpmContentResponseInterceptor);
this.tpmContentResponseInterceptor = null;
}
-
-
+
+
setLoadingContent = (isLoadingContent) => {
this.setState({ loadingContent: isLoadingContent })
}
@@ -270,20 +271,29 @@ class TPMIndex extends Component {
// }
render() {
+
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
return (
+ {/*头部*/}
{
- !flag &&
+ !flag &&
}
-
+ {/*筛选*/}
+ {/*{*/}
+ {/* tpmindexjupyterbool===false?*/}
+
+ {/* :""*/}
+ {/*}*/}
+ {/* */}
+
-
+
()
@@ -294,7 +304,7 @@ class TPMIndex extends Component {
}>
( ()
}>
@@ -311,7 +321,7 @@ class TPMIndex extends Component {
(props) => ()
}>
-
+
{/* */}
)
}>
-
+
{/* */}
@@ -342,12 +352,17 @@ class TPMIndex extends Component {
(props) => ()
}>
-
+ {/*实训项目条目塞选*/}
()
}>
+ ()
+ }>
+
()
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/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
new file mode 100644
index 000000000..a0ac8146e
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -0,0 +1,131 @@
+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 default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+ let {can_copy}=this.state;
+ let options;
+
+ if (this.props.departmentslist != undefined) {
+ options = this.props.departmentslist.map((d, k) => {
+ return (
+
+ )
+ })
+ }
+ return (
+
+
+ 复制:
+
+
+
+
+
+
+
+
公开程度
+
+ 对所有公开 (选中则所有已被试用授权的用户可以学习)
+ 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习)
+
+
+
+
+
+
+
+
+
+ 请选择需要公开的单位
+
+
+
+
+
+ );
+ }
+}
+
+
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..393e0659c
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
@@ -0,0 +1,33 @@
+import React, { Component } from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
+
+import axios from 'axios';
+
+import './css/TPMsettings.css';
+
+import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+
+
+
+export default class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+
+ render() {
+
+ return (
+
+ 1111
+
+ );
+ }
+}
+
+
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..eb7dba596
--- /dev/null
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -0,0 +1,484 @@
+import React, {Component} from 'react';
+
+import MonacoEditor from 'react-monaco-editor';
+
+import {
+ Input,
+ Select,
+ Radio,
+ Checkbox,
+ Popconfirm,
+ message,
+ Modal,
+ Icon,
+ DatePicker,
+ Breadcrumb,
+ Upload,
+ Button,
+ notification,
+ Tooltip,
+ Tabs,
+ Form
+} from 'antd';
+
+import axios from 'axios';
+
+import TPMMDEditor from "../challengesnew/TPMMDEditor";
+
+
+import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
+import {TPMIndexHOC} from "../TPMIndexHOC";
+
+import './css/TPMsettings.css';
+
+import '../newshixuns/css/Newshixuns.css';
+
+
+class Shixuninformation extends Component {
+ constructor(props) {
+ super(props)
+ this.contentMdRef = React.createRef();
+ this.state = {
+ NAME_COUNT: 60,
+ shixunmemoMDvalue: "",
+ language: "java",
+ }
+ }
+
+
+ getshixunmemoMDvalue = (value, e) => {
+
+ this.setState({
+ shixunmemoMDvalue: value
+ })
+ }
+
+
+ render() {
+ console.log(this.props.data)
+ const {getFieldDecorator} = this.props.form;
+ const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state;
+ const {shixun_service_configs}=this.props;
+ let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
+ const uploadProps = {
+ width: 600,
+ fileList,
+ 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;
+ },
+ }
+
+ return (
+
+
+ {getFieldDecorator('name', {
+ rules: [{
+ required: true, message: '请输入选题名称',
+ }, {
+ max: 60, message: '请输入名称,最大限制60个字符',
+ }, {
+ whitespace: true, message: '请勿输入空格'
+ }],
+ })(
+
+ )}
+
+
+
+
+
+
+
+
+ {getFieldDecorator('select', {
+ rules: [{required: true, message: '请选择难易度'}],
+ })(
+
+
+
+
+ )}
+ (实训的难易程度)
+
+
+
+
+
+ {getFieldDecorator('selectleft', {
+ rules: [{required: true, message: '请选择主类别'}],
+ })(
+
+
+
+
+
+ )}
+
+
+
+
+
+
+ {getFieldDecorator('selectright', {
+ rules: [{required: true, message: '请选择小类别'}],
+ })(
+
+
+
+ )}
+
+
+
+ 已安装软件:hadoop3.1.0、jdk1.8;
+
+
+ 说明:添加了hadoop3.1.0、jdk1.8的源码包,添加了hadoop3.1.0、jdk1.8的源码包
+
+
+
+
+
+
+
+
+
+
+
+ {getFieldDecorator('select', {
+ rules: [{required: true, message: '请选择评测脚本'}],
+ })(
+
+
+
+
+ )}
+
+ 使用自定义脚本
+
+
+
+
+
+
+
+
+
+
+
私密版本库:
+ (若需要对学员隐藏部分版本库内容时,请选中;选中即启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)
+
+
+ {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="请输入类别名称" />
+
+
+
+
+
+
+ )
+
+ })}
+
:""}
+
+
+ {postapplyvisible === true ? : ""}
+
+
+
+
+
+
+
+
{this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
+
+
+
+
+
{this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
+
+
+
+
+
+
{this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
+
+
+
+
+
+ 上传附件
+ (单个文件50M以内)
+
+
+
+
+
+
+ {this.state.attachmentidstype === true ? "请上传附件" : ""}
+
+
+ this.sendhideModaly()}
+ >取消
+
+
+
+
+ {/**/}
+
+
+
+
+
+
新建申请已提交,请等待管理员的审核
+
我们将在1-2个工作日内与您联系
+
+
+
+
+
+
+
+ );
+ }
+}
+
+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..4540b5e60 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -1,13 +1,17 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
-import MonacoEditor from 'react-monaco-editor';
+import {
+ Button,
+ Tabs
+} from 'antd';
-//MonacoDiffEditor 对比模式
-import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip} from 'antd';
+import TopShixuninformation from './Shixuninformation';
-// import "antd/dist/antd.css";
+import Configuration from './Configuration';
-import locale from 'antd/lib/date-picker/locale/zh_CN';
+import LearningSettings from './LearningSettings';
+
+import Bottomsubmit from "../../modals/Bottomsubmit";
import moment from 'moment';
@@ -15,385 +19,45 @@ import axios from 'axios';
import './css/TPMsettings.css';
-import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
-
-let origin = getUrl();
-
-let path = getUrl("/editormd/lib/")
+import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
-const $ = window.$;
-let timeout;
+const {TabPane} = Tabs;
-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 id = this.props.match.params.shixunId;
- let Url=`/shixuns/`+id+`/settings.json`;
+ let Url = `/shixuns/` + id + `/settings.json`;
- axios.get(Url).then((response)=> {
+ 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){
+ if (response.status === 200) {
+ this.setState({
+ data:response.data
+ })
+ if (response.data.shixun.multi_webssh === true) {
this.setState({
- SelectTheCommandtype:true
+ SelectTheCommandtype: true
})
- }else{
+ } else {
this.setState({
- SelectTheCommandtype:false
+ SelectTheCommandtype: false
})
}
if (response.data.shixun.scope_partment.length > 0) {
@@ -401,24 +65,6 @@ export default class TPMsettings extends Component {
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("这个实训已关闭不能修改!");
- // }
}
});
@@ -427,2009 +73,60 @@ export default class TPMsettings extends Component {
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";
+ if (response.data.message === undefined) {
+ this.setState({
+ departmentslist: response.data.shools_name
+ });
}
}
-
- }).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;
+ render() {
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/TPMsettings/css/TPMsettings.css b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
index 8047bbde8..a15f7bcf0 100644
--- a/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
+++ b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css
@@ -111,3 +111,18 @@ 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;
+}
\ 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..7b05980e0
--- /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 = '您上次有已保存的数据,是否