From b40f9626f54a6cf7ff82bf819eed852c7d3d40bc 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, 26 Dec 2019 16:20:21 +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 --- public/react/src/modules/question/Question.js | 33 +++++- .../modules/question/component/Contentpart.js | 2 +- .../question/component/Headplugselection.js | 101 +++++++++++++----- .../question/questioncss/questioncom.css | 8 ++ 4 files changed, 115 insertions(+), 29 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 5d199963d..2ddb264a6 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -54,9 +54,31 @@ class Question extends Component { page:1, per_page:20, disciplinesdata:[], + discipline_id:null, + sub_discipline_id:null, + tag_discipline_id:null, } } + setdiscipline_id=(discipline_id)=>{ + this.setState({ + discipline_id:discipline_id + }) + + } + + setsub_discipline_id=(sub_discipline_id)=>{ + this.setState({ + sub_discipline_id:sub_discipline_id + }) + + } + + settag_discipline_id=(tag_discipline_id)=>{ + this.setState({ + tag_discipline_id:tag_discipline_id + }) + } //初始化 componentDidMount() { @@ -563,7 +585,12 @@ class Question extends Component { showDrawer={() => this.showDrawer()} Headertop={Headertop}/> {/*顶部*/} - + this.setdiscipline_id(e)} + setsub_discipline_id={(e)=>this.setsub_discipline_id(e)} + settag_discipline_id={(e)=>this.settag_discipline_id(e)} + + > {/*头部*/} this.getitem_basketss(id)} @@ -589,7 +616,9 @@ class Question extends Component { pageSize={per_page} total={items_count}> - :"" + :
+ +
} diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index d89a03d5b..74771c0bd 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -69,7 +69,7 @@ class Contentpart extends Component { //console.log("Contentpart"); //console.log(this.props); return ( -
+
{ +// +// setdiscipline_id={(e)=>this.setdiscipline_id(e)} +// setsub_discipline_id={(e)=>this.setsub_discipline_id(e)} +// settag_discipline_id={(e)=>this.settag_discipline_id(e)} + settitlestting=(name,id)=>{ //如果全部其他的选项重置 this.setState({ titlestting:name, + titlesttingid:id, titlesttings:null, - titlesttingss:null + titlesttingsid:null, + titlesttingss:null, + titlesttingssid:null }) + if(name==="全部"){ + this.props.setdiscipline_id(null); + this.props.setsub_discipline_id(null); + this.props.settag_discipline_id(null); + }else{ + this.props.setdiscipline_id(id); + this.props.setsub_discipline_id(null); + this.props.settag_discipline_id(null); + } + + + } - settitlesttings=(name)=>{ + settitlesttings=(name,id)=>{ //课程选项 this.setState({ titlesttings:name, + titlesttingsid:id, titlesttingss:null, }) + this.props.setsub_discipline_id(id); + this.props.settag_discipline_id(null); } - settitlesttingss=(name)=>{ + settitlesttingss=(name,id)=>{ //知识点 + if(this.state.titlesttings===null){ + this.props.showNotification('请先选择课程'); + + } this.setState({ - titlesttingss:name + titlesttingss:name, + titlesttingssid:id }) + this.props.settag_discipline_id(id); + } render() { @@ -53,22 +84,22 @@ class Headplugselection extends Component { // console.log("Headplugselection"); // console.log(this.props.disciplinesdata); return ( -
+
-
+
{/*课程*/}
方向:
-
this.settitlestting("全部")}> +
this.settitlestting("全部",null)}> 全部
{this.props.disciplinesdata&&this.props.disciplinesdata.map((object, index) => { return ( -
this.settitlestting(object.name)}> +
this.settitlestting(object.name,object.id)}> {object.name}
) @@ -93,7 +124,7 @@ class Headplugselection extends Component { return (
this.settitlesttings(object.name)}> + :titlesttings===object.name?" titlesttingcss xiaoshou":"titlesttingcssmy xiaoshou"} onClick={()=>this.settitlesttings(object.name,object.id)}> {object.name}
) @@ -104,7 +135,7 @@ class Headplugselection extends Component { return (
this.settitlesttings(object.name)}> + :titlesttings===object.name?" titlesttingcss xiaoshou":"titlesttingcssmy xiaoshou"} onClick={()=>this.settitlesttings(object.name,object.id)}> {object.name}
) @@ -162,22 +193,40 @@ class Headplugselection extends Component { }):"" ) }) - : - objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => { - return ( - titlesttings===objectb.name? - objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => { - return ( -
this.settitlesttingss(object.name)}> - {object.name} -
- ) - }) + : titlestting!=="全部"&&titlesttings!==null? + titlestting===objecta.name? + objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => { + return ( + titlesttings===objectb.name? + objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => { + return ( +
this.settitlesttingss(object.name)}> + {object.name} +
+ ) + }):"" + ) + }) :"" - ) - }) + : titlestting!=="全部"&&titlesttings===null? + titlestting===objecta.name? + objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => { + return ( + objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => { + return ( +
this.settitlesttingss(object.name)}> + {object.name} +
+ ) + }) + ) + }) + :"" + :"" ) })} diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 6120a6fdc..73acb3eb5 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -111,6 +111,11 @@ padding-left: 26px; padding-right: 26px; } +.tophoms{ + padding-top: 15px; + padding-left: 26px; + padding-right: 26px; +} .borderwd{ border: 1px solid #000000; } @@ -589,3 +594,6 @@ width: 60px !important; } +.h30{ + min-height: 30px !important; +}