From e80f11ccf0bae136a2fc40e0483ce1c416d72cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 8 Jan 2020 20:15:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/SingleEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 0b0a8b5f7..fa20afb83 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -410,7 +410,7 @@ class SingleEditor extends Component{ {/* */} this.onOptionClick(index)} style={{flex: '0 0 38px'}}> - +
{tagArray[index]}
From e98c3350ad9ad7dcebf8b1413b62b157dea61cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 09:30:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 16 ++- .../modules/question/component/Contentpart.js | 44 ++++++- .../question/component/Headplugselections.js | 2 +- .../question/component/Itembankstop.js | 119 +++++++++++++++++- .../question/component/Newknledpots.js | 25 +++- .../question/component/SingleEditor.js | 17 +-- .../question/questioncss/questioncom.css | 9 +- 7 files changed, 204 insertions(+), 28 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 1dc35ef4c..e3bb1b268 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -134,23 +134,21 @@ class ChoquesEditor extends Component{ this.props.showNotification('请您输入题干'); return editordata; } + + for(let i = 0; i < question_choices.length; i++) { + if (!question_choices[i]) { + this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); + return editordata; + } + } if(!answerArray || answerArray.length == 0) { this.props.showNotification('请先点击选择本选择题的正确选项'); return editordata; } - if(!answerArray || answerArray.length < 2) { this.props.showNotification('多选题最小正确选项为2个'); return editordata; } - - for(let i = 0; i < question_choices.length; i++) { - if (!question_choices[i]) { - this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); - return editordata; - } - } - if(!question_titlesysl) { this.props.showNotification('请您输入题目解析'); return editordata; diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index d92a1e8e7..da85ce0f7 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -37,6 +37,48 @@ class Contentpart extends Component { this.props.chakanjiexibool(index); } + xinzenw=(e)=>{ + var urls="?"; + if(this.props.discipline_id){ + if(urls==="?"){ + urls=urls+`discipline_id=${this.props.discipline_id}` + }else { + urls=urls+`&discipline_id=${this.props.discipline_id}` + } + } + if(this.props.sub_discipline_id){ + if(urls==="?"){ + urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}` + }else { + urls=urls+`&sub_discipline_id=${this.props.sub_discipline_id}` + } + } + if(this.props.tag_discipline_id){ + if(urls==="?"){ + urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}` + }else { + urls=urls+`&sub_discipline_id=${this.props.tag_discipline_id}` + } + } + if(this.props.difficulty){ + if(urls==="?"){ + urls=urls+`difficulty=${this.props.difficulty}&` + }else { + urls=urls+`&difficulty=${this.props.difficulty}` + } + } + if(this.props.item_type){ + if(urls==="?"){ + urls=urls+`item_type=${this.props.item_type}` + }else { + urls=urls+`&item_type=${this.props.item_type}` + } + + } + + + this.props.history.push("/question/newitem"+urls); + } render() { let {page}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; @@ -139,7 +181,7 @@ class Contentpart extends Component {
{ defaultActiveKey===0||defaultActiveKey==="0"? - + this.xinzenw(e)}>

新增

diff --git a/public/react/src/modules/question/component/Headplugselections.js b/public/react/src/modules/question/component/Headplugselections.js index 3cff40cc2..206b556e9 100644 --- a/public/react/src/modules/question/component/Headplugselections.js +++ b/public/react/src/modules/question/component/Headplugselections.js @@ -153,7 +153,7 @@ class Headplugselections extends Component { { item&&item.map((list,k)=>{ return( - +
this.getshixunchildValue(list.id,id)}>{list.name}
diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index 581baf844..576dbb42d 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -19,6 +19,8 @@ import './../questioncss/questioncom.css'; import Newknledpots from './Newknledpots' const InputGroup = Input.Group; const {Option} = Select; +const queryString = require('query-string'); + const options = [ { value: '方向', @@ -59,6 +61,8 @@ class Itembankstop extends Component { //初始化 componentDidMount() { + + try { this.props.getcontentMdRef(this); } catch (e) { @@ -68,7 +72,53 @@ class Itembankstop extends Component { options: this.props.disciplmy, }) + console.log("数据"); + console.log(this.props); + const parsed = queryString.parse(this.props.location.search); + console.log(parsed); + try { + if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){ + + }else { + if(parsed.discipline_id){ + if(parsed.sub_discipline_id){ + this.setState({ + rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)] + }) + this.props.form.setFieldsValue({ + rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)], + }); + this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)); + + } + + } + if(parsed.item_type){ + this.setState({ + rbtx:parsed.item_type, + }) + this.props.form.setFieldsValue({ + rbtx:parsed.item_type, + }); + this.props.setitem_type(parsed.item_type); + } + + if(parsed.difficulty){ + this.setState({ + rbnd:parsed.difficulty, + }) + this.props.form.setFieldsValue({ + rbnd:parsed.difficulty, + }); + } + + + } + + }catch (e) { + + } } componentDidUpdate(prevProps) { @@ -79,6 +129,7 @@ class Itembankstop extends Component { }) } if(prevProps.disciplinesdata!== this.props.disciplinesdata){ + console.log("新增开始加载了") try { if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){ const didata = this.props.disciplinesdata; @@ -110,6 +161,27 @@ class Itembankstop extends Component { knowledgepoints2: _result, }) } + + + try { + const parsed = queryString.parse(this.props.location.search); + if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){ + + }else { + if(parsed.discipline_id){ + if(parsed.sub_discipline_id){ + this.setState({ + rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)] + }) + this.props.form.setFieldsValue({ + rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)], + }); + this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)); + } + } + } + }catch (e) { + } }catch (e) { } } @@ -125,6 +197,7 @@ class Itembankstop extends Component { this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines); } try { + //初始化课程 this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline); }catch (e) { @@ -175,7 +248,42 @@ class Itembankstop extends Component { } } } + getdatasmyss=(id,ids)=>{ + if(this.props.disciplinesdata){ + try { + if(id &&ids){ + var didata = this.props.disciplinesdata; + var knowledgepointsdata = []; + for (var i = 0; i < didata.length; i++) { + //方向 + if (id === didata[i].id) { + const fxdidata = didata[i].sub_disciplines; + for (var j = 0; j < fxdidata.length; j++) { + //课程 + if (ids === fxdidata[j].id) { + const zsddata = fxdidata[j].tag_disciplines; + for (var k = 0; k < zsddata.length; k++) { + //知识点 + knowledgepointsdata.push(zsddata[k]); + } + } + } + } + } + + + this.setState({ + knowledgepoints:knowledgepointsdata, + knowledgepoints2: knowledgepointsdata, + }) + }else{ + } + }catch (e) { + + } + } + } handdisciplinesChange =(name,title)=>{ this.setState({ rbkc:[name.id,title.id] @@ -476,6 +584,11 @@ class Itembankstop extends Component { let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state; const {getFieldDecorator} = this.props.form; + console.log("this.state.rbkc"); + console.log(this.state.rbkc); + console.log(options); + + return (
@@ -555,15 +668,15 @@ class Itembankstop extends Component { this.NewknTypedeldel(true)}/> -
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => { return ( -

{object.name}

diff --git a/public/react/src/modules/question/component/Newknledpots.js b/public/react/src/modules/question/component/Newknledpots.js index a097b7d79..06d5b8ea0 100644 --- a/public/react/src/modules/question/component/Newknledpots.js +++ b/public/react/src/modules/question/component/Newknledpots.js @@ -14,10 +14,27 @@ class PaperDeletModel extends Component { } handleChange=(e)=>{ - this.setState({ - newkntypeinput: e.target.value - }) + // this.setState({ + // newkntypeinput: e.target.value + // }) + // console.log(e.target.value); + // console.log(e.target.value.length); + this.setState({ + newkntypeinput: e.target.value + }) + // + // debugger + // console.log(e); + // + // if(e.target.value.length>0){ + // if(e.target.value.length>=16){ + // var result = e.target.value.substring(0,15); + // this.setState({ + // newkntypeinput: result + // }) + // } + // } } render() { @@ -35,7 +52,7 @@ class PaperDeletModel extends Component { >
- +
this.props.NewknTypedeldel(false)}>取消 diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index fa20afb83..36ab30ab8 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -141,13 +141,6 @@ class SingleEditor extends Component{ this.props.showNotification('请您输入题干'); return editordata; } - - if(!answerArray || answerArray.length == 0) { - this.props.showNotification('请先点击选择本选择题的正确选项'); - return editordata; - } - - for(let i = 0; i < question_choices.length; i++) { if (!question_choices[i]) { // this.refs[`optionEditor${i}`].showError() @@ -156,6 +149,14 @@ class SingleEditor extends Component{ } } + if(!answerArray || answerArray.length == 0) { + this.props.showNotification('请先点击选择本选择题的正确选项'); + return editordata; + } + + + + if(!question_titlesysl) { this.props.showNotification('请您输入题目解析'); return editordata; @@ -328,7 +329,7 @@ class SingleEditor extends Component{ texts=value; } this.setState({ - question_titleysl:texts + question_titlesysl:texts }) } } diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 153e94f20..0326f25fd 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -524,7 +524,7 @@ margin-top: 19px; } .mytags{ - width:106px; + min-width:106px; height:32px; border-radius:2px; border:1px solid #DDDDDD; @@ -955,4 +955,9 @@ padding: 0px !important; } - +.huanhan{ + flex-wrap: wrap; +} +.mb20{ + margin-bottom: 20px; +} From 5bc401236cd2727047bd5b48dec1000e343b905f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 09:50:30 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=9A=84=20=E4=B8=8A=E4=BC=A0=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/ChoquesEditor.js | 4 ++++ .../react/src/modules/question/component/JudquestionEditor.js | 2 ++ public/react/src/modules/question/component/Listjihe.js | 1 + public/react/src/modules/question/component/SingleEditor.js | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index e3bb1b268..383ad1a86 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -365,6 +365,7 @@ class ChoquesEditor extends Component{

:
0? diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 36ab30ab8..cdb2ef9b6 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -389,6 +389,7 @@ class SingleEditor extends Component{

:
Date: Thu, 9 Jan 2020 10:08:32 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=A2=98=E7=9B=AE=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 8 ++-- .../question/component/Itembankstop.js | 42 +++++++++++++------ .../question/component/JudquestionEditor.js | 10 ++--- .../question/component/SingleEditor.js | 8 ++-- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 383ad1a86..e1b1183f0 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -149,10 +149,10 @@ class ChoquesEditor extends Component{ this.props.showNotification('多选题最小正确选项为2个'); return editordata; } - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?", diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index 576dbb42d..c0cf0055b 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -556,19 +556,37 @@ class Itembankstop extends Component { id: result.data.tag_discipline_id, name:value, } - this.state.knowledgepoints.push(leydata); - const _result =[]; - this.state.knowledgepoints.filter(item => { - if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { - _result.push(item); - } - }); - this.setState({ - Knowpoints: this.state.Knowpoints, - knowledgepoints: this.state.knowledgepoints, - knowledgepoints2: _result, - }) + if(this.state.Knowpoints.length>=5){ + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + }else{ + this.state.Knowpoints.push(leydata); + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + } + } }).catch((error) => { //console.log(error); diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 951b37894..56c1f5017 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -119,11 +119,11 @@ class JudquestionEditor extends Component{ - - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?", diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index cdb2ef9b6..f050488bf 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -157,10 +157,10 @@ class SingleEditor extends Component{ - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?",