From d8c5ab0a5547d54638168ad29d77b618e36eff8a 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 09:18:15 +0800 Subject: [PATCH 1/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/config/webpack.config.dev.js | 2 +- public/react/public/css/edu-all.css | 2 +- public/react/src/modules/tpm/TPMIndex.js | 5 + .../modules/tpm/challengesnew/TPManswer.js | 3 +- .../modules/tpm/challengesnew/TPManswer2.js | 6 +- .../tpm/challengesnew/TPMchallengesnew.js | 230 ++++--- .../tpm/challengesnew/TPMevaluation.js | 3 +- .../tpm/challengesnew/TpmQuestionEdit.js | 6 +- .../tpm/challengesnew/TpmQuestionMain.js | 6 +- .../tpm/challengesnew/TpmQuestionNew.js | 6 +- .../tpm/challengesnew/TpmTask/TpmTaskIndex.js | 55 ++ .../challengesnew/css/TPMchallengesnew.css | 21 + .../tpm/challengesnew/old/TPMchallengesnew.js | 617 ++++++++++++++++++ public/stylesheets/educoder/edu-all.css | 2 +- 14 files changed, 852 insertions(+), 112 deletions(-) create mode 100644 public/react/src/modules/tpm/challengesnew/TpmTask/TpmTaskIndex.js create mode 100644 public/react/src/modules/tpm/challengesnew/old/TPMchallengesnew.js diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 4e28af31f..d1092894a 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - devtool: "cheap-module-eval-source-map", + //devtool: "cheap-module-eval-source-map", // 开启调试 //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 48386e675..7609a31a0 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -397,7 +397,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;} diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 712b7909c..441bab0a3 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -87,6 +87,11 @@ const TPMchallengesnew = Loadable({ loader: () => import('./challengesnew/TPMchallengesnew'), loading: Loading, }) +//新建实训 +// const TPMchallengesnew = Loadable({ +// loader: () => import('./challengesnew/TpmTask/TpmTaskIndex'), +// loading: Loading, +// }) //新建tab2 const TPMevaluation = Loadable({ diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer.js b/public/react/src/modules/tpm/challengesnew/TPManswer.js index 9187e09b0..bd6735280 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer.js @@ -355,7 +355,8 @@ export default class TPManswer extends Component {
4||this.props.identity===undefined||power===false?"none":"block"}}> 提交 - 取消 + {/*取消*/} + 取消
diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer2.js b/public/react/src/modules/tpm/challengesnew/TPManswer2.js index dfdc58db4..c6c7ad795 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer2.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer2.js @@ -356,9 +356,9 @@ export default class TPManswer extends Component {
4||this.props.identity===undefined||power===false?"none":"block"}}> - 提交 - 取消 + 提交 + {/*取消*/} + 取消
diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index f6bac13a5..2edf0a5d3 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -1,13 +1,13 @@ import React, {Component} from 'react'; -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; +import {Input, Select, Radio, Checkbox, Popconfirm, message, Button} from 'antd'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; -// import "antd/dist/antd.css"; - import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; +import Bottomsubmit from "../../modals/Bottomsubmit"; + import axios from 'axios'; import './css/TPMchallengesnew.css'; @@ -83,7 +83,8 @@ export default class TPMchallengesnew extends Component { task_pass_default: response.data.task_pass_default, submit_url: response.data.submit_url, checkpointId:checkpointId, - exercisememoMDRefval:response.data.task_pass_default + exercisememoMDRefval:response.data.task_pass_default, + responsedata:response.data }) this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'') @@ -136,7 +137,8 @@ export default class TPMchallengesnew extends Component { 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 + exercisememoMDRefval:response.data.task_pass, + responsedata:response.data }) if(response.data.power===false){ this.props.showSnackbar("你没有权限修改"); @@ -241,7 +243,8 @@ export default class TPMchallengesnew extends Component { 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`; + // window.location.href=`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`; + this.props.history.replace(`/shixuns/${id}/challenges/${response.data.challenge_id}/tab=2`); // this.setState({ // setopen: true, // CreatePracticesendtype:false, @@ -363,13 +366,14 @@ export default class TPMchallengesnew extends Component { }).then((response) => { this.props.showSnackbar(response.data.messages); if (response.data.status === 1) { - window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`; + // 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", }) + this.props.history.replace(`/shixuns/${id}/challenges/${checkpointId}/tab=2`); // window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=2" } }).catch((error) => { @@ -401,7 +405,7 @@ export default class TPMchallengesnew extends Component { let shixuntype = this.props.match.params.type; - let {marktype, + let {responsedata, 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, @@ -417,69 +421,81 @@ export default class TPMchallengesnew extends Component { }) } + // console.log(this.props) + // console.log(this.state) + // console.log(responsedata) + return (
-
- - - - 第{position}关 - - 返回 - { next_challenge===undefined?"": - 下一关 - } - { prev_challenge===undefined?"": - 上一关 - } - - - - - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} - data-tip-down="新增代码编辑类型的任务">+ 实践类型 - - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} - data-tip-down="新增选择题类型的任务">+ 选择题类型 - +
+ + 第{position}关:{responsedata&&responsedata.st === 0 ?"实践题":"选择题"} + + {this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"": + } + + {this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"": + } + + {next_challenge===undefined?"": + } + {prev_challenge===undefined?"": + } + + {/*{ next_challenge===undefined?"":*/} + {/* 下一关*/} + {/*}*/} + {/*{ prev_challenge===undefined?"":*/} + {/* 上一关*/} + {/*}*/}
  • - 本关任务 + 1、本关任务
  • - {tab2url === "" ? 评测设置 : 评测设置} + {tab2url === "" ? : 2、评测设置}
  • - {tab3url === "" ? 参考答案 : 参考答案} + {tab3url === "" ? : 3、参考答案}
  • -
    -
    -

    任务名称

    -
    - * -
    - +
    +

    *名称

    +
    +
    + {/**/} + + value={shixunCreatePractice} + addonAfter={`${String(!shixunCreatePractice? 0 : shixunCreatePractice.length)}/${60}`} + />
    -
    - -

    过关任务

    - - +
    + +

    *过关任务

    + +

    -
    -

    难度系数

    -
    - - +
    +

    + * + 难度系数: + 简单 中等 困难 - -

    -

    奖励经验值

    +

    + {/*
    */} + + {/* */} + {/* 简单*/} + {/* 中等*/} + {/* 困难*/} + {/* */} + + {/*
    */} +

    * 奖励经验值: (如果学员答题正确,将获得相应的经验值;如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+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 {
    4||this.props.identity===undefined||this.props.power===false?"none":"block"}}> this.props.answer_subit()}>提交 - 取消 - + {/*取消*/} + 取消 this.delecbtns()} className="delectshixuncdbtn fr">删除
    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个字符;此信息将在实训发布后展示给学员,例:计算学生的课程成绩绩点"/>*/}
    -
    +
    必填项 + className={shixunCreatePracticetype === true ? "color-red mt8 fl block" : "color-red mt8 fl none"} + id="new_shixun_name">必填项:不能为空
    @@ -537,13 +562,17 @@ export default class TPMchallengesnew extends Component {

    * 难度系数: - 简单 中等 困难 + {this.state.shixunCreatePracticeGrouptype===true?

    + 必选项:不能为空
    :""}

    {/*
    */} @@ -560,7 +589,17 @@ export default class TPMchallengesnew extends Component {
    - */} - 必填项 + {this.state.onshixunsmarkvaluetype===true?
    + 必选项:不能为空
    :""}

    *技能标签: (学员答题正确将获得技能,否则不能获得技能)

    -
    +
    - {/*+ 添加*/} -
    (回车添加标签)
    +
    (回车添加标签)
    { shixunsskillvaluelist===undefined?"":shixunsskillvaluelist.length === 0 ? "" : shixunsskillvaluelist.map((itme, key) => { return ( -
  • {itme} - this.delshixunsskilllist(key)}>× -
  • +
  • + this.delshixunsskilllist(key)}> + + +
  • ) }) }
    - - 必填项 +
    必选项:不能为空
    -

    * 服务配置

    -
    - - -
    - +

    * 服务配置:评测时限(S)

    +
    +
    + {/**/} +
    - 必填项 -
    +
    必填项:不能为空
    @@ -641,10 +679,10 @@ export default class TPMchallengesnew extends Component { {/*提交}*/} {/*取消*/} {/*取消*/} - + onSubmits={checkpointId===undefined?()=>this.CreatePracticesend():()=>this.editPracticesend()} + loadings={CreatePracticesendtype===true?true:editPracticesendtype===true?true:false}/>
    } ) diff --git a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css index 8efbaabda..098f65a18 100644 --- a/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css +++ b/public/react/src/modules/tpm/challengesnew/css/TPMchallengesnew.css @@ -287,4 +287,8 @@ a{ } .mb10 { margin-bottom: 10px !important; +} + +.tpmpointer{ + cursor: pointer; } \ No newline at end of file diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 45a5f6cf5..894ec3841 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -402,7 +402,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;} From 72d8a630ac726f9d0e9cbd2e4db23579a53271ea 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 14:27:29 +0800 Subject: [PATCH 3/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 --- .../tpm/challengesnew/TPMchallengesnew.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index a715c914d..80344f5b5 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -426,6 +426,11 @@ export default class TPMchallengesnew extends Component { exec_time:e.target.value }) } + + gotocheckpoint=(url)=>{ + debugger + this.props.history.replace(url); + } render() { let shixuntype = this.props.match.params.type; @@ -469,14 +474,14 @@ export default class TPMchallengesnew extends Component { className="edu-default-btn edu-greenback-btn mr5" >新增选择题任务} - {next_challenge===undefined?"": - } - {prev_challenge===undefined?"": - } + {next_challenge===undefined?"": + } + {prev_challenge===undefined?"": + } {/*{ next_challenge===undefined?"":*/} {/* 下一关*/} From 5c258881103081452dc60f913de4d9100f23266e 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 19:29:15 +0800 Subject: [PATCH 4/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/TPMBanner.js | 39 +- public/react/src/modules/tpm/TPMIndex.js | 1 - public/react/src/modules/tpm/TPMIndexHOC.js | 6 +- .../tpm/challengesnew/TPMchallengesnew.js | 254 ++++---- .../tpm/challengesnew/TPMevaluation.js | 555 +++++++----------- .../challengesnew/css/TPMchallengesnew.css | 24 + .../tpm/challengesnew/{ => old}/TPManswer.js | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 9 files changed, 409 insertions(+), 476 deletions(-) rename public/react/src/modules/tpm/challengesnew/{ => old}/TPManswer.js (99%) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 7a72655ad..3b837aea0 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -399,7 +399,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin- /*新建任务*/ .challenge_nav{padding: 20px 20px 0px 20px;border-bottom: 1px solid #eee;} .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.active:after{position: absolute;content: '';width: 76%;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/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 14981c363..f79301be0 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -130,16 +130,19 @@ class TPMBanner extends Component { if(this.props.status===0&&this.props.openknows===false){ if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){ - if(shixunopenprocess===undefined||shixunopenprocess===false||shixunopenprocess===null){ - this.setState({ - openknow:true - }) - }else{ - this.setState({ - openknow:false - }) + if(this.props.user&&this.props.user.user_id){ + if(shixunopenprocess===undefined||shixunopenprocess===false||shixunopenprocess===null){ + this.setState({ + openknow:true + }) + }else{ + this.setState({ + openknow:false + }) + } } - } + } + }else{ this.setState({ openknow:false @@ -150,14 +153,16 @@ class TPMBanner extends Component { if(this.props.public===0&&this.props.status>1&&this.props.openknows===false){ if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 2 && this.props.shixunsDetails&&this.props.shixunsDetails.public===0 && this.props.identity < 5){ - if(openopenpublictype===undefined||openopenpublictype===false||openopenpublictype===null){ - this.setState({ - openshowpublictype:true - }) - }else{ - this.setState({ - openshowpublictype:false - }) + if(this.props.user&&this.props.user.user_id) { + if (openopenpublictype === undefined || openopenpublictype === false || openopenpublictype === null) { + this.setState({ + openshowpublictype: true + }) + } else { + this.setState({ + openshowpublictype: false + }) + } } } }else{ diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index b4bd05417..86d0e9637 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -389,7 +389,6 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; - console.log(this.state.openknows) return (
    {/*头部*/} diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 3ad58cf81..01d617c78 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) { // $('head').append($('') // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`)); + .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?2020`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?2020`)); // index.html有加载 $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?2020`)); // $('head').append($('') diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index 80344f5b5..580e43792 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -53,8 +53,7 @@ export default class TPMchallengesnew extends Component { } } - - componentDidMount() { + getdatas=()=>{ let id = this.props.match.params.shixunId; let checkpointId=this.props.match.params.checkpointId; @@ -73,11 +72,11 @@ export default class TPMchallengesnew extends Component { task_pass_default: response.data.task_pass_default, submit_url: response.data.submit_url, checkpointId:checkpointId, - exercisememoMDRefval:response.data.task_pass_default, + exercisememoMDRefval:response.data.task_pass_default, responsedata:response.data }) - this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'') + this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'') }).catch((error) => { console.log(error) }); @@ -124,17 +123,18 @@ 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", - exercisememoMDRefval:response.data.task_pass, + exercisememoMDRefval:response.data.task_pass, responsedata:response.data }) + // exec_time:response.data.exec_time, if(response.data.power===false){ - this.props.showSnackbar("你没有权限修改"); + this.props.showNotification("你没有权限修改"); + } - this.exercisememoMDRef.current.setValue(response.data.task_pass||'') + this.exercisememoMDRef.current.setValue(response.data.task_pass||'') }).catch((error) => { console.log(error) }); @@ -142,8 +142,24 @@ export default class TPMchallengesnew extends Component { } } + componentDidUpdate=(prevProps, prevState)=>{ + if(prevProps!=this.props){ + this.getdatas() + } + } + componentDidMount() { + this.getdatas() + } onshixunCreatePracticeChange = (e) => { + if(e.target.value===undefined||e.target.value=== ""||e.target.value=== null){ + + }else{ + this.setState({ + shixunCreatePracticeGrouptype:false, + onshixunsmarkvaluetype:false + }) + } let optionsum; let onshixunsmark; if(e.target.value===1){ @@ -164,9 +180,18 @@ export default class TPMchallengesnew extends Component { } shixunCreatePractice = (e) => { + + if (e.target.value === undefined|| e.target.value== ""){ + + }else{ + this.setState({ + shixunCreatePracticetype:false + }) + } this.setState({ shixunCreatePractice: e.target.value }) + } CreatePracticesend = () => { @@ -177,28 +202,41 @@ export default class TPMchallengesnew extends Component { }) if(this.props.status===2){ - this.props.showSnackbar("该实训已经发布不能新建") + this.props.showNotification("该实训已经发布不能新建") this.setState({ CreatePracticesendtype:false }) return } let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,exec_time} = this.state; + + if (shixunCreatePractice === undefined||shixunCreatePractice=="") { this.setState({ shixunCreatePracticetype: true, + CreatePracticesendtype:false }) - // this.props.showSnackbar("任务名称为空") + $('html').animate({ scrollTop: 10 }, 1000); - this.setState({ - CreatePracticesendtype:false - }) return } + if (shixunCreatePractice.match(/^[ ]*$/)) { + this.props.showNotification("任务名称为空,请勿输入空格"); + this.setState({ + shixunCreatePracticetype: true, + CreatePracticesendtype:false + }) + $('html').animate({ + scrollTop: 10 + }, 1000); + return + } + + if(shixunCreatePracticeGroup===undefined){ this.setState({ shixunCreatePracticeGrouptype:true, @@ -221,24 +259,35 @@ export default class TPMchallengesnew extends Component { shixunsskillvaluelisttype: true, CreatePracticesendtype:false }) - // this.props.showSnackbar("技能标签为空") + // this.props.showNotification("技能标签为空") this.props.scrollToAnchor("input_task_tag"); return } - if(exec_time===null||exec_time===undefined||exec_time === ""){ - this.setState({ - shixunExec_timeType:true, - CreatePracticesendtype:false - }) - return - } + // if(exec_time===null||exec_time===undefined||exec_time === ""){ + // this.setState({ + // shixunExec_timeType:true, + // CreatePracticesendtype:false + // }) + // this.props.scrollToAnchor("exec_time"); + // return + // } + + // if (exec_time.match(/^[ ]*$/)) { + // this.props.showNotification("评测时限,请勿输入空格"); + // this.setState({ + // shixunExec_timeType:true, + // CreatePracticesendtype:false + // }) + // this.props.scrollToAnchor("exec_time"); + // return + // } const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim(); let id = this.props.match.params.shixunId; let url = "/shixuns/" + id + "/challenges.json"; - + // exec_time:exec_time axios.post(url, { identifier:id, subject: shixunCreatePractice, @@ -247,7 +296,6 @@ export default class TPMchallengesnew extends Component { score: onshixunsmarkvalue, challenge_tag: shixunsskillvaluelist, st: 0, - exec_time:exec_time }).then((response) => { if (response.data.status === 1) { // $("html").animate({ scrollTop: 0 }) @@ -262,7 +310,7 @@ export default class TPMchallengesnew extends Component { // }) } - // this.props.showSnackbar(response.data.messages); + // this.props.showNotification(response.data.messages); }).catch((error) => { console.log(error) }); @@ -299,6 +347,12 @@ export default class TPMchallengesnew extends Component { let list = shixunsskillvaluelist; list.push(shixunsskillvalue); + + if (list.length> 0) { + this.setState({ + shixunsskillvaluelisttype: false, + }) + } this.setState({ shixunsskillvaluelist: list, shixunsskillvalue: "" @@ -328,19 +382,32 @@ export default class TPMchallengesnew extends Component { let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; + if (shixunCreatePractice === undefined||shixunCreatePractice=="") { - // this.setState({ - // shixunCreatePracticetype: true - // }) - this.props.showSnackbar("任务名称为空") + this.setState({ + shixunCreatePracticetype: true, + editPracticesendtype:false + }) + // this.props.showNotification("任务名称为空") $('html').animate({ scrollTop: 10 }, 1000); + + return + } + + if (shixunCreatePractice.match(/^[ ]*$/)) { + this.props.showNotification("任务名称为空,请勿输入空格"); this.setState({ - editPracticesendtype:false + shixunCreatePracticetype: true, + editPracticesendtype:false }) + $('html').animate({ + scrollTop: 10 + }, 1000); return } + if(shixunCreatePracticeGroup===undefined){ this.setState({ shixunCreatePracticeGrouptype:true, @@ -359,24 +426,33 @@ export default class TPMchallengesnew extends Component { } if (shixunsskillvaluelist.length === 0) { - // this.setState({ - // shixunsskillvaluelisttype: true - // }) - // this.props.showSnackbar("技能标签为空") - this.props.scrollToAnchor("input_task_tag"); this.setState({ - editPracticesendtype:false, + shixunsskillvaluelisttype: true, + editPracticesendtype:false, }) + this.props.scrollToAnchor("input_task_tag"); return } - if(exec_time===null||exec_time===undefined||exec_time === ""){ - this.setState({ - shixunExec_timeType:true, - editPracticesendtype:false - }) - return - } + // if(exec_time===null||exec_time===undefined||exec_time === ""){ + // this.setState({ + // shixunExec_timeType:true, + // editPracticesendtype:false + // }) + // this.props.scrollToAnchor("exec_time"); + // return + // } + + // if (exec_time.match(/^[ ]*$/)) { + // this.props.showNotification("评测时限,请勿输入空格"); + // this.setState({ + // shixunExec_timeType:true, + // editPracticesendtype:false + // }) + // this.props.scrollToAnchor("exec_time"); + // return + // } + // exec_time:exec_time axios.put(url, { tab:0, identifier:id, @@ -386,11 +462,10 @@ export default class TPMchallengesnew extends Component { task_pass: exercise_editormdvalue, difficulty: shixunCreatePracticeGroup, score: onshixunsmarkvalue, - exec_time:exec_time }, challenge_tag:shixunsskillvaluelist }).then((response) => { - this.props.showSnackbar(response.data.messages); + this.props.showNotification(response.data.messages); if (response.data.status === 1) { // window.location.href=`/shixuns/${id}/challenges/${checkpointId}/tab=2`; this.setState({ @@ -428,7 +503,6 @@ export default class TPMchallengesnew extends Component { } gotocheckpoint=(url)=>{ - debugger this.props.history.replace(url); } render() { @@ -454,26 +528,21 @@ export default class TPMchallengesnew extends Component { // console.log(this.props) // console.log(this.state) - // console.log(responsedata) + //a console.log(shixunCreatePractice) return (
    - 第{position}关:{responsedata&&responsedata.st === 0 ?"实践题":"选择题"} - - {this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"": + {this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"": } - + >新增实践任务} {this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"": } - {next_challenge===undefined?"": } - - {/*{ next_challenge===undefined?"":*/} - {/* 下一关*/} - {/*}*/} - {/*{ prev_challenge===undefined?"":*/} - {/* 上一关*/} - {/*}*/}
    @@ -503,23 +565,14 @@ export default class TPMchallengesnew extends Component { {tab3url === "" ? "":
  • >
  • }
  • {tab3url === "" ? : 3、参考答案} -
  • -

    *名称

    +

    *名称

    - {/**/}
    - 必填项:不能为空 + 必填项:不能为空
    @@ -540,7 +591,7 @@ export default class TPMchallengesnew extends Component {
    -

    *过关任务

    +

    *过关任务

    + + {this.state.tpmcourseMessageMDType===true?
    必填项:不能为空
    :""}
    diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js index af80c8410..7ff0942cc 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js +++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js @@ -153,7 +153,7 @@ export default class TPMevaluation extends Component { addevaluationon=()=>{ let {evaluationlist,markvalue}=this.state; let newevaluationlist=evaluationlist; - newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + newevaluationlist.push({hidden:0,input:"",output:"",score:0,match_rule:"full"}); newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); this.setevaluationlist(newevaluationlist); } From fa7e7426aabf25c16bb6ee3600bec366db73a90c Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 27 Dec 2019 18:51:29 +0800 Subject: [PATCH 7/8] update style --- .../studentStudy/leftpane/taskDescription/index.js | 10 ++++++---- public/react/src/redux/actions/ojForm.js | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js b/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js index f99d59092..ebc42b9a4 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 09:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-25 14:50:37 + * @LastEditTime : 2019-12-27 18:42:59 */ import '../index.scss'; import React from 'react'; @@ -18,7 +18,7 @@ const {tagBackground, diffText} = CONST; const TaskDescription = (props) => { - const { hack = {} } = props; + const { hack = {}, userInfo = {} } = props; const {language, difficult, time_limit, username, description} = hack; return (
    @@ -37,7 +37,7 @@ const TaskDescription = (props) => {

    出题者: - {username} + {username}

    @@ -52,8 +52,10 @@ const TaskDescription = (props) => { const mapStateToProps = (state) => { const { hack } = state.ojForUserReducer; + const { userInfo } = state.userReducer; return { - hack + hack, + userInfo } } diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 9cd4e8228..094257f42 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 14:18:02 + * @LastEditTime : 2019-12-27 18:50:22 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -297,6 +297,9 @@ export const validateOjForm = (props, type, cb) => { type: types.SAVE_OJ_FORM_ID, payload: identifier }); + if (paramsObj['submitType'] === 'add' && identifier) { + props.history.push(`/problems/${identifier}/edit`) + }; } // 保存或更新后,调用start接口 // linkToDev(dispatch, props); From a298e38eb89a93378e5e0774dcba92aa48bc3983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 27 Dec 2019 18:53:53 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=B0=83=E6=95=B4jupyter=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 34 +++++++++++-------- .../react/src/modules/tpm/jupyter/index.scss | 6 ++++ .../src/redux/reducers/jupyterReducer.js | 6 +++- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 25f82ef94..702ae2b71 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -279,9 +279,13 @@ function JupyterTPI (props) { }; // 分页处理 - const handleChangePage = (page) => { - - handlePageChange(page); + const handleChangePage = (e) => { + //滑动到底判断 + let newscrollTop=parseInt(e.currentTarget.scrollTop); + let allclientHeight=e.currentTarget.clientHeight+newscrollTop; + if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ + handlePageChange(pagination.page+1); + } } // const listCtx = ; useEffect(() => { @@ -310,7 +314,7 @@ function JupyterTPI (props) { }); const oUl = ( -
      +
        handleChangePage(event)} > { oList }
      ); @@ -420,18 +424,18 @@ function JupyterTPI (props) {
    - { renderCtx } -
    - {total<20?"":} -
    - + { renderCtx } + {/*
    */} + {/* {total<20?"":}*/} + {/*
    */}
    +
    diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss index e6a95406a..57f833437 100644 --- a/public/react/src/modules/tpm/jupyter/index.scss +++ b/public/react/src/modules/tpm/jupyter/index.scss @@ -124,11 +124,17 @@ padding: 0px; } .ant-drawer-wrapper-body{ + overflow: hidden !important; padding-top: 60px; background: #070F1A; padding-bottom: 40px; } + .jupyter_data_list{ + height:500px; + overflow: auto; + } + .ant-pagination{ color:#fff !important; } diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js index 75c9d374f..4b117b453 100644 --- a/public/react/src/redux/reducers/jupyterReducer.js +++ b/public/react/src/redux/reducers/jupyterReducer.js @@ -26,9 +26,13 @@ const JupyterReducer = (state = initState, action) => { switch (action.type) { case types.GET_JUPYTER_DATA_SETS: const { data_sets, data_sets_count,folder_name} = action.payload; + let newjupyter_data_set=state.jupyter_data_set; + data_sets.map((item,key)=>{ + newjupyter_data_set.push(item) + }) return { ...state, - jupyter_data_set: data_sets, + jupyter_data_set: newjupyter_data_set, jupyter_data_set_count: data_sets_count, jupyter_folder_name:folder_name, }