chromesetting
杨树明 5 years ago
parent a05c6f2c32
commit ea4b70d835

@ -52,7 +52,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080" //proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net" proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net" proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net/" proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001" //proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

@ -10,7 +10,8 @@ class Bottomsubmit extends Component {
} }
cannelfun=()=>{ cannelfun=()=>{
window.location.href=this.props.url // window.location.href=
this.props.history.replace(this.props.url);
} }

@ -42,13 +42,16 @@ class Shixuninformation extends Component {
this.state = { this.state = {
NAME_COUNT: 60, NAME_COUNT: 60,
shixunmemoMDvalue: "", shixunmemoMDvalue: "",
language: "java", testscripttiptype: false,
testscripttiptype:false, shixunName: '',
shixunName:'', trainee: undefined,
trainee:undefined, choice_small_type: [],
choice_small_type:[], simichecked: false,
simichecked:false, Executivetyoe: false,
Executiveordervalue: "",
Compilecommandvalue: "",
shixun_service_configs: undefined,
fileList:[]
} }
} }
@ -57,20 +60,56 @@ class Shixuninformation extends Component {
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if(prevProps.data!=this.props.data){ if (prevProps.data != this.props.data) {
if(this.props.data){ if (this.props.data) {
this.setState({
shixunName: this.props.data.shixun.name,
trainee: this.props.data.shixun.trainee,
choice_main_type: this.props.data.shixun.choice_main_type,
choice_small_type: this.props.data.shixun.choice_small_type,
choice_standard_scripts: this.props.data.shixun.choice_standard_scripts,
shixunmemoMDvalue: this.props.data.shixun.evaluate_script,
simichecked: this.props.data.shixun.is_secret_repository,
shixun_service_configs: this.props.data.shixun.shixun_service_configs,
standard_scripts:this.props.data.shixun.standard_scripts,
})
if(this.props.data.shixun.choice_standard_scripts===null){
this.setState({
choice_standard_scripts:{id: this.props.data.shixun.standard_scripts[0].id, value: ""},
choice_standard_scriptssum:this.props.data.shixun.standard_scripts[0].id
})
this.props.form.setFieldsValue({
selectscripts:this.props.data.shixun.standard_scripts[0].id
})
this.get_mirror_script(this.props.data.shixun.standard_scripts[0].id)
}
let newlist = ""
this.props.data.shixun.choice_small_type.map((item, key) => {
this.props.data.shixun.small_type.map((i,k)=>{
if (item===i.id) {
newlist = newlist + `${i.description}`
}
})
})
this.setState({ this.setState({
shixunName:this.props.data.shixun.name, subvalues: newlist
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.data.shixun.main_type.map((item,key)=>{
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, if(item.id===this.props.data.shixun.choice_main_type){
shixunmemoMDvalue:this.props.data.shixun.evaluate_script, this.setState({
simichecked:this.props.data.shixun.is_secret_repository, mainvalues:item.description,
})
}
}) })
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
name:this.props.data.shixun.name, name: this.props.data.shixun.name,
trainee: this.props.data.shixun.trainee,
selectleft: this.props.data.shixun.choice_main_type,
selectright:this.props.data.shixun.choice_small_type,
}) })
this.contentMdRef.current.setValue(this.props.data.shixun.description); this.contentMdRef.current.setValue(this.props.data.shixun.description);
} }
@ -84,14 +123,14 @@ class Shixuninformation extends Component {
}) })
} }
testscripttip=(val)=>{ testscripttip = (val) => {
if(val===0){ if (val === 0) {
this.setState({ this.setState({
testscripttiptype:true testscripttiptype: true
}) })
}else if(val===1){ } else if (val === 1) {
this.setState({ this.setState({
testscripttiptype:false testscripttiptype: false
}) })
} }
} }
@ -223,82 +262,244 @@ class Shixuninformation extends Component {
} }
bigClass = (value) => { setlanguage = (e) => {
let list=[] 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.props.data.shixun.choice_main_type) list.push(this.props.data.shixun.choice_main_type)
this.props.data.shixun.choice_small_type.map((item,key)=>{ this.props.data.shixun.choice_small_type.map((item, key) => {
list.push(item) list.push(item)
}) })
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs; let newshixun_service_configs = this.props.data.shixun.shixun_service_configs;
let newshixun_service_configsagin=[]; let newshixun_service_configsagin = [];
newshixun_service_configs.map((item,key)=>{ newshixun_service_configs.map((item, key) => {
list.map((its,index)=>{ list.map((its, index) => {
if(item.mirror_repository_id===its){ if (item.mirror_repository_id === its) {
newshixun_service_configsagin.push(item) newshixun_service_configsagin.push(item)
} }
}) })
}) })
this.props.data.shixun.main_type.some((item,key)=> { this.props.data.shixun.main_type.some((item, key) => {
if (item.id === value) { if (item.id === value) {
newshixun_service_configsagin[0]={ newshixun_service_configsagin[0] = {
mirror_repository_id:value, mirror_repository_id: value,
name:item.type_name, name: item.type_name,
cpu_limit:1, cpu_limit: 1,
lower_cpu_limit:0.1, lower_cpu_limit: 0.1,
memory_limit:1024, memory_limit: 1024,
request_limit:10 request_limit: 10
} }
return true return true
} }
} }
) )
let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
this.props.form.setFieldsValue({
selectleft: value,
})
let url = `/shixuns/get_mirror_script.json?mirror_id=` + value;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if (response.status === 200) { if (response.status === 200) {
// console.log(response.data) console.log(response.data[0].id)
this.get_mirror_script(response.data[0].id)
this.setState({ this.setState({
choice_main_type: value, choice_main_type: value,
standard_scripts:response.data, standard_scripts: response.data,
choice_standard_scripts:null, shixun_service_configs: newshixun_service_configsagin,
shixun_service_configs:newshixun_service_configsagin, shixun_service_configlist: newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin, })
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
}) })
} }
}).catch((error) => { }).catch((error) => {
console.log(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
}
}
)
littleClass = (value) => { this.setState({
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs; choice_small_type: newchoice_small_type,
let newchoice_small_type=this.props.data.shixun.choice_small_type; shixun_service_configs: newshixun_service_configs,
let list=[] 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.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) list.push(this.props.data.shixun.choice_main_type)
newchoice_small_type.map((item,key)=>{ newchoice_small_type.map((item, key) => {
list.push(item) list.push(item)
}) })
let newshixun_service_configsagin=[] let newshixun_service_configsagin = []
newshixun_service_configs.map((item,key)=>{ newshixun_service_configs.map((item, key) => {
list.map((its,index)=>{ list.map((its, index) => {
if(item.mirror_repository_id===its){ if (item.mirror_repository_id === its) {
newshixun_service_configsagin.push(item) newshixun_service_configsagin.push(item)
} }
}) })
}) })
this.props.data.shixun.small_type.some((items,keys)=> { this.props.data.shixun.small_type.some((items, keys) => {
if (items.id === value) { if (items.id === value) {
newshixun_service_configsagin.push({ newshixun_service_configsagin.push({
mirror_repository_id:value, mirror_repository_id: value,
name:items.type_name, name: items.type_name,
cpu_limit:1, cpu_limit: 1,
lower_cpu_limit:0.1, lower_cpu_limit: 0.1,
memory_limit:1024, memory_limit: 1024,
request_limit:10 request_limit: 10
}) })
return true return true
} }
@ -309,38 +510,44 @@ class Shixuninformation extends Component {
this.setState({ this.setState({
choice_small_type: newchoice_small_type, choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configsagin, shixun_service_configs: newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin, shixun_service_configlist: newshixun_service_configsagin,
}) })
} }
SelectScput = (value, e) => { SelectScput = (value, e) => {
this.setState({ this.setState({
choice_standard_scriptssum: value, choice_standard_scriptssum: value,
language:e.props.name, language: e.props.name,
choice_standard_scripts: {id:e.props.value,value:""}, choice_standard_scripts: {id: e.props.value, value: ""},
standard_scriptsModal:true standard_scriptsModal: true
}) })
} }
hidestandard_scriptsModal=()=>{ hidestandard_scriptsModal = () => {
this.setState({ this.setState({
standard_scriptsModal:false, standard_scriptsModal: false,
standard_scriptsModals:false standard_scriptsModals: false
}) })
} }
get_mirror_script=()=>{ get_mirror_script = (ids) => {
let {choice_standard_scriptssum}=this.state; let {choice_standard_scriptssum} = this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum; let url = `/shixuns/${id}/get_script_contents.json`;
axios.get(pul).then((response) => { axios.get((url),{params:{
if(response.status===200){ script_id:ids?ids:choice_standard_scriptssum
}}).then((response) => {
if (response.status === 200) {
// this.evaluate_scriptMD(response.data.content, "shixunmemoMD"); // this.evaluate_scriptMD(response.data.content, "shixunmemoMD");
if(ids==undefined){
this.setState({
standard_scriptsModal: false,
standard_scriptsModals: true,
})
}
this.setState({ this.setState({
standard_scriptsModal:false, shixunmemoMDvalue: response.data.content
standard_scriptsModals:true,
shixunmemoMDvalue:response.data.content
}) })
} }
@ -349,22 +556,143 @@ class Shixuninformation extends Component {
}) })
} }
simionChange=(e)=>{ 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({ this.setState({
simichecked:e.target.checked 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=()=>{
const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet)
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
console.log('Received values of form: ', values);
// let Url = `/shixuns.json`;
// axios.post(Url, {
// description: mdContnet,
// main_type: values.main_type,
// sub_type: values.sub_type,
// shixun: {
// name: values.name,
// trainee: values.select,
// is_jupyter: values.is_jupyter === "2" ? true : false,
// }
// }
// ).then((response) => {
// if (response.status === 200) {
// window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
// } else {
// this.setState({
// bottonloading: false
// })
// }
// }).catch((error) => {
// console.log(error)
// this.setState({
// bottonloading: false
// })
// })
}
});
}
render() { render() {
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.props.data.shixun.status == 0 ? true : false;
// console.log(operateauthority) // console.log(operateauthority)
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; const { fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
// console.log("1222") // console.log("1222")
// console.log(choice_standard_scripts) // console.log(choice_standard_scripts)
const {shixun_service_configs}=this.props;
const uploadProps = { const uploadProps = {
width: 600, width: 600,
fileList, fileList,
@ -394,7 +722,6 @@ class Shixuninformation extends Component {
) )
} }
if (this.state.file !== undefined) { if (this.state.file !== undefined) {
console.log("763")
this.setState({ this.setState({
file: file file: file
}) })
@ -403,15 +730,10 @@ class Shixuninformation extends Component {
file: file file: file
}) })
} }
console.log("handleChange2");
return isLt150M; return isLt150M;
}, },
} }
return ( return (
<div> <div>
<div className="educontent mb50 edu-back-white padding10-20"> <div className="educontent mb50 edu-back-white padding10-20">
@ -487,9 +809,10 @@ class Shixuninformation extends Component {
rules: [{required: true, message: '请选择主类别'}], rules: [{required: true, message: '请选择主类别'}],
})( })(
<div className="width100 fl mr20"> <div className="width100 fl mr20">
<Select placeholder="请选择主类别" value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type} <Select placeholder="请选择主类别"
value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type}
style={{width: 180}} style={{width: 180}}
onChange={operateauthority?this.bigClass:""} onChange={operateauthority ? this.bigClass : ""}
optionFilterProp="children" optionFilterProp="children"
filterOption={(input, option) => filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
@ -499,8 +822,8 @@ class Shixuninformation extends Component {
{ {
this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => { this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => {
return ( return (
<Option value={item.id} key={key} > <Option value={item.id} key={key} name={item.description}>
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} > <Tooltip placement="right" title={item.description === "" ? "无描述" : item.description}>
{item.type_name} {item.type_name}
</Tooltip> </Tooltip>
</Option> </Option>
@ -516,29 +839,29 @@ class Shixuninformation extends Component {
<Form.Item <Form.Item
style={{"borderBottom": 'none', 'width': '61%', 'float': 'left', 'marginTop': '40px'}} style={{"borderBottom": 'none', 'width': '81%', 'float': 'left', 'marginTop': '40px'}}
className="chooseDes pr" className="chooseDes pr"
> >
<div className=" fl pr mr20"> <div className=" fl pr mr20">
{getFieldDecorator('selectright', { {getFieldDecorator('selectright', {
rules: [{required: true, message: '请选择小类别'}], rules: [{required: false, message: '请选择小类别'}],
})( })(
<div className=" fl pr mr20"> <div className=" fl pr mr20">
<Select placeholder="请选择小类别" <Select placeholder="请选择小类别"
mode="multiple" mode="multiple"
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}
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: 200}}
style={{width: 180,height:30}} disabled={operateauthority ? false : true}
disabled={operateauthority?false:true} onDeselect={operateauthority ? this.Deselectlittle : ""}
onDeselect={operateauthority?this.Deselectlittle:""} onSelect={operateauthority ? this.littleClass : ""}
onSelect={operateauthority?this.littleClass:""} onChange={this.showlittleClass}
defaultOpen={false} defaultOpen={false}
> >
{ {
this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => { this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => {
return( return (
<Option value={item.id} key={key}> <Option value={item.id} key={key} name={item.description}>
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} > <Tooltip placement="right" title={item.description === "" ? "无描述" : item.description}>
{item.type_name} {item.type_name}
</Tooltip> </Tooltip>
</Option> </Option>
@ -549,15 +872,16 @@ class Shixuninformation extends Component {
</div> </div>
)} )}
<span className="fl ml20 color-grey lineh-20"> <span className="fl ml20 color-grey lineh-20">
<div> <div>
<div className={"font-12"}> {this.state.mainvalues === undefined && this.state.subvalues === undefined || this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
已安装软件hadoop3.1.0jdk1.8 <div className={"font-12"} style={{'max-width': '600px'}}>
</div> {`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : `已安装软件:` + this.state.mainvalues}`}
<div className={"font-12"}> {`${this.state.subvalues === undefined || this.state.subvalues === "" ? "" : this.state.mainvalues === undefined || this.state.mainvalues === "" ? `已安装软件:` + this.state.subvalues : this.state.subvalues}`}
说明添加了hadoop3.1.0jdk1.8的源码包添加了hadoop3.1.0jdk1.8的源码包 {`${this.state.mainvalues === undefined || this.state.mainvalues === "" ? "" : `说明:添加了` + this.state.mainvalues}${this.state.subvalues === undefined || this.state.subvalues === "" ? "" :
</div> this.state.mainvalues === undefined || this.state.mainvalues === "" ? `说明:添加了` + this.state.subvalues : this.state.subvalues}`}
</div> </div>}
</span> </div>
</span>
</div> </div>
</Form.Item> </Form.Item>
@ -573,18 +897,18 @@ class Shixuninformation extends Component {
style={{"borderBottom": 'none'}} style={{"borderBottom": 'none'}}
className="chooseDes pr" className="chooseDes pr"
> >
{getFieldDecorator('select123', { {getFieldDecorator('selectscripts', {
rules: [{required: true, message: '请选择评测脚本'}], rules: [{required: true, message: '请选择评测脚本'}],
})( })(
<div className="with15 fl pr"> <div className="with15 fl pr">
<Select placeholder="请选择选择脚本" <Select placeholder="请选择选择脚本"
style={{width: 180}} style={{width: 180}}
className="fl" className="fl"
disabled={operateauthority?false:true} disabled={operateauthority ? false : true}
value={choice_standard_scripts === undefined||choice_standard_scripts === null ? undefined :choice_standard_scripts.id===undefined?choice_standard_scripts:choice_standard_scripts.id} value={choice_standard_scripts === undefined || choice_standard_scripts === null ? undefined : choice_standard_scripts.id === undefined ? choice_standard_scripts : choice_standard_scripts.id}
onChange={operateauthority?this.SelectScput:""}> onChange={operateauthority ? this.SelectScput : ""}>
{ {
this.props.data === undefined ? "" : this.props.data.shixun.standard_scripts.map((item, key) => { this.state.standard_scripts=== undefined ? "" : this.state.standard_scripts.map((item, key) => {
return ( return (
<Option value={parseInt(item.id)} name={item.scptname} key={key}>{item.scptname}</Option> <Option value={parseInt(item.id)} name={item.scptname} key={key}>{item.scptname}</Option>
) )
@ -594,13 +918,19 @@ class Shixuninformation extends Component {
</Select> </Select>
</div> </div>
)} )}
<span className="fl ml20 color-blue"> <span className="fl ml20 color-blue" style={{'line-height': '30px'}}>
使用自定义脚本 <span onClick={() => this.showModal()}>使用自定义脚本</span>
<span className={"color-grey ml10"} onClick={()=>this.testscripttip(0)}> <span className={"color-grey ml10"} onClick={() => this.testscripttip(0)}>
<Icon type="exclamation-circle"/> <Icon type="exclamation-circle"/>
</span> </span>
<div className="invite-tip clearfix none " id="test_script_tip" <div className="invite-tip clearfix none " id="test_script_tip"
style={{top: '33px', left: '-15px',width: '450px',zIndex: '10',display: this.state.testscripttiptype===true?'block':"none"}}> style={{
top: '33px',
left: '-15px',
width: '450px',
zIndex: '10',
display: this.state.testscripttiptype === true ? 'block' : "none"
}}>
<style> <style>
{ {
` `
@ -634,7 +964,7 @@ class Shixuninformation extends Component {
</p> </p>
</div> </div>
<p className="inviteTipbtn with100 fl"> <p className="inviteTipbtn with100 fl">
<a onClick={()=>this.testscripttip(1)}>知道了</a> <a onClick={() => this.testscripttip(1)}>知道了</a>
</p> </p>
</div> </div>
</span> </span>
@ -649,7 +979,7 @@ class Shixuninformation extends Component {
<MonacoEditor <MonacoEditor
height="450" height="450"
width="1150" width="1150"
language={this.state.language} // language={this.state.language}
value={shixunmemoMDvalue} value={shixunmemoMDvalue}
options={{ options={{
selectOnLineNumbers: true selectOnLineNumbers: true
@ -663,15 +993,16 @@ class Shixuninformation extends Component {
</Form> </Form>
<span className="ant-form-text mt20" >私密版本库 <span className="ant-form-text mt20">私密版本库
<Checkbox onChange={this.simionChange} value={this.state.simichecked}>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox> <Checkbox onChange={this.simionChange}
value={this.state.simichecked}>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
</span> </span>
{this.props.identity<3?<div className="edu-back-white padding40-20 mb20"> {this.props.identity < 3 ? <div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">服务配置</p> <p className="color-grey-6 font-16 mb30">服务配置</p>
{ shixun_service_configs&&shixun_service_configs.map((item,key)=>{ {this.state.shixun_service_configs && this.state.shixun_service_configs.map((item, key) => {
return( return (
<div key={key}> <div key={key}>
<div id="5"> <div id="5">
<div className="color-grey-6 font-16 mt30 mb20" id="shixun_scenario_type_name"> <div className="color-grey-6 font-16 mt30 mb20" id="shixun_scenario_type_name">
@ -681,34 +1012,36 @@ class Shixuninformation extends Component {
<div className="clearfix mb5"> <div className="clearfix mb5">
<label className="panel-form-label fl">CPU()</label> <label className="panel-form-label fl">CPU()</label>
<div className="pr fl with80 status_con"> <div className="pr fl with80 status_con">
<input type="text" value={item.cpu_limit} onInput={(e)=>this.setConfigsInputs(e,key,1)} <input type="text" value={item.cpu_limit} onInput={(e) => this.setConfigsInputs(e, key, 1)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称"/>
</div> </div>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
<div className="clearfix mb5"> <div className="clearfix mb5">
<label className="panel-form-label fl">最低CPU()</label> <label className="panel-form-label fl">最低CPU()</label>
<div className="pr fl with80 status_con"> <div className="pr fl with80 status_con">
<input type="text" value={item.lower_cpu_limit} onInput={(e)=>this.setConfigsInputs(e,key,2)} <input type="text" value={item.lower_cpu_limit}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> onInput={(e) => this.setConfigsInputs(e, key, 2)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称"/>
</div> </div>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
<div className="clearfix mb5"> <div className="clearfix mb5">
<label className="panel-form-label fl">内存限制(M)</label> <label className="panel-form-label fl">内存限制(M)</label>
<div className="pr fl with80 status_con"> <div className="pr fl with80 status_con">
<input type="text" value={item.memory_limit} onInput={(e)=>this.setConfigsInputs(e,key,3)} <input type="text" value={item.memory_limit} onInput={(e) => this.setConfigsInputs(e, key, 3)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称"/>
</div> </div>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
<div className="clearfix mb5"> <div className="clearfix mb5">
<label className="panel-form-label fl">内存要求(M)</label> <label className="panel-form-label fl">内存要求(M)</label>
<div className="pr fl with20 status_con"> <div className="pr fl with20 status_con">
<input type="text" value={item.request_limit} onInput={(e)=>this.setConfigsInputs(e,key,4)} <input type="text" value={item.request_limit} onInput={(e) => this.setConfigsInputs(e, key, 4)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称"/>
</div> </div>
<label className="panel-form-label fl" style={{width: '48%'}}>温馨提示纯编程类型实训建议使用默认值对于大数据等建议使用最大内存的30%</label> <label className="panel-form-label fl"
style={{width: '48%'}}>温馨提示纯编程类型实训建议使用默认值对于大数据等建议使用最大内存的30%</label>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
</div> </div>
@ -716,7 +1049,7 @@ class Shixuninformation extends Component {
) )
})} })}
</div> :""} </div> : ""}
{postapplyvisible === true ? <style> {postapplyvisible === true ? <style>
@ -742,8 +1075,8 @@ class Shixuninformation extends Component {
</div> </div>
<div className="task-popup-submit clearfix mt10"> <div className="task-popup-submit clearfix mt10">
<a onClick={()=>this.hidestandard_scriptsModal()} className="task-btn fl">取消</a> <a onClick={() => this.hidestandard_scriptsModal()} className="task-btn fl">取消</a>
<a className="task-btn task-btn-orange fr" onClick={()=>this.get_mirror_script()}>确定</a> <a className="task-btn task-btn-orange fr" onClick={() => this.get_mirror_script()}>确定</a>
</div> </div>
</Modal> </Modal>
@ -756,10 +1089,48 @@ class Shixuninformation extends Component {
> >
<div className="task-popup-content"><p className="task-popup-text-center font-16">评测脚本生成成功</p></div> <div className="task-popup-content"><p className="task-popup-text-center font-16">评测脚本生成成功</p></div>
<div className="task-popup-sure clearfix"> <div className="task-popup-sure clearfix">
<a className="task-btn task-btn-orange" onClick={()=>this.hidestandard_scriptsModal()} >确定</a> <a className="task-btn task-btn-orange" onClick={() => this.hidestandard_scriptsModal()}>确定</a>
</div> </div>
</Modal> </Modal>
<Modal
keyboard={false}
title="自定义模板"
visible={this.state.visibleTemplate}
onCancel={this.handleCancelTemplate}
onOk={this.hideModalTemplate}
okText="确认"
cancelText="取消"
>
<div>
<li className="clearfix mb15">
<label className="panel-form-label fl"><span
className="color-orange mr5">*</span></label>
<textarea className="task-form-80 task-height-150 panel-box-sizing fl mt10"
onInput={this.Executiveorder}
value={this.state.Executiveordervalue}
style={{width: '100%'}}
id="executive_command"
>
</textarea>
<p className="-text-danger fl mt5"
id="executive_command_notice"
style={{display: this.state.Executivetyoe === false ? "none" : "block"}}
>执行命令不能为空</p>
</li>
<li className="clearfix mb15">
<label className="panel-form-label fl">编译命令</label>
<textarea className="task-form-80 task-height-150 panel-box-sizing fl mt10"
value={this.state.Compilecommandvalue}
onInput={this.Compilecommand}
id="compile_command"
style={{width: '100%'}}
>
</textarea>
</li>
</div>
</Modal>
<Modal <Modal
keyboard={false} keyboard={false}
@ -777,20 +1148,21 @@ class Shixuninformation extends Component {
<textarea <textarea
className={this.state.languagewritetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"} className={this.state.languagewritetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
style={{width: '89%', height: '100px'}} style={{width: '89%', height: '100px'}}
onInput={this.setlanguagewrite} onInput={this.setlanguage}
value={languagewrite} value={this.state.language}
placeholder="请填写该镜像是基于什么语言示例Python" placeholder="请填写该镜像是基于什么语言示例Python"
id="demand_info"></textarea> id="demand_info"></textarea>
</li> </li>
<div className={"color-red shixunspanred"}>{this.state.languagewritetype === true ? "请填写该镜像语言" : ""}</div> <div
className={"color-red shixunspanred"}>{this.state.languagewritetype === true ? "请填写该镜像语言" : ""}</div>
<li className="clearfix ml1"> <li className="clearfix ml1">
<label className="panel-form-label fl ml50"><span <label className="panel-form-label fl ml50"><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label> className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea <textarea
className={this.state.systemenvironmenttype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"} className={this.state.systemenvironmenttype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
onInput={this.setsystemenvironment} onInput={this.setruntime}
style={{height: '100px'}} style={{height: '100px'}}
value={systemenvironment} value={this.state.runtime}
placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境" placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境"
id="demand_info"></textarea> id="demand_info"></textarea>
</li> </li>
@ -802,8 +1174,8 @@ class Shixuninformation extends Component {
<textarea <textarea
className={this.state.testcoderunmodetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"} className={this.state.testcoderunmodetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
onInput={this.settestcoderunmode} onInput={this.setrun_method}
value={testcoderunmode} value={this.state.run_method}
style={{height: '100px'}} style={{height: '100px'}}
placeholder="请填写该镜像中测试代码运行方式" placeholder="请填写该镜像中测试代码运行方式"
id="demand_info"></textarea> id="demand_info"></textarea>
@ -837,10 +1209,11 @@ class Shixuninformation extends Component {
</li> </li>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
{/*</Form>*/}
</Modal> </Modal>
</div> </div>
<Bottomsubmit url={`/shixuns/${this.props.match.params.shixunId}/challenges`} onSubmits={ this.sendsure_apply}/> {this.props.identity < 5 ?
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${this.props.match.params.shixunId}/challenges`}
onSubmits={this.onSubmits}/> : ""}
</div> </div>
); );

@ -2,7 +2,8 @@ import React, {Component} from 'react';
import { import {
Button, Button,
Tabs Tabs,
Modal
} from 'antd'; } from 'antd';
import TopShixuninformation from './Shixuninformation'; import TopShixuninformation from './Shixuninformation';
@ -23,15 +24,10 @@ const {TabPane} = Tabs;
export default class TPMsettings extends Component { export default class TPMsettings extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {}
}
} }
componentDidMount() { componentDidMount() {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
@ -41,9 +37,9 @@ export default class TPMsettings extends Component {
axios.get(Url).then((response) => { axios.get(Url).then((response) => {
// alert(response.data.shixun.choice_standard_scripts) // alert(response.data.shixun.choice_standard_scripts)
if (response.status === 200) { if (response.status === 200) {
this.setState({ this.setState({
data:response.data data: response.data
}) })
if (response.data.shixun.multi_webssh === true) { if (response.data.shixun.multi_webssh === true) {
this.setState({ this.setState({
SelectTheCommandtype: true SelectTheCommandtype: true
@ -79,15 +75,63 @@ export default class TPMsettings extends Component {
} }
operateshixuns = (value) => {
this.setState({
operateshixunstype: true,
delType: value
})
}
hideoperateshixuns = () => {
this.setState({
operateshixunstype: false
})
}
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)
})
}
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)
})
}
render() { render() {
return ( return (
<div> <div>
<style> <style>
{ {
` `
.ant-tabs-bar{ .ant-tabs-bar{
width: 1200px; width: 1200px;
margin: 0 auto; margin: 0 auto;
@ -96,38 +140,69 @@ export default class TPMsettings extends Component {
margin-top: 30px!important; margin-top: 30px!important;
} }
` `
}
</style>
<Tabs tabBarExtraContent={
<div className={"mb20 mr20"}>
{
this.props.identity < 5 && this.state.data && this.state.data.shixun.status == 0 ?
<Button type="primary" ghost className={"Permanentban mr20"} onClick={() => this.operateshixuns(1)}>
删除实训
</Button>
: ""
}
{
this.props.identity == 1 && this.state.data && this.state.data.shixun.status == 2 ?
<Button type="primary" ghost className={"Permanentban mr20"} onClick={() => this.operateshixuns(1)}>
删除实训
</Button> : ""
}
{
this.props.identity === 1 && this.state.data && this.state.data.shixun.status == 2 ?
<Button type="primary" ghost className={"Permanentban"} onClick={() => this.operateshixuns(2)}>
永久关闭
</Button> : ""
} }
</style> </div>
<Tabs tabBarExtraContent={ }>
<div className={"mb20 mr20"}> <TabPane tab="基本信息" key="1">
<Button type="primary" ghost className={"Permanentban"}> <TopShixuninformation
永久关闭 {...this.state}
</Button> {...this.props}
<Button type="primary" ghost className={"Permanentban ml20"}> />
删除实训 </TabPane>
</Button> <TabPane tab="权限配置" key="2">
</div> <Configuration
}> {...this.state}
<TabPane tab="基本信息" key="1"> {...this.props}
<TopShixuninformation />
{...this.state} </TabPane>
{...this.props} <TabPane tab="学习页面设置" key="3">
/> <LearningSettings
</TabPane> {...this.state}
<TabPane tab="权限配置" key="2"> {...this.props}
<Configuration />
{...this.state} </TabPane>
{...this.props} </Tabs>
/> <Modal
</TabPane> keyboard={false}
<TabPane tab="学习页面设置" key="3"> title="提示"
<LearningSettings visible={this.state.operateshixunstype}
{...this.state} closable={false}
{...this.props} footer={null}
/> >
</TabPane> <div className="task-popup-content">
</Tabs> {this.state.delType === 1 ? <p className="task-popup-text-center font-16 pb20">是否确认删除 </p> :
</div> <p className="task-popup-text-center font-16 pb20">关闭后,<br/>用户不能再开始挑战了是否确认关闭 </p>}
</div>
<div className="task-popup-submit clearfix">
<a onClick={this.hideoperateshixuns} className="task-btn fl">取消</a>
{this.state.delType === 1 ? <a className="task-btn task-btn-orange fr" onClick={this.shixunsdel}>确定</a> :
<a className="task-btn task-btn-orange fr" onClick={this.shixunsclose}>确定</a>}
</div>
</Modal>
</div>
); );
} }

@ -4,7 +4,7 @@ import {TPMIndexHOC} from '../TPMIndexHOC';
import {SnackbarHOC} from 'educoder'; import {SnackbarHOC} from 'educoder';
import {Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon,notification} from 'antd'; import {Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon, notification} from 'antd';
import axios from 'axios'; import axios from 'axios';
@ -145,7 +145,7 @@ class Newshixuns extends Component {
}); });
let newlist = "" let newlist = ""
e.map((item, key) => { e.map((item, key) => {
if(item.props.name!=""){ if (item.props.name != "") {
newlist = newlist + `${item.props.name}` newlist = newlist + `${item.props.name}`
} }
}) })
@ -316,7 +316,7 @@ class Newshixuns extends Component {
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state; let {fileList} = this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
@ -334,7 +334,7 @@ class Newshixuns extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){ if (!file.percent || file.percent == 100) {
Modal.confirm({ Modal.confirm({
title: '确定要删除这个附件吗?', title: '确定要删除这个附件吗?',
okText: '确定', okText: '确定',
@ -355,13 +355,12 @@ class Newshixuns extends Component {
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); console.log(file);
let id=file.response ==undefined ? file.id : file.response.id let id = file.response == undefined ? file.id : file.response.id
const url = `/attachments/${id}.json` const url = `/attachments/${id}.json`
axios.delete(url, { axios.delete(url, {})
})
.then((response) => { .then((response) => {
if (response.data) { if (response.data) {
const { status } = response.data; const {status} = response.data;
if (status == 0) { if (status == 0) {
// console.log('--- success') // console.log('--- success')
@ -372,7 +371,7 @@ class Newshixuns extends Component {
newFileList.splice(index, 1); newFileList.splice(index, 1);
return { return {
fileList: newFileList, fileList: newFileList,
deleteisnot:true deleteisnot: true
}; };
}); });
} }
@ -503,8 +502,8 @@ class Newshixuns extends Component {
> >
<Option value={1}>初级</Option> <Option value={1}>初级</Option>
<Option value={2}>中级</Option> <Option value={2}>中级</Option>
<Option value={3}>高级</Option> <Option value={3}>高级</Option>
<Option value={4}></Option> <Option value={4}></Option>
</Select> </Select>
</div> </div>
@ -567,7 +566,7 @@ class Newshixuns extends Component {
<div className=" fl pr mr20"> <div className=" fl pr mr20">
<Select placeholder="请选择小类别" <Select placeholder="请选择小类别"
mode="multiple" mode="multiple"
style={{width: 180}} style={{width: 280}}
onChange={this.sub_type} onChange={this.sub_type}
defaultOpen={false} defaultOpen={false}
className={"Selectlittle"} className={"Selectlittle"}
@ -589,12 +588,12 @@ class Newshixuns extends Component {
)} )}
<span className="fl ml20 color-grey lineh-20"> <span className="fl ml20 color-grey lineh-20">
<div> <div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" : {this.state.mainvalues === undefined && this.state.subvalues === undefined || this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width':'700px'}}> <div className={"font-12"} style={{'max-width': '600px'}}>
{`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`} {`${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.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.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.subvalues : this.state.subvalues}`}
</div>} </div>}
</div> </div>
@ -704,7 +703,7 @@ class Newshixuns extends Component {
</div> </div>
</div> </div>
</div> </div>
<Bottomsubmit url={"/shixuns"} onSubmits={() => this.handleSubmit()}/> <Bottomsubmit {...this.props} {...this.state} url={"/shixuns"} onSubmits={() => this.handleSubmit()}/>
</div> </div>
); );

@ -392,9 +392,9 @@ a.white-btn.use_scope-btn:hover{
border-color: #096dd9; border-color: #096dd9;
} }
.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{ /*.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{*/
background-color: #4CACFF; /* background-color: #4CACFF;*/
} /*}*/
.newViewAfter .ant-input{ .newViewAfter .ant-input{
line-height: 40px !important; line-height: 40px !important;

Loading…
Cancel
Save