|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
|
|
|
|
|
|
import {Input, Select, Radio, Checkbox, Popconfirm, message, Button} from 'antd';
|
|
|
|
|
import {Input, Select, Radio, Badge, message, Button} from 'antd';
|
|
|
|
|
|
|
|
|
|
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
|
|
|
|
|
import {Link} from "react-router-dom";
|
|
|
|
|
|
|
|
|
|
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
|
|
|
|
|
|
|
|
|
@ -12,20 +12,8 @@ import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
import './css/TPMchallengesnew.css';
|
|
|
|
|
|
|
|
|
|
import { getImageUrl, toPath } from 'educoder';
|
|
|
|
|
|
|
|
|
|
import {getUrl} from 'educoder';
|
|
|
|
|
|
|
|
|
|
let origin = getUrl();
|
|
|
|
|
|
|
|
|
|
let path = getUrl("/editormd/lib/")
|
|
|
|
|
|
|
|
|
|
const $ = window.$;
|
|
|
|
|
|
|
|
|
|
let timeout;
|
|
|
|
|
|
|
|
|
|
let currentValue;
|
|
|
|
|
|
|
|
|
|
const Option = Select.Option;
|
|
|
|
|
|
|
|
|
|
const RadioGroup = Radio.Group;
|
|
|
|
@ -40,12 +28,12 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
go_back_url: undefined,
|
|
|
|
|
task_pass_default: undefined,
|
|
|
|
|
submit_url: undefined,
|
|
|
|
|
shixunCreatePracticeGroup: 1,
|
|
|
|
|
shixunCreatePracticeGroup: undefined,
|
|
|
|
|
optionsums:[100,200],
|
|
|
|
|
activetype:0,
|
|
|
|
|
setopen: false,
|
|
|
|
|
shixunCreatePractice: undefined,
|
|
|
|
|
onshixunsmarkvalue: 100,
|
|
|
|
|
onshixunsmarkvalue: undefined,
|
|
|
|
|
shixunsskillvalue: undefined,
|
|
|
|
|
shixunsskillvaluelist: [],
|
|
|
|
|
tab2url: "",
|
|
|
|
@ -59,7 +47,9 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
editPracticesendtype:false,
|
|
|
|
|
CreatePracticesendtype:false,
|
|
|
|
|
exec_time:20,
|
|
|
|
|
shixunExec_timeType:false
|
|
|
|
|
shixunExec_timeType:false,
|
|
|
|
|
onshixunsmarkvaluetype:false,
|
|
|
|
|
shixunCreatePracticeGrouptype:false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -196,10 +186,10 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,exec_time} = this.state;
|
|
|
|
|
if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunCreatePracticetype: true
|
|
|
|
|
shixunCreatePracticetype: true,
|
|
|
|
|
})
|
|
|
|
|
this.props.showSnackbar("任务名称为空")
|
|
|
|
|
$('html').animate({
|
|
|
|
|
// this.props.showSnackbar("任务名称为空")
|
|
|
|
|
$('html').animate({
|
|
|
|
|
scrollTop: 10
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
@ -209,25 +199,44 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(shixunCreatePracticeGroup===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunCreatePracticeGrouptype:true,
|
|
|
|
|
CreatePracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
this.props.scrollToAnchor("shixunCreatePracticeGroupid");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(onshixunsmarkvalue===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
onshixunsmarkvaluetype:true,
|
|
|
|
|
CreatePracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
this.props.scrollToAnchor("input_task_tag");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (shixunsskillvaluelist.length === 0) {
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunsskillvaluelisttype: true,
|
|
|
|
|
CreatePracticesendtype:false
|
|
|
|
|
CreatePracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
this.props.showSnackbar("技能标签为空")
|
|
|
|
|
// this.props.showSnackbar("技能标签为空")
|
|
|
|
|
this.props.scrollToAnchor("input_task_tag");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(exec_time===null||exec_time===undefined||exec_time===""){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(exec_time===null||exec_time===undefined||exec_time === ""){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunExec_timeType:false
|
|
|
|
|
shixunExec_timeType:true,
|
|
|
|
|
CreatePracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim();
|
|
|
|
|
let id = this.props.match.params.shixunId;
|
|
|
|
|
|
|
|
|
|
let url = "/shixuns/" + id + "/challenges.json";
|
|
|
|
|
|
|
|
|
|
axios.post(url, {
|
|
|
|
@ -332,22 +341,39 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(shixunCreatePracticeGroup===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunCreatePracticeGrouptype:true,
|
|
|
|
|
editPracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
this.props.scrollToAnchor("shixunCreatePracticeGroupid");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(onshixunsmarkvalue===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
onshixunsmarkvaluetype:true,
|
|
|
|
|
editPracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
this.props.scrollToAnchor("input_task_tag");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shixunsskillvaluelist.length === 0) {
|
|
|
|
|
// this.setState({
|
|
|
|
|
// shixunsskillvaluelisttype: true
|
|
|
|
|
// })
|
|
|
|
|
this.props.showSnackbar("技能标签为空")
|
|
|
|
|
// this.props.showSnackbar("技能标签为空")
|
|
|
|
|
this.props.scrollToAnchor("input_task_tag");
|
|
|
|
|
this.setState({
|
|
|
|
|
editPracticesendtype:false
|
|
|
|
|
editPracticesendtype:false,
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(exec_time===null||exec_time===undefined||exec_time===""){
|
|
|
|
|
|
|
|
|
|
if(exec_time===null||exec_time===undefined||exec_time === ""){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixunExec_timeType:false
|
|
|
|
|
shixunExec_timeType:true,
|
|
|
|
|
editPracticesendtype:false
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -463,15 +489,15 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
<div className="challenge_nav clearfix edu-back-white">
|
|
|
|
|
|
|
|
|
|
<li className="active">
|
|
|
|
|
<a>1、本关任务</a>
|
|
|
|
|
<a className={"color-blue"}>1、本关任务 </a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
{tab2url === "" ? "":<li> > </li>}
|
|
|
|
|
<li className="">
|
|
|
|
|
{tab2url === "" ? <span></span> : <Link to={tab2url}>2、评测设置</Link>}
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
{tab3url === "" ? "":<li> > </li>}
|
|
|
|
|
<li className="">
|
|
|
|
|
{tab3url === "" ? <span></span> : <Link to={tab3url}>3、参考答案</Link>}
|
|
|
|
|
{tab3url === "" ? <span></span> : <Link to={tab3url}> 3、参考答案</Link>}
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
</div>
|
|
|
|
@ -491,17 +517,16 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
{/* placeholder="请输入任务名称,最大限制60个字符;此信息将在实训发布后展示给学员,例:计算学生的课程成绩绩点"/>*/}
|
|
|
|
|
<Input placeholder="请输入任务名称,最大限制60个字符;此信息将在实训发布后展示给学员,例:计算学生的课程成绩绩点"
|
|
|
|
|
maxLength="60"
|
|
|
|
|
className={"newViewAfter"}
|
|
|
|
|
className={shixunCreatePracticetype === true ? "bor-red":"newViewAfter"}
|
|
|
|
|
onInput={this.shixunCreatePractice}
|
|
|
|
|
value={shixunCreatePractice}
|
|
|
|
|
addonAfter={`${String(!shixunCreatePractice? 0 : shixunCreatePractice.length)}/${60}`}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{width: '57px'}}>
|
|
|
|
|
<div>
|
|
|
|
|
<span
|
|
|
|
|
className={shixunCreatePracticetype === true ? "color-orange mt8 fl block" : "color-orange mt8 fl none"}
|
|
|
|
|
id="new_shixun_name"><i
|
|
|
|
|
className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
|
|
|
|
className={shixunCreatePracticetype === true ? "color-red mt8 fl block" : "color-red mt8 fl none"}
|
|
|
|
|
id="new_shixun_name">必填项:不能为空</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -537,13 +562,17 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
<p className="color-grey-6 font-16 mb20">
|
|
|
|
|
<span className="fl color-orange mr5">*</span>
|
|
|
|
|
难度系数:
|
|
|
|
|
<RadioGroup value={shixunCreatePracticeGroup} className="ml10"
|
|
|
|
|
<RadioGroup value={shixunCreatePracticeGroup}
|
|
|
|
|
className={"ml10"}
|
|
|
|
|
id={"shixunCreatePracticeGroupid"}
|
|
|
|
|
disabled={this.props.status===2?true:false}
|
|
|
|
|
onChange={this.props.status===2?"":this.onshixunCreatePracticeChange}>
|
|
|
|
|
<Radio value={1}>简单</Radio>
|
|
|
|
|
<Radio value={2}>中等</Radio>
|
|
|
|
|
<Radio value={3}>困难</Radio>
|
|
|
|
|
</RadioGroup>
|
|
|
|
|
{this.state.shixunCreatePracticeGrouptype===true?<div className="color-red mt7 ml5 font-14" id="ex_value_notice">
|
|
|
|
|
必选项:不能为空</div>:""}
|
|
|
|
|
</p>
|
|
|
|
|
{/*<div className="clearfix mb40">*/}
|
|
|
|
|
|
|
|
|
@ -560,7 +589,17 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
<div className="clearfix"
|
|
|
|
|
// onMouseLeave={this.props.status===2?"":this.onshixunsmarkss}
|
|
|
|
|
>
|
|
|
|
|
<Select style={{width: 252}} className="winput-240-40 fl ml3"
|
|
|
|
|
{this.state.onshixunsmarkvaluetype===true?<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
.ant-select-selection{
|
|
|
|
|
border:1px solid red;
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>:""}
|
|
|
|
|
<Select style={{width: 252}}
|
|
|
|
|
className={"winput-240-40 ml3"}
|
|
|
|
|
id="challenge_score"
|
|
|
|
|
onChange={this.props.status===2?"":this.onshixunsmark}
|
|
|
|
|
// onMouseEnter={this.props.status===2?"":this.onshixunsmarks}
|
|
|
|
@ -577,18 +616,18 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
{/* 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币*/}
|
|
|
|
|
{/*</p>*/}
|
|
|
|
|
|
|
|
|
|
<span className="color-orange mt7 fl ml20 none" id="ex_value_notice"><i
|
|
|
|
|
className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
|
|
|
|
{this.state.onshixunsmarkvaluetype===true?<div className="color-red mt7 ml5" id="ex_value_notice">
|
|
|
|
|
必选项:不能为空</div>:""}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="edu-back-white newpadding02020">
|
|
|
|
|
<p className="color-grey-6 font-16 mb10"><span className="mr5 color-orange">*</span>技能标签:<span className={"color-grey-8 font-14"}> (学员答题正确将获得技能,否则不能获得技能)</span></p>
|
|
|
|
|
<div className="clearfix df">
|
|
|
|
|
<div className="clearfix">
|
|
|
|
|
<div className="flex1">
|
|
|
|
|
<Input type="text"
|
|
|
|
|
className="winput-240-40 fl mr20 winput-240-40s ml10"
|
|
|
|
|
className={shixunsskillvaluelisttype === true ?"winput-240-40 fl mr20 winput-240-40s ml10 bor-red":"winput-240-40 fl mr20 winput-240-40s ml10"}
|
|
|
|
|
id="input_task_tag"
|
|
|
|
|
placeholder="添加标签"
|
|
|
|
|
onInput={this.shixunsskill}
|
|
|
|
@ -596,39 +635,38 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
onPressEnter={this.clickshixunsskill}
|
|
|
|
|
onBlur={this.clickshixunsskill}
|
|
|
|
|
/>
|
|
|
|
|
{/*<a className="white-btn orange-btn fl mt1 use_scope-btn ml20 mt5 mr20"*/}
|
|
|
|
|
{/*onClick={this.clickshixunsskill}>+ 添加</a>*/}
|
|
|
|
|
<div className="ml15 color-grey-9 mt5 font-14">(回车添加标签)</div>
|
|
|
|
|
<div className="ml15 color-grey-9 pt5 font-14">(回车添加标签)</div>
|
|
|
|
|
<div className="mt20 clearfix" id="task_tag_content">
|
|
|
|
|
{
|
|
|
|
|
shixunsskillvaluelist===undefined?"":shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => {
|
|
|
|
|
return (
|
|
|
|
|
<li className="task_tag_span" key={key}><span>{itme}</span>
|
|
|
|
|
<a onClick={() => this.delshixunsskilllist(key)}>×</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li key={key} className={"fl ml10 mr10"}>
|
|
|
|
|
<Badge className={"tpmpointer"} count={"x"} onClick={(key) => this.delshixunsskilllist(key)}>
|
|
|
|
|
<Button type="primary" ghost className={"Permanentban "}>
|
|
|
|
|
{itme}
|
|
|
|
|
</Button>
|
|
|
|
|
</Badge>
|
|
|
|
|
</li>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span className={shixunsskillvaluelisttype === true ? "color-orange mt7 fl ml20 block" : " color-orange mt7 fl ml20 none"}
|
|
|
|
|
id="stage_name_notice">
|
|
|
|
|
<i className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
|
|
|
|
<div className={shixunsskillvaluelisttype === true ? "color-red ml10 mt5 block" : "none"}
|
|
|
|
|
id="stage_name_notice">必选项:不能为空</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="edu-back-white newpadding02020">
|
|
|
|
|
<p className="color-grey-6 font-16 mb20"> <span className="color-orange mr5 fl">*</span> 服务配置</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}/>
|
|
|
|
|
<p className="color-grey-6 font-16 mb20"> <span className="color-orange mr5 fl">*</span> 服务配置:评测时限(S)</p>
|
|
|
|
|
<div className="clearfix mb5 ml10">
|
|
|
|
|
<div className="pr status_con">
|
|
|
|
|
{/*<label className="panel-form-label fl"></label>*/}
|
|
|
|
|
<input value={this.state.exec_time} className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" onInput={this.setexec_time}/>
|
|
|
|
|
</div>
|
|
|
|
|
<span
|
|
|
|
|
className={this.state.shixunExec_timeType === true ? "color-orange mt8 fl block ml20" : "color-orange mt8 fl none"}
|
|
|
|
|
id="new_shixun_name"><i className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
|
|
|
|
<div className="cl"></div>
|
|
|
|
|
<div
|
|
|
|
|
className={this.state.shixunExec_timeType === true ? "color-red mt8 block ml5" : " none"}
|
|
|
|
|
id="new_shixun_name">必填项:不能为空</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -641,10 +679,10 @@ export default class TPMchallengesnew extends Component {
|
|
|
|
|
{/*<a className="defalutSubmitbtn fl mr20" onClick={editPracticesendtype===true?"":this.editPracticesend}>提交</a>}*/}
|
|
|
|
|
{/*<a href={go_back_url === undefined ? "" : go_back_url} className="defalutCancelbtn fl">取消</a>*/}
|
|
|
|
|
{/*<Link to={go_back_url === undefined ? "" : go_back_url} className={"defalutCancelbtn fl"}>取消</Link>*/}
|
|
|
|
|
<Bottomsubmit {...this.props} {...this.state} url={go_back_url === undefined ? "" : go_back_url}
|
|
|
|
|
<Bottomsubmit url={go_back_url === undefined ? "" : go_back_url}
|
|
|
|
|
bottomvalue={"提交"}
|
|
|
|
|
onSubmits={checkpointId===undefined?CreatePracticesendtype===true?"":this.CreatePracticesend:editPracticesendtype===true?"":this.editPracticesend}
|
|
|
|
|
loadings={this.state.loading}/>
|
|
|
|
|
onSubmits={checkpointId===undefined?()=>this.CreatePracticesend():()=>this.editPracticesend()}
|
|
|
|
|
loadings={CreatePracticesendtype===true?true:editPracticesendtype===true?true:false}/>
|
|
|
|
|
</div>}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
)
|
|
|
|
|