|
|
@ -15,7 +15,7 @@ class SearchPage extends Component{
|
|
|
|
this.state={
|
|
|
|
this.state={
|
|
|
|
tab:"0",
|
|
|
|
tab:"0",
|
|
|
|
count:0,
|
|
|
|
count:0,
|
|
|
|
keywords:"python",
|
|
|
|
keywords:"",
|
|
|
|
type:"",
|
|
|
|
type:"",
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
perpages:20,
|
|
|
|
perpages:20,
|
|
|
@ -24,12 +24,30 @@ class SearchPage extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//切换tab
|
|
|
|
//切换tab
|
|
|
|
changeTab=(e)=>{
|
|
|
|
changeTab=(e)=>{
|
|
|
|
this.setState({
|
|
|
|
console.log(e.key);
|
|
|
|
tab:e.key
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let types ="";
|
|
|
|
|
|
|
|
if(parseInt(e.key)===0){
|
|
|
|
|
|
|
|
types="course";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(parseInt(e.key)===1){
|
|
|
|
|
|
|
|
types="shixun";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(parseInt(e.key)===2){
|
|
|
|
|
|
|
|
types="subject";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(parseInt(e.key)===3){
|
|
|
|
|
|
|
|
types="memo";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
tab:e.key,
|
|
|
|
|
|
|
|
type:types
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.getdata(1,types,this.state.keywords);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount(){
|
|
|
|
componentDidMount(){
|
|
|
|
// const query =this.props.location.search;
|
|
|
|
// const query =this.props.location.search;
|
|
|
@ -41,25 +59,31 @@ class SearchPage extends Component{
|
|
|
|
// this.setState({
|
|
|
|
// this.setState({
|
|
|
|
// tab:sum,
|
|
|
|
// tab:sum,
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
this.getdata(this.state.page);
|
|
|
|
let courstype=this.props.match.url;
|
|
|
|
|
|
|
|
courstype = courstype.split('?value=');
|
|
|
|
|
|
|
|
console.log(courstype);
|
|
|
|
|
|
|
|
this.getdata(this.state.page,this.state.type,this.state.keywords);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setdatafuns =(value)=>{
|
|
|
|
setdatafuns =(value)=>{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
keywords:value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.getdata(this.state.page,this.state.type,value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
page: pageNumber,
|
|
|
|
page: pageNumber,
|
|
|
|
loadingstate: true,
|
|
|
|
loadingstate: true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.getdata(pageNumber);
|
|
|
|
this.getdata(pageNumber,this.state.type,this.state.keywords);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取数据
|
|
|
|
//获取数据
|
|
|
|
getdata=(pages)=>{
|
|
|
|
getdata=(pages,type,keywords)=>{
|
|
|
|
let url = "/search.json";
|
|
|
|
let url = "/search.json";
|
|
|
|
axios.get(url,{params:{
|
|
|
|
axios.get(url,{params:{
|
|
|
|
keyword:this.state.keywords,
|
|
|
|
keyword:keywords,
|
|
|
|
type:this.state.types,
|
|
|
|
type:type,
|
|
|
|
page:pages,
|
|
|
|
page:pages,
|
|
|
|
per_page:this.state.perpages,
|
|
|
|
per_page:this.state.perpages,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,7 +132,7 @@ class SearchPage extends Component{
|
|
|
|
JSON.stringify(data) === "[]" ?
|
|
|
|
JSON.stringify(data) === "[]" ?
|
|
|
|
|
|
|
|
|
|
|
|
<div id="forum_list" className="forum_table">
|
|
|
|
<div id="forum_list" className="forum_table">
|
|
|
|
<div className="mh650 edu-back-white">
|
|
|
|
<div className="mh650 bjyss">
|
|
|
|
<div className="edu-tab-con-box clearfix edu-txt-center">
|
|
|
|
<div className="edu-tab-con-box clearfix edu-txt-center">
|
|
|
|
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
|
|
|
|
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
|
|
|
|
<p className="edu-nodata-p mb30">没有数据可以显示!</p>
|
|
|
|
<p className="edu-nodata-p mb30">没有数据可以显示!</p>
|
|
|
|