|
|
|
@ -25,9 +25,9 @@ import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
import TPMMDEditor from "../challengesnew/TPMMDEditor";
|
|
|
|
|
|
|
|
|
|
import Bottomsubmit from "../../modals/Bottomsubmit";
|
|
|
|
|
|
|
|
|
|
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
|
|
|
|
|
import {TPMIndexHOC} from "../TPMIndexHOC";
|
|
|
|
|
import {getUploadActionUrl} from 'educoder';
|
|
|
|
|
|
|
|
|
|
import './css/TPMsettings.css';
|
|
|
|
|
|
|
|
|
@ -43,10 +43,35 @@ class Shixuninformation extends Component {
|
|
|
|
|
NAME_COUNT: 60,
|
|
|
|
|
shixunmemoMDvalue: "",
|
|
|
|
|
language: "java",
|
|
|
|
|
testscripttiptype:false
|
|
|
|
|
testscripttiptype:false,
|
|
|
|
|
shixunName:'',
|
|
|
|
|
trainee:undefined,
|
|
|
|
|
choice_small_type:[]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
if(prevProps.data!=this.props.data){
|
|
|
|
|
console.log(this.props.data)
|
|
|
|
|
if(this.props.data){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunName:this.props.data.shixun.name,
|
|
|
|
|
trainee:this.props.data.shixun.trainee,
|
|
|
|
|
choice_main_type:this.props.data.shixun.choice_main_type,
|
|
|
|
|
choice_small_type:this.props.data.shixun.choice_small_type
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
name:this.props.data.shixun.name,
|
|
|
|
|
})
|
|
|
|
|
this.contentMdRef.current.setValue(this.props.data.shixun.description);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getshixunmemoMDvalue = (value, e) => {
|
|
|
|
|
|
|
|
|
@ -194,12 +219,104 @@ class Shixuninformation extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bigClass = (value) => {
|
|
|
|
|
let list=[]
|
|
|
|
|
list.push(this.props.data.shixun.choice_main_type)
|
|
|
|
|
this.props.data.shixun.choice_small_type.map((item,key)=>{
|
|
|
|
|
list.push(item)
|
|
|
|
|
})
|
|
|
|
|
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
|
|
|
|
|
let newshixun_service_configsagin=[];
|
|
|
|
|
newshixun_service_configs.map((item,key)=>{
|
|
|
|
|
list.map((its,index)=>{
|
|
|
|
|
if(item.mirror_repository_id===its){
|
|
|
|
|
newshixun_service_configsagin.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.props.data.shixun.main_type.some((item,key)=> {
|
|
|
|
|
if (item.id === value) {
|
|
|
|
|
newshixun_service_configsagin[0]={
|
|
|
|
|
mirror_repository_id:value,
|
|
|
|
|
name:item.type_name,
|
|
|
|
|
cpu_limit:1,
|
|
|
|
|
lower_cpu_limit:0.1,
|
|
|
|
|
memory_limit:1024,
|
|
|
|
|
request_limit:10
|
|
|
|
|
}
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
|
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
// console.log(response.data)
|
|
|
|
|
this.setState({
|
|
|
|
|
choice_main_type: value,
|
|
|
|
|
standard_scripts:response.data,
|
|
|
|
|
choice_standard_scripts:null,
|
|
|
|
|
shixun_service_configs:newshixun_service_configsagin,
|
|
|
|
|
shixun_service_configlist:newshixun_service_configsagin,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
littleClass = (value) => {
|
|
|
|
|
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
|
|
|
|
|
let newchoice_small_type=this.props.data.shixun.choice_small_type;
|
|
|
|
|
let list=[]
|
|
|
|
|
list.push(this.props.data.shixun.choice_main_type)
|
|
|
|
|
newchoice_small_type.map((item,key)=>{
|
|
|
|
|
list.push(item)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let newshixun_service_configsagin=[]
|
|
|
|
|
|
|
|
|
|
newshixun_service_configs.map((item,key)=>{
|
|
|
|
|
list.map((its,index)=>{
|
|
|
|
|
if(item.mirror_repository_id===its){
|
|
|
|
|
newshixun_service_configsagin.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.props.data.shixun.small_type.some((items,keys)=> {
|
|
|
|
|
if (items.id === value) {
|
|
|
|
|
newshixun_service_configsagin.push({
|
|
|
|
|
mirror_repository_id:value,
|
|
|
|
|
name:items.type_name,
|
|
|
|
|
cpu_limit:1,
|
|
|
|
|
lower_cpu_limit:0.1,
|
|
|
|
|
memory_limit:1024,
|
|
|
|
|
request_limit:10
|
|
|
|
|
})
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
newchoice_small_type.push(value)
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
choice_small_type: newchoice_small_type,
|
|
|
|
|
shixun_service_configs:newshixun_service_configsagin,
|
|
|
|
|
shixun_service_configlist:newshixun_service_configsagin,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
console.log(this.props.data)
|
|
|
|
|
|
|
|
|
|
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
|
|
|
|
|
console.log(operateauthority)
|
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state;
|
|
|
|
|
const {shixun_service_configs}=this.props;
|
|
|
|
|
let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.state.status == 0 ? true : false;
|
|
|
|
|
const uploadProps = {
|
|
|
|
|
width: 600,
|
|
|
|
|
fileList,
|
|
|
|
@ -246,6 +363,7 @@ class Shixuninformation extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Form>
|
|
|
|
@ -289,13 +407,14 @@ class Shixuninformation extends Component {
|
|
|
|
|
style={{"borderBottom": 'none'}}
|
|
|
|
|
className="chooseDes pr"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('select', {
|
|
|
|
|
{getFieldDecorator('trainee', {
|
|
|
|
|
rules: [{required: true, message: '请选择难易度'}],
|
|
|
|
|
})(
|
|
|
|
|
<div className="with15 fl pr">
|
|
|
|
|
<Select placeholder="请选择难易度"
|
|
|
|
|
style={{width: 180}}
|
|
|
|
|
onChange={this.Selectthestudent}
|
|
|
|
|
value={this.state.trainee}
|
|
|
|
|
>
|
|
|
|
|
<Option value={1}>初级</Option>
|
|
|
|
|
<Option value={2}>中级</Option>
|
|
|
|
@ -319,16 +438,9 @@ class Shixuninformation extends Component {
|
|
|
|
|
rules: [{required: true, message: '请选择主类别'}],
|
|
|
|
|
})(
|
|
|
|
|
<div className="width100 fl mr20">
|
|
|
|
|
|
|
|
|
|
<Select placeholder="请选择主类别" value={this.props.choice_main_type === "" ? undefined : this.props.choice_main_type}
|
|
|
|
|
<Select placeholder="请选择主类别" value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type}
|
|
|
|
|
style={{width: 180}}
|
|
|
|
|
onChange={this.props.operateauthority?this.bigClass:""}
|
|
|
|
|
// onMouseEnter={this.bigopen}
|
|
|
|
|
// onMouseLeave={this.bigopens}
|
|
|
|
|
// disabled={this.props.operateauthority?false:true}
|
|
|
|
|
// onMouseEnter={operateauthority?this.bigopen:""}
|
|
|
|
|
onSelect={this.props.operateauthority?this.bigopens:""}
|
|
|
|
|
// open={opers}
|
|
|
|
|
onChange={operateauthority?this.bigClass:""}
|
|
|
|
|
optionFilterProp="children"
|
|
|
|
|
filterOption={(input, option) =>
|
|
|
|
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
@ -364,16 +476,19 @@ class Shixuninformation extends Component {
|
|
|
|
|
})(
|
|
|
|
|
<div className=" fl pr mr20">
|
|
|
|
|
<Select placeholder="请选择小类别"
|
|
|
|
|
style={{width: 180}}
|
|
|
|
|
onChange={this.selectright}
|
|
|
|
|
value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type}
|
|
|
|
|
style={{width: 180,height:30}}
|
|
|
|
|
disabled={operateauthority?false:true}
|
|
|
|
|
onDeselect={operateauthority?this.Deselectlittle:""}
|
|
|
|
|
onSelect={operateauthority?this.littleClass:""}
|
|
|
|
|
defaultOpen={false}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => {
|
|
|
|
|
return (
|
|
|
|
|
this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => {
|
|
|
|
|
return(
|
|
|
|
|
<Option value={item.id} key={key}>
|
|
|
|
|
<Tooltip placement="right"
|
|
|
|
|
title={item.description === "" ? "无描述" : item.description}>
|
|
|
|
|
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
|
|
|
|
|
{item.type_name}
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</Option>
|
|
|
|
@ -408,7 +523,7 @@ class Shixuninformation extends Component {
|
|
|
|
|
style={{"borderBottom": 'none'}}
|
|
|
|
|
className="chooseDes pr"
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('select', {
|
|
|
|
|
{getFieldDecorator('select123', {
|
|
|
|
|
rules: [{required: true, message: '请选择评测脚本'}],
|
|
|
|
|
})(
|
|
|
|
|
<div className="with15 fl pr">
|
|
|
|
@ -638,7 +753,7 @@ class Shixuninformation extends Component {
|
|
|
|
|
{/*</Form>*/}
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Bottomsubmit url={`/shixuns/${this.props.match.params.shixunId}/challenges`} onSubmits={ this.sendsure_apply}/>
|
|
|
|
|
<Modal
|
|
|
|
|
keyboard={false}
|
|
|
|
|
title="提示"
|
|
|
|
|