|
|
@ -15,27 +15,28 @@ class SearchPage extends Component{
|
|
|
|
this.state={
|
|
|
|
this.state={
|
|
|
|
tab:"0",
|
|
|
|
tab:"0",
|
|
|
|
count:0,
|
|
|
|
count:0,
|
|
|
|
keywords:"",
|
|
|
|
keywords:undefined,
|
|
|
|
type:"",
|
|
|
|
type:"shixun",
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
perpages:20,
|
|
|
|
perpages:20,
|
|
|
|
data:[],
|
|
|
|
data:[],
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//切换tab
|
|
|
|
//切换tab
|
|
|
|
changeTab=(e)=>{
|
|
|
|
changeTab=(e)=>{
|
|
|
|
console.log(e.key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let types ="";
|
|
|
|
|
|
|
|
|
|
|
|
let types ="";
|
|
|
|
if(parseInt(e.key)===0){
|
|
|
|
if(parseInt(e.key)===0){
|
|
|
|
types="course";
|
|
|
|
types="shixun";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(parseInt(e.key)===1){
|
|
|
|
if(parseInt(e.key)===1){
|
|
|
|
types="shixun";
|
|
|
|
types="subject";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(parseInt(e.key)===2){
|
|
|
|
if(parseInt(e.key)===2){
|
|
|
|
types="subject";
|
|
|
|
types="course";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(parseInt(e.key)===3){
|
|
|
|
if(parseInt(e.key)===3){
|
|
|
@ -59,16 +60,27 @@ class SearchPage extends Component{
|
|
|
|
// this.setState({
|
|
|
|
// this.setState({
|
|
|
|
// tab:sum,
|
|
|
|
// tab:sum,
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
let courstype=this.props.match.url;
|
|
|
|
let courstype=decodeURI(decodeURI(this.props.location.search));
|
|
|
|
courstype = courstype.split('?value=');
|
|
|
|
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)=>{
|
|
|
|
setdatafuns =(value)=>{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
keywords:value
|
|
|
|
keywords:value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.props.history.replace(`/search?value=${value}`)
|
|
|
|
this.getdata(this.state.page,this.state.type,value);
|
|
|
|
this.getdata(this.state.page,this.state.type,value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
@ -92,21 +104,22 @@ class SearchPage extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("63");
|
|
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
count:response.data.count,
|
|
|
|
count:response.data.count,
|
|
|
|
data:response.data.results,
|
|
|
|
data:response.data.results,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log("56");
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
render(){
|
|
|
|
let {tab,count,data,page,perpages}=this.state;
|
|
|
|
let {tab,count,data,page,perpages}=this.state;
|
|
|
|
console.log(tab);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<div className="newMain clearfix">
|
|
|
|
<div className="newMain clearfix">
|
|
|
|
<div className="headersear" >
|
|
|
|
<div className="headersear" >
|
|
|
@ -114,7 +127,9 @@ class SearchPage extends Component{
|
|
|
|
<Search
|
|
|
|
<Search
|
|
|
|
style={{ width: "800px", marginTop:"53px"}}
|
|
|
|
style={{ width: "800px", marginTop:"53px"}}
|
|
|
|
className="packinput"
|
|
|
|
className="packinput"
|
|
|
|
|
|
|
|
value={this.state.keywords}
|
|
|
|
enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>}
|
|
|
|
enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>}
|
|
|
|
|
|
|
|
onInput={(e)=>this.setdatafunsval(e)}
|
|
|
|
onSearch={ (value)=>this.setdatafuns(value)} />
|
|
|
|
onSearch={ (value)=>this.setdatafuns(value)} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
@ -146,11 +161,19 @@ class SearchPage extends Component{
|
|
|
|
<p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span>个</p>
|
|
|
|
<p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span>个</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mainx">
|
|
|
|
<div className="mainx">
|
|
|
|
|
|
|
|
|
|
|
|
<div className="educontent project-packages-list mb30">
|
|
|
|
<div className="educontent project-packages-list mb30">
|
|
|
|
{data === undefined ? "" : data.map((item, key) => {
|
|
|
|
{data === undefined ? "" : data.map((item, key) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
|
|
|
|
<a key={key}
|
|
|
|
|
|
|
|
href={
|
|
|
|
|
|
|
|
item.type==="shixun"?`/shixuns/${item.identifier}/challenges`:item.type==="course"?`/courses/${item.id}/students`:item.type==="subject"?`/paths/${item.id}`:item.type==="memo"?`/forums/${item.id}`:""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="project-package-item">
|
|
|
|
<div className="project-package-item">
|
|
|
|
|
|
|
|
|
|
|
|
<div className={"font-16 color-dark fl "} >
|
|
|
|
<div className={"font-16 color-dark fl "} >
|
|
|
@ -210,6 +233,8 @@ class SearchPage extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
|
|