From 3ac3698caaf93abb89feb35ce45d11c3426e44ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 3 Jan 2020 17:42:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/question/Questionitem_banks.js | 14 +++++++--- .../question/component/Itembankstop.js | 26 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index 3608b7ad0..d6962069c 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -220,7 +220,6 @@ class Questionitem_banks extends Component { // "编辑" } - if(this.state.item_type !== "PROGRAM"){ if (this.contentMdRef.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return; @@ -230,7 +229,6 @@ class Questionitem_banks extends Component { if (this.state.item_type === null) { return } - } if (this.state.item_type === "SINGLE") { @@ -451,8 +449,18 @@ class Questionitem_banks extends Component { } if (this.state.item_type === "PROGRAM") { //编程题 跳转到 oj 中创建 - this.props.history.replace('/problems/new'); + var myrbkc=[]; + var Getdatasdatas=Getdatasdata[2].rbzsd; + for(let myda of Getdatasdatas) { + myrbkc.push(myda.id); + } + this.props.setOjInitialValue({ + difficult: Getdatasdata[0].rbnd, + sub_discipline_id: Getdatasdata[3].rbkc[1], + tag_discipline_id: myrbkc, + }); + this.props.history.replace('/problems/new'); } diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index 6b5d87b31..bb847a118 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -238,6 +238,11 @@ class Itembankstop extends Component { //课程 ////console.log("课程"); ////console.log(value); + // console.log("handleFormkechen"); + if(this.state.Knowpoints.length>4){ + this.props.showNotification(`知识点最多选择5个`); + return + } var valuename = undefined; this.props.form.setFieldsValue({ rbzsd: value, @@ -384,9 +389,11 @@ class Itembankstop extends Component { NewknTypedel:bool }) + } NewknTypedeltyoedel=(value)=>{ + if(value===null||value===""){ this.props.showNotification(`请输入知识点`); return @@ -396,15 +403,28 @@ class Itembankstop extends Component { this.props.showNotification(`请输入知识点`); return } + + if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){ + this.props.showNotification(`请选择课程方向`); + return; + } var data={ - name:"", - sub_discipline_id:"" + name:value, + sub_discipline_id:this.state.rbkc[1] } const url="/tag_disciplines.json"; axios.post(url,data) .then((result) => { - if (result.data.status == 0) { + if (result.data.status === 0) { this.props.showNotification(`新增知识点成功!`); + var leydata={ + id: result.data.tag_discipline_id, + name:value, + } + this.state.knowledgepoints.push(leydata); + this.setState({ + knowledgepoints:this.state.knowledgepoints + }) } }).catch((error) => { //console.log(error);