-
难度系数
-
-
-
+
+
+ *
+ 难度系数:
+
简单
中等
困难
-
-
- 奖励经验值
+
+ {/**/}
+
+ {/* */}
+ {/* 简单*/}
+ {/* 中等*/}
+ {/* 困难*/}
+ {/* */}
+
+ {/*
*/}
+ * 奖励经验值: (如果学员答题正确,将获得相应的经验值;如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+100经验值、+100金币)
-
*
-
-
-
-
技能标签
+
+
*技能标签: (学员答题正确将获得技能,否则不能获得技能)
-
*
{/*
+ 添加*/}
-
学员答题正确将获得技能,否则不能获得技能
+ {/*onClick={this.clickshixunsskill}>+ 添加*/}
+
(回车添加标签)
-
{
shixunsskillvaluelist===undefined?"":shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => {
return (
@@ -574,21 +609,18 @@ export default class TPMchallengesnew extends Component {
)
})
}
-
-
-
必填项
-
-
服务配置
+
+
* 服务配置
-
*
+
@@ -600,14 +632,20 @@ export default class TPMchallengesnew extends Component {
-
4||this.props.identity===undefined?"none":'block'}}
- >
- {checkpointId===undefined?
提交:
-
提交}
-
取消
-
+
+ {this.props.identity>4||this.props.identity===undefined?"":
4||this.props.identity===undefined?"none":'block'}}
+ >
+ {/*{checkpointId===undefined?
提交:*/}
+ {/*
提交}*/}
+ {/*
取消*/}
+ {/*
取消*/}
+
+ }
)
}
diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
index 34eb1a075..44e49dc40 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js
@@ -1201,7 +1201,8 @@ export default class TPMevaluation extends Component {
4||this.props.identity===undefined||power===false?"none":"block"}}>
提交
-
取消
+ {/*
取消*/}
+
取消
diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js
index d0e6f98bd..5e90c1f3d 100644
--- a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js
+++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js
@@ -212,9 +212,9 @@ export default class TpmQuestionEdit extends Component {
diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js
index 614842ab8..c4008f89c 100644
--- a/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js
+++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js
@@ -69,9 +69,9 @@ export default class TpmQuestionMain extends Component {
style={{display: this.props.identity > 4 || this.props.identity === undefined || this.props.power === false ? "none" : "block"}}>
提交
-
取消
-
+ {/*
取消*/}
+
取消
diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js
index 861c4f879..c808fea61 100644
--- a/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js
+++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js
@@ -205,8 +205,10 @@ export default class TpmQuestionNew extends Component {
4||this.props.identity===undefined||this.props.power===false?"none":"block"}}>
提交
-
取消
+
取消
+ {/*
取消*/}
diff --git a/public/react/src/modules/tpm/challengesnew/TpmTask/TpmTaskIndex.js b/public/react/src/modules/tpm/challengesnew/TpmTask/TpmTaskIndex.js
new file mode 100644
index 000000000..5a64daf9e
--- /dev/null
+++ b/public/react/src/modules/tpm/challengesnew/TpmTask/TpmTaskIndex.js
@@ -0,0 +1,55 @@
+import React, {Component} from 'react';
+
+import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
+
+import Loadable from 'react-loadable';
+
+import Loading from "../../../../Loading";
+
+import Bottomsubmit from "../../../modals/Bottomsubmit";
+
+
+const TPMchallengestask = Loadable({
+ loader: () => import('../../challengesnew/TPMchallengesnew'),
+ loading: Loading,
+})
+
+export default class TpmTaskIndex extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+
+ }
+ }
+
+
+ componentDidMount() {
+
+ }
+
+
+ render() {
+ // console.log(a.indexOf("vnc"))
+ // console.log(b.indexOf("vnc"))
+
+ return (
+
+
+
+ {/*新建关卡*/}
+ ()
+ }>
+
+ {/*编辑关卡*/}
+ ()
+ }>
+
+
+
+ );
+ }
+}
+
+
diff --git a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css
index 37a65ef97..8efbaabda 100644
--- a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css
+++ b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css
@@ -266,4 +266,25 @@ a{
height: 32px;
line-height: 20px;
font-family: "微软雅黑","宋体";
+}
+
+.borderbottomf4{
+ border-bottom:1px solid #F4F4F4;
+}
+
+.TPMchallengesnewtitles{
+ height: 76px;
+ line-height: 56px;
+ padding: 10px 20px;
+}
+
+.newpadding1020{
+ padding: 20px 20px 20px;
+ box-sizing: border-box;
+}
+.newpadding02020{
+ padding: 0px 20px 20px;
+}
+.mb10 {
+ margin-bottom: 10px !important;
}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/challengesnew/old/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/old/TPMchallengesnew.js
new file mode 100644
index 000000000..6dfc04eef
--- /dev/null
+++ b/public/react/src/modules/tpm/challengesnew/old/TPMchallengesnew.js
@@ -0,0 +1,617 @@
+import React, {Component} from 'react';
+
+import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
+
+import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
+
+// import "antd/dist/antd.css";
+
+import TPMMDEditor from '../TPMMDEditor';
+
+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;
+
+export default class TPMchallengesnew extends Component {
+ constructor(props) {
+ super(props)
+ this.exercisememoMDRef=React.createRef();
+ this.state = {
+ choice_url: undefined,
+ practice_url: undefined,
+ go_back_url: undefined,
+ task_pass_default: undefined,
+ submit_url: undefined,
+ shixunCreatePracticeGroup: 1,
+ optionsums:[100,200],
+ activetype:0,
+ setopen: false,
+ shixunCreatePractice: undefined,
+ onshixunsmarkvalue: 100,
+ shixunsskillvalue: undefined,
+ shixunsskillvaluelist: [],
+ tab2url: "",
+ tab3url: "",
+ prev_challenge:undefined,
+ next_challenge:undefined,
+ power: false,
+ shixunCreatePracticetype: false,
+ shixunsskillvaluelisttype: false,
+ marktype:false,
+ editPracticesendtype:false,
+ CreatePracticesendtype:false,
+ exec_time:20,
+ shixunExec_timeType:false
+ }
+ }
+
+
+ componentDidMount() {
+ let id = this.props.match.params.shixunId;
+ let checkpointId=this.props.match.params.checkpointId;
+
+ let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
+ let newpractice_url= "/shixuns/"+id+"/challenges/new";
+ let newgo_back_url="/shixuns/"+id+"/challenges"
+ if(checkpointId===undefined){
+ //新建模式
+ let url = "/shixuns/" + id + "/challenges/new.json"
+ axios.get(url).then((response) => {
+ this.setState({
+ choice_url: newchoice_url,
+ practice_url: newpractice_url,
+ go_back_url: newgo_back_url,
+ position: response.data.position,
+ task_pass_default: response.data.task_pass_default,
+ submit_url: response.data.submit_url,
+ checkpointId:checkpointId,
+ exercisememoMDRefval:response.data.task_pass_default
+ })
+
+ this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'')
+ }).catch((error) => {
+ console.log(error)
+ });
+ }else{
+ //编辑模式
+ let url="/shixuns/"+id+"/challenges/"+checkpointId+".json?tab=0";
+ axios.get(url).then((response) => {
+
+ let optionsum;
+ if(response.data.difficulty===1){
+ optionsum=[100,200];
+ }else if(response.data.difficulty===2){
+ optionsum=[300,400,500,600];
+ }else if(response.data.difficulty===3){
+ optionsum=[700,800,900,1000]
+ }
+ let newprev_challenge=response.data.prev_challenge;
+ let next_challenge=response.data.next_challenge;
+ if (newprev_challenge != undefined) {
+ if(newprev_challenge.st===0){
+ newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
+ }else{
+ newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
+ }
+ }
+ if (next_challenge != undefined) {
+ if(next_challenge.st===0){
+ next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
+ }else{
+ next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
+ }
+ }
+ this.setState({
+ power: response.data.power,
+ prev_challenge:newprev_challenge,
+ next_challenge:next_challenge,
+ choice_url: newchoice_url,
+ practice_url: newpractice_url,
+ go_back_url: newgo_back_url,
+ shixunCreatePractice:response.data.subject,
+ position:response.data.position,
+ shixunCreatePracticeGroup:response.data.difficulty,
+ optionsums:optionsum,
+ 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",
+ exercisememoMDRefval:response.data.task_pass
+ })
+ if(response.data.power===false){
+ this.props.showSnackbar("你没有权限修改");
+ }
+
+ this.exercisememoMDRef.current.setValue(response.data.task_pass||'')
+ }).catch((error) => {
+ console.log(error)
+ });
+
+ }
+
+ }
+
+ onshixunCreatePracticeChange = (e) => {
+ let optionsum;
+ let onshixunsmark;
+ if(e.target.value===1){
+ optionsum=[100,200];
+ onshixunsmark=100;
+ }else if(e.target.value===2){
+ optionsum=[300,400,500,600];
+ onshixunsmark=300;
+ }else if(e.target.value===3){
+ optionsum=[700,800,900,1000]
+ onshixunsmark=700;
+ }
+ this.setState({
+ shixunCreatePracticeGroup: e.target.value,
+ optionsums:optionsum,
+ onshixunsmarkvalue:onshixunsmark
+ })
+ }
+
+ shixunCreatePractice = (e) => {
+ this.setState({
+ shixunCreatePractice: e.target.value
+ })
+ }
+
+ CreatePracticesend = () => {
+
+
+ this.setState({
+ CreatePracticesendtype:true
+ })
+
+ if(this.props.status===2){
+ this.props.showSnackbar("该实训已经发布不能新建")
+ this.setState({
+ CreatePracticesendtype:false
+ })
+ return
+ }
+ let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,exec_time} = this.state;
+ if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
+ this.setState({
+ shixunCreatePracticetype: true
+ })
+ this.props.showSnackbar("任务名称为空")
+ $('html').animate({
+ scrollTop: 10
+ }, 1000);
+
+ this.setState({
+ CreatePracticesendtype:false
+ })
+ return
+ }
+
+ if (shixunsskillvaluelist.length === 0) {
+ this.setState({
+ shixunsskillvaluelisttype: true,
+ CreatePracticesendtype:false
+ })
+ this.props.showSnackbar("技能标签为空")
+ return
+ }
+ if(exec_time===null||exec_time===undefined||exec_time===""){
+
+ this.setState({
+ shixunExec_timeType: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, {
+ identifier:id,
+ subject: shixunCreatePractice,
+ task_pass: exercise_editormdvalue,
+ difficulty: shixunCreatePracticeGroup,
+ score: onshixunsmarkvalue,
+ challenge_tag: shixunsskillvaluelist,
+ st: 0,
+ exec_time:exec_time
+ }).then((response) => {
+ if (response.data.status === 1) {
+ // $("html").animate({ scrollTop: 0 })
+ //window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/editcheckpoint?tab=2`;
+ window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`;
+ // this.setState({
+ // setopen: true,
+ // CreatePracticesendtype:false,
+ // tab2url: "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2",
+ // tab3url: "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3",
+ // })
+
+ }
+ // this.props.showSnackbar(response.data.messages);
+ }).catch((error) => {
+ console.log(error)
+ });
+
+
+
+ }
+
+ onshixunsmark = (value) => {
+ this.setState({
+ onshixunsmarkvalue: value
+ })
+ }
+
+ shixunsskill = (e) => {
+ this.setState({
+ shixunsskillvalue: e.target.value
+ })
+ }
+
+ clickshixunsskill = () => {
+
+ let {shixunsskillvalue, shixunsskillvaluelist} = this.state;
+ if (shixunsskillvalue === "") {
+ return
+ } else if (shixunsskillvalue === undefined) {
+ return
+ }
+
+ if(shixunsskillvalue == "" || shixunsskillvalue == undefined || shixunsskillvalue == null || (shixunsskillvalue.length>0 && shixunsskillvalue.trim().length == 0)){
+ message.error("输入为空,不能保存!");
+ return
+ }
+
+ let list = shixunsskillvaluelist;
+ list.push(shixunsskillvalue);
+ this.setState({
+ shixunsskillvaluelist: list,
+ shixunsskillvalue: ""
+ })
+ }
+
+ delshixunsskilllist = (key) => {
+ let {shixunsskillvaluelist} = this.state;
+ let newshixunsskillvaluelist = shixunsskillvaluelist;
+ newshixunsskillvaluelist.splice(key, 1);
+ this.setState({
+ shixunsskillvaluelist: newshixunsskillvaluelist
+ })
+ }
+
+ editPracticesend=()=>{
+
+ this.setState({
+ editPracticesendtype:true
+ })
+
+ let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state;
+
+ const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim();
+
+ let id = this.props.match.params.shixunId;
+
+ let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json";
+
+ if (shixunCreatePractice === undefined||shixunCreatePractice=="") {
+ // this.setState({
+ // shixunCreatePracticetype: true
+ // })
+ this.props.showSnackbar("任务名称为空")
+ $('html').animate({
+ scrollTop: 10
+ }, 1000);
+ this.setState({
+ editPracticesendtype:false
+ })
+ return
+ }
+
+ if (shixunsskillvaluelist.length === 0) {
+ // this.setState({
+ // shixunsskillvaluelisttype: true
+ // })
+ this.props.showSnackbar("技能标签为空")
+ this.setState({
+ editPracticesendtype:false
+ })
+ return
+ }
+
+ if(exec_time===null||exec_time===undefined||exec_time===""){
+
+ this.setState({
+ shixunExec_timeType:false
+ })
+ return
+ }
+ axios.put(url, {
+ tab:0,
+ identifier:id,
+ id:checkpointId,
+ challenge:{
+ subject: shixunCreatePractice,
+ task_pass: exercise_editormdvalue,
+ difficulty: shixunCreatePracticeGroup,
+ score: onshixunsmarkvalue,
+ exec_time:exec_time
+ },
+ challenge_tag:shixunsskillvaluelist
+ }).then((response) => {
+ this.props.showSnackbar(response.data.messages);
+ if (response.data.status === 1) {
+ window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`;
+ this.setState({
+ setopen: true,
+ editPracticesendtype:false,
+ 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"
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+
+
+ }
+
+ onshixunsmarks=()=> {
+ this.setState({
+ marktype:true
+ })
+ }
+
+ onshixunsmarkss=()=> {
+ this.setState({
+ marktype:false
+ })
+ }
+
+ setexec_time=(e)=>{
+ this.setState({
+ exec_time:e.target.value
+ })
+ }
+ render() {
+
+ let shixuntype = this.props.match.params.type;
+
+
+ let {marktype,
+ shixunCreatePracticetype, shixunsskillvaluelisttype,
+ choice_url, practice_url, go_back_url, position, task_pass_default, submit_url, setopen,checkpointId,prev_challenge,next_challenge,power,
+ shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvalue, shixunsskillvaluelist, tab2url, tab3url,optionsums,
+ CreatePracticesendtype,editPracticesendtype
+ } = this.state;
+
+ let options;
+ if(optionsums!=undefined){
+ options = optionsums.map((d, k) => {
+ return (
+
+ )
+ })
+ }
+
+ return (
+
+
+
+
+
+
+
+ 本关任务
+
+
+
+ {tab2url === "" ? 评测设置 : 评测设置}
+
+
+
+ {tab3url === "" ? 参考答案 : 参考答案}
+
+
+
+
+
+
+
+
+
+
+
+
难度系数
+
+
+
+ 简单
+ 中等
+ 困难
+
+
+
+
奖励经验值
+
+
*
+
+
+
+
+ 如果学员答题错误,则不能得到相应的经验值
+ 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币
+
+
+
必填项
+
+
+
+
+
+
技能标签
+
+
*
+
+
+ {/*
+ 添加*/}
+
学员答题正确将获得技能,否则不能获得技能
+
+
+ {
+ shixunsskillvaluelist===undefined?"":shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => {
+ return (
+
{itme}
+ this.delshixunsskilllist(key)}>×
+
+ )
+ })
+ }
+
+
+
+
+
+ 必填项
+
+
+
+
+
服务配置
+
+
*
+
+
+
+
+
必填项
+
+
+
+
+
4||this.props.identity===undefined?"none":'block'}}
+ >
+ {checkpointId===undefined?
提交:
+
提交}
+ {/*
取消*/}
+
取消
+
+
+
+ )
+ }
+}
+
+
diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css
index 2070f4b39..45a5f6cf5 100644
--- a/public/stylesheets/educoder/edu-all.css
+++ b/public/stylesheets/educoder/edu-all.css
@@ -401,7 +401,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin-
.task-colspan{min-width:25%;text-align: left;display: block;float: left;color: #999; }
.colspan-grey{border-radius: 12px;background-color: #E6E6E6;padding: 3px 10px;color: #747A7F}
/*新建任务*/
-.challenge_nav{padding: 40px 20px 0px 20px;border-bottom: 1px solid #eee;}
+.challenge_nav{padding: 20px 20px 0px 20px;border-bottom: 1px solid #eee;}
.challenge_nav li{width: auto;float: left;margin-right: 40px;position: relative}
.challenge_nav li.active:after{position: absolute;content: '';width: 50%;background-color: #4CACFF;height: 3px;border-radius: 2px;left: 25%;bottom: 0px;}
.challenge_nav li a{display: block;width: 100%;padding-bottom: 20px;}
From 0ac199b97ad94a973e67ecab9c87e15ba7263c79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Dec 2019 13:50:19 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/public/css/edu-all.css | 2 +-
public/react/src/modules/tpm/TPMIndexHOC.js | 15 +-
.../tpm/challengesnew/TPMchallengesnew.js | 172 +++++++++++-------
.../challengesnew/css/TPMchallengesnew.css | 4 +
public/stylesheets/educoder/edu-all.css | 2 +-
5 files changed, 125 insertions(+), 70 deletions(-)
diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css
index 7609a31a0..7a72655ad 100644
--- a/public/react/public/css/edu-all.css
+++ b/public/react/public/css/edu-all.css
@@ -398,7 +398,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin-
.colspan-grey{border-radius: 12px;background-color: #E6E6E6;padding: 3px 10px;color: #747A7F}
/*新建任务*/
.challenge_nav{padding: 20px 20px 0px 20px;border-bottom: 1px solid #eee;}
-.challenge_nav li{width: auto;float: left;margin-right: 40px;position: relative}
+.challenge_nav li{width: auto;float: left;margin-right: 20px;position: relative}
.challenge_nav li.active:after{position: absolute;content: '';width: 50%;background-color: #4CACFF;height: 3px;border-radius: 2px;left: 25%;bottom: 0px;}
.challenge_nav li a{display: block;width: 100%;padding-bottom: 20px;}
.add_choose_type{width: 60px;height: 20px;line-height: 19px;border-radius: 2px;background-color: #eaeaea;color: #999!important;display: block;float: left;text-align: center;margin-top: 4px;}
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index fe760f372..3ad58cf81 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -635,6 +635,18 @@ export function TPMIndexHOC(WrappedComponent) {
}
}
+ //跳转道描点的地方
+ scrollToAnchor = (anchorName) => {
+ if (anchorName) {
+ // 找到锚点
+ let anchorElement = document.getElementById(anchorName);
+ // 如果对应id的锚点存在,就跳转到锚点
+ if (anchorElement) {
+ anchorElement.scrollIntoView();
+ }
+ }
+ }
+
render() {
let{Headertop,Footerdown, isRender, AccountProfiletype,AccountPhoneemailtype}=this.state;
const common = {
@@ -670,7 +682,8 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading: this.hideGlobalLoading,
yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo,
- MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
+ MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll,
+ scrollToAnchor:this.scrollToAnchor
};
// console.log("this.props.mygetHelmetapi");
diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
index 2edf0a5d3..a715c914d 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js
@@ -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 {
- 1、本关任务
+ 1、本关任务
-
+ {tab2url === "" ? "":
> }
{tab2url === "" ? : 2、评测设置}
-
+ {tab3url === "" ? "":
> }
- {tab3url === "" ? : 3、参考答案}
+ {tab3url === "" ? : 3、参考答案}
@@ -491,17 +517,16 @@ export default class TPMchallengesnew extends Component {
{/* placeholder="请输入任务名称,最大限制60个字符;此信息将在实训发布后展示给学员,例:计算学生的课程成绩绩点"/>*/}