dev_forum
杨树明 5 years ago
parent 9441f038be
commit 79385d7bc6

@ -180,7 +180,7 @@ class TPMIndex extends Component {
power: response.data.power,
identity: response.data.identity,
propaedeutics:response.data.propaedeutics,
status: response.data.status,
status: response.data.shixun_status,
});
}
}).catch((error) => {

@ -190,7 +190,7 @@ export default class TPMsettings extends Component {
evaluate_script:undefined,
standard_scripts: undefined,
choice_main_type: "",
choice_small_type: [""],
choice_small_type: [],
choice_standard_scripts:undefined,
editordescriptios: undefined,
editorevaluate_scripts: undefined,
@ -222,7 +222,7 @@ export default class TPMsettings extends Component {
scope_partmenttype:false,
newuse_scope:undefined,
scope_partments:0,
shixun_service_configs:undefined,
pod_exist_time: undefined,
pod_exist_timetype: false,
shixunmemoMDvalue:"",
@ -325,6 +325,7 @@ export default class TPMsettings extends Component {
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
})
// if(response.data.status===403){
@ -513,6 +514,23 @@ export default class TPMsettings extends Component {
bigClass = (value) => {
let {settingsData,shixun_service_configs}=this.state;
let newshixun_service_configs=shixun_service_configs;
settingsData.shixun.main_type.some((item,key)=> {
if (item.id === value) {
newshixun_service_configs[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) {
@ -520,7 +538,8 @@ export default class TPMsettings extends Component {
this.setState({
choice_main_type: value,
standard_scripts:response.data,
choice_standard_scripts:null
choice_standard_scripts:null,
shixun_service_configs:newshixun_service_configs
})
}
}).catch((error) => {
@ -530,10 +549,78 @@ export default class TPMsettings extends Component {
}
Deselectlittle=(value)=>{
let {settingsData,shixun_service_configs,choice_small_type}=this.state;
let newshixun_service_configs=shixun_service_configs;
let newchoice_small_type=choice_small_type;
newchoice_small_type.some((items,keys)=> {
if (items === value) {
newchoice_small_type.splice(keys, 1)
return true
}
}
)
settingsData.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
newshixun_service_configs.splice(keys+1, 1)
return true
}
}
)
this.setState({
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configs
})
}
littleClass = (value) => {
let {settingsData,shixun_service_configs,choice_small_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
// }
// }
// )
// })
// }
settingsData.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
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
}
}
)
newchoice_small_type.push(value)
this.setState({
choice_small_type: value
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configs
})
}
onPodExistTimeChange = (e) => {
@ -596,7 +683,7 @@ export default class TPMsettings extends Component {
let {
name, description, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum,
evaluate_script, exec_time, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
opening_time, pod_exist_time,shixunmemoMDvalue
opening_time, pod_exist_time,shixunmemoMDvalue,shixun_service_configs
} = this.state;
let operateauthority=this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
@ -689,16 +776,13 @@ export default class TPMsettings extends Component {
if(newmulti_webssh===null){
newmulti_webssh=0
}
//exec_time: exec_time,
let Url = `/shixuns/` + id + `.json`;
let data = {
shixun:{
name: name,
description: description_editormd,
main_type: choice_main_type,
small_type: choice_small_type,
webssh: webssh,
user_scope: use_scope,
scope_partment: scope_partment,
can_copy: can_copy,
vnc: vnc,
test_set_permission: test_set_permission,
@ -708,12 +792,19 @@ export default class TPMsettings extends Component {
standard_scripts: choice_standard_scripts,
hide_code: hide_code,
forbid_copy: forbid_copy,
exec_time: exec_time,
evaluate_script: evaluate_script_editormd,
multi_webssh:newmulti_webssh,
opening_time:opening_time,
mirror_script_id:choice_standard_scriptssum,
delType:1
},
shixun_info:{
description: description_editormd,
evaluate_script: evaluate_script_editormd,
},
main_type: choice_main_type,
small_type: choice_small_type,
scope_partment: scope_partment,
shixun_service_configs:shixun_service_configs
}
axios.put(Url, data).then((response) => {
@ -941,7 +1032,7 @@ export default class TPMsettings extends Component {
this.setState({
opers:true
})
e.stopPropagation();//阻止冒泡
}
bigopens=(e)=>{
@ -951,19 +1042,19 @@ export default class TPMsettings extends Component {
opersss:false,
opensmail:false
})
e.stopPropagation();//阻止冒泡
}
bigopensmal=(e)=>{
this.setState({
opensmail:true
})
e.stopPropagation();//阻止冒泡
}
sbigopen=(e)=>{
this.setState({
operss:true
})
e.stopPropagation();//阻止冒泡
}
sbigopens=()=>{
@ -975,7 +1066,7 @@ export default class TPMsettings extends Component {
this.setState({
opersss:true
})
e.stopPropagation();//阻止冒泡
}
sbigopensss=()=>{
@ -1020,7 +1111,9 @@ export default class TPMsettings extends Component {
})
}
inputs=()=>{
}
render() {
let {
@ -1075,7 +1168,8 @@ export default class TPMsettings extends Component {
scope_partmenttype,
newuse_scope,
scope_partments,
shixunmemoMDvalue,delType
shixunmemoMDvalue,delType,
shixun_service_configs
} = this.state;
let options;
@ -1259,9 +1353,10 @@ export default class TPMsettings extends Component {
value={choice_small_type.length===0||choice_small_type[0]===""||choice_small_type===[]?undefined:choice_small_type}
style={{width: 180}}
disabled={operateauthority?false:true}
onChange={operateauthority?this.littleClass:""}
// onChange={operateauthority?this.littleClass:""}
onDeselect={operateauthority?this.Deselectlittle:""}
onMouseEnter={operateauthority?this.bigopensmal:""}
onSelect={operateauthority?this.bigopens:""}
onSelect={operateauthority?this.littleClass:""}
defaultOpen={false}
open={opensmail}
>
@ -1699,6 +1794,58 @@ export default class TPMsettings extends Component {
{/*</span>*/}
{/*</div>*/}
</div>
{/*"name": "我是镜像名", # 镜像名称*/}
{/*"cpu_limit": 1, # cpu核*/}
{/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/}
{/*"memory_limit": 1024 ,#内存限制*/}
{/*"request_limit": 10, # 内存要求*/}
{/*"mirror_repository_id": 12, # 镜像id*/}
<div className="edu-back-white padding40-20 mb20">
{this.props.identity<2?shixun_service_configs&&shixun_service_configs.map((item,key)=>{
return(
<div key={key}>
<p className="color-grey-6 font-16 mb30">服务配置</p>
<div id="5">
<p className="color-grey-6 font-16 mt30 mb10" id="shixun_scenario_type_name">{item.name}</p>
<div className="clearfix mb5">
<label className="panel-form-label fl">CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" name="cpu_limit[]" value={item.cpu_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">最低CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" name="lower_cpu_limit[]" value={item.lower_cpu_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存限制(M)</label>
<div className="pr fl with80 status_con">
<input type="text" name="memory_limit[]" value={item.memory_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存要求(M)</label>
<div className="pr fl with20 status_con">
<input type="text" name="request_limit[]" value={item.request_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<label className="panel-form-label fl" style={{width: '48%'}}>温馨提示纯编程类型实训建议使用默认值对于大数据等建议使用最大内存的30%</label>
<div className="cl"></div>
</div>
</div>
</div>
)
}) :""}
</div>
<p>
@ -1711,49 +1858,7 @@ export default class TPMsettings extends Component {
<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div> :""
}
{/*{*/}
{/*this.props.identity===1&&this.props.status==2?*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*/!*<a className="edu-default-btn edu-blueline-btn fl ml20"*!/*/}
{/*/!*id="challenge_begin"*!/*/}
{/*/!*onClick={this.operateshixuns}>*!/*/}
{/*/!*永久关闭*!/*/}
{/*/!*</a>*!/*/}
{/*</div> :""*/}
{/*}*/}
{/*{*/}
{/*this.props.identity===1||this.props.power==true?*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*<Popconfirm title={status===0?"删除实训后,用户不能再开始挑战了是否确认删除?":"关闭实训后,用户不能再开始挑战了是否确认关闭?"} onConfirm={this.shixunsclose} okText="确定"*/}
{/*cancelText="取消"*/}
{/*style={{display:status===0?"none":"block"}}*/}
{/*>*/}
{/*<a*/}
{/*className="edu-default-btn edu-blueline-btn fl ml20"*/}
{/*id="challenge_begin"*/}
{/*style={{display:status===0?"none":"block"}}*/}
{/*>*/}
{/*{status===0?"":"永久关闭"}*/}
{/*</a>*/}
{/*</Popconfirm>*/}
{/*</div> :""*/}
{/*}*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*</div>*/}
</p>
</div>

@ -299,14 +299,14 @@ export default class TPManswer extends Component {
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}

@ -241,14 +241,14 @@ export default class TPManswer extends Component {
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}

@ -174,7 +174,8 @@ export default class TPMchallengesnew extends Component {
shixunsskillvaluelisttype: false,
marktype:false,
editPracticesendtype:false,
CreatePracticesendtype:false
CreatePracticesendtype:false,
exec_time:undefined
}
}
@ -292,6 +293,7 @@ export default class TPMchallengesnew extends Component {
onshixunsmarkvalue:response.data.score,
shixunsskillvaluelist:response.data.tags,
checkpointId:checkpointId,
exec_time:response.data.exec_time,
tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3",
})
@ -345,7 +347,7 @@ export default class TPMchallengesnew extends Component {
})
return
}
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist} = this.state;
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,exec_time} = this.state;
if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
this.setState({
shixunCreatePracticetype: true
@ -383,7 +385,8 @@ export default class TPMchallengesnew extends Component {
difficulty: shixunCreatePracticeGroup,
score: onshixunsmarkvalue,
challenge_tag: shixunsskillvaluelist,
st: 0
st: 0,
exec_time:exec_time
}).then((response) => {
this.props.showSnackbar(response.data.messages);
if (response.data.status === 1) {
@ -392,7 +395,7 @@ export default class TPMchallengesnew extends Component {
tab2url: "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3",
})
window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2"
// window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2"
}
}).catch((error) => {
@ -452,7 +455,7 @@ export default class TPMchallengesnew extends Component {
editPracticesendtype:true
})
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId} = this.state;
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state;
const exercise_editormdvalue = this.exercise_editormd.getValue();
@ -493,6 +496,7 @@ export default class TPMchallengesnew extends Component {
task_pass: exercise_editormdvalue,
difficulty: shixunCreatePracticeGroup,
score: onshixunsmarkvalue,
exec_time:exec_time
},
challenge_tag:shixunsskillvaluelist
}).then((response) => {
@ -503,7 +507,7 @@ export default class TPMchallengesnew extends Component {
tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3",
})
window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2"
// window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2"
}
}).catch((error) => {
console.log(error)
@ -523,6 +527,12 @@ export default class TPMchallengesnew extends Component {
marktype:false
})
}
setexec_time=(e)=>{
this.setState({
exec_time:e.target.value
})
}
render() {
let shixuntype = this.props.match.params.type;
@ -552,14 +562,14 @@ export default class TPMchallengesnew extends Component {
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{ prev_challenge===undefined?"":
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{ next_challenge===undefined?"":
<a href={next_challenge}className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge}className="fr color-blue mr15 mt4">下一关</a>
}
@ -717,6 +727,17 @@ export default class TPMchallengesnew extends Component {
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">服务配置</p>
<div className="clearfix mb5">
<label className="panel-form-label fl">评测时限(S)</label>
<div className="pr fl with80 status_con">
<input value={this.state.exec_time} className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" onInput={this.setexec_time}/>
</div>
<div className="cl"></div>
</div>
</div>
<div className="clearfix mt30"
style={{display:this.props.identity>3||this.props.identity===undefined?"none":'block'}}
>

@ -765,14 +765,14 @@ export default class TPMevaluation extends Component {
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}

@ -1240,13 +1240,13 @@ editanswersMD=(initValue, id)=> {
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{ prev_challenge===undefined?"":
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{ next_challenge===undefined?"":
<a href={next_challenge}className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge}className="fr color-blue mr15 mt4">下一关</a>
}
<a href={practice_url === undefined ? "" : practice_url}

@ -635,7 +635,7 @@ class Newshixuns extends Component {
this.setState({
opers: true
})
e.stopPropagation();//阻止冒泡
}
bigopens = (e) => {
@ -644,21 +644,21 @@ class Newshixuns extends Component {
operss: false,
opensmail: false
})
e.stopPropagation();//阻止冒泡
}
bigopensmal = (e) => {
this.setState({
opensmail: true
})
e.stopPropagation();//阻止冒泡
}
sbigopen = (e) => {
this.setState({
operss: true
})
e.stopPropagation();//阻止冒泡
}
// sbigopens=()=>{
@ -1196,6 +1196,7 @@ class Newshixuns extends Component {
showToday={false}
showTime
locale={locale}
style={{"width": "184px"}}
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择开启时间"
onChange={this.onChangeTimePicker}

Loading…
Cancel
Save