From 8ec3869815e8bf7c2f397d0e6bf6233964344e0c 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, 19 Jul 2019 20:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 8 ++- public/react/src/modules/tpm/NewHeader.js | 5 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 6 +- public/react/src/search/SearchPage.js | 55 ++++++++++++++----- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 293d1baca..b7658450a 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -333,7 +333,13 @@ class App extends Component { {/*实训课程(原实训路径)*/} - + + () + } + > + {/*课堂*/} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3ea3c493c..43152a074 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -384,7 +384,7 @@ class NewHeader extends Component { } onKeywordSearchKeyDown = (e) => { - window.location.href ="/search"+"?value="+e.target.value; + window.location.href ="/search?value="+e.target.value; // let code = e.keyCode; // if(code == 13) { @@ -709,6 +709,7 @@ submittojoinclass=(value)=>{ console.log(value)} + onPressEnter={this.onKeywordSearchKeyDown} style={{ width: 258 }} /> @@ -791,6 +792,8 @@ submittojoinclass=(value)=>{ + {console.log(this.props)} + {console.log(this.state)} 新建课堂 新建实训 新建实践课程 diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index a7d48cb67..192bfdd8b 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -502,6 +502,8 @@ class Newshixuns extends Component { } sendsure_apply = () => { let {languagewrite,systemenvironment,testcoderunmode} = this.state; + + debugger // console.log("点击确定") // console.log("languagewrite"+languagewrite); // console.log("systemenvironment"+systemenvironment); @@ -987,14 +989,14 @@ class Newshixuns extends Component { { deleteisnot=== true? - + 上传附件 (单个文件50M以内) : - + 上传附件 (单个文件50M以内) diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index d2eb5ef93..5b1ae7f64 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -15,27 +15,28 @@ class SearchPage extends Component{ this.state={ tab:"0", count:0, - keywords:"", - type:"", + keywords:undefined, + type:"shixun", page:1, perpages:20, data:[], + } } //切换tab changeTab=(e)=>{ - console.log(e.key); - let types =""; + + let types =""; if(parseInt(e.key)===0){ - types="course"; + types="shixun"; } if(parseInt(e.key)===1){ - types="shixun"; + types="subject"; } if(parseInt(e.key)===2){ - types="subject"; + types="course"; } if(parseInt(e.key)===3){ @@ -59,16 +60,27 @@ class SearchPage extends Component{ // this.setState({ // tab:sum, // }) - let courstype=this.props.match.url; + let courstype=decodeURI(decodeURI(this.props.location.search)); courstype = courstype.split('?value='); - console.log(courstype); - this.getdata(this.state.page,this.state.type,this.state.keywords); + this.setState({ + keywords:courstype[1] + }) + this.getdata(this.state.page,this.state.type,courstype[1]); + + } + + setdatafunsval=(e)=>{ + this.setState({ + keywords:e.target.value + }) } + setdatafuns =(value)=>{ this.setState({ keywords:value }) + this.props.history.replace(`/search?value=${value}`) this.getdata(this.state.page,this.state.type,value); } paginationonChanges = (pageNumber) => { @@ -92,21 +104,22 @@ class SearchPage extends Component{ return } - console.log("63"); - console.log(response.data); + + this.setState({ count:response.data.count, data:response.data.results, }) }).catch((error) => { - console.log("56"); - console.log(error); + + }); } render(){ let {tab,count,data,page,perpages}=this.state; - console.log(tab); + + return( @@ -114,7 +127,9 @@ class SearchPage extends Component{ 搜索} + onInput={(e)=>this.setdatafunsval(e)} onSearch={ (value)=>this.setdatafuns(value)} /> @@ -146,11 +161,19 @@ class SearchPage extends Component{ 共找到相关结果{count}个 + {data === undefined ? "" : data.map((item, key) => { return ( + + @@ -208,6 +231,8 @@ class SearchPage extends Component{ + + ) })}
共找到相关结果{count}个