|
|
@ -1,7 +1,7 @@
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd";
|
|
|
|
import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd";
|
|
|
|
import {Link,NavLink} from 'react-router-dom';
|
|
|
|
import {Link,NavLink} from 'react-router-dom';
|
|
|
|
import { WordsBtn ,ActionBtn,SnackbarHOC} from 'educoder';
|
|
|
|
import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder';
|
|
|
|
const Search = Input.Search;
|
|
|
|
const Search = Input.Search;
|
|
|
|
import axios from 'axios';
|
|
|
|
import axios from 'axios';
|
|
|
|
import './searchc.css'
|
|
|
|
import './searchc.css'
|
|
|
@ -13,6 +13,11 @@ class SearchPage extends Component{
|
|
|
|
this.state={
|
|
|
|
this.state={
|
|
|
|
tab:"0",
|
|
|
|
tab:"0",
|
|
|
|
count:0,
|
|
|
|
count:0,
|
|
|
|
|
|
|
|
keywords:"python",
|
|
|
|
|
|
|
|
type:"",
|
|
|
|
|
|
|
|
page:1,
|
|
|
|
|
|
|
|
perpages:20,
|
|
|
|
|
|
|
|
data:[],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//切换tab
|
|
|
|
//切换tab
|
|
|
@ -34,14 +39,47 @@ class SearchPage extends Component{
|
|
|
|
// this.setState({
|
|
|
|
// this.setState({
|
|
|
|
// tab:sum,
|
|
|
|
// tab:sum,
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
|
|
|
|
this.getdata(this.state.page);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setdatafuns =(value)=>{
|
|
|
|
setdatafuns =(value)=>{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
page: pageNumber,
|
|
|
|
|
|
|
|
loadingstate: true,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.getdata(pageNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取数据
|
|
|
|
|
|
|
|
getdata=(pages)=>{
|
|
|
|
|
|
|
|
let url = "/search.json";
|
|
|
|
|
|
|
|
axios.get(url,{params:{
|
|
|
|
|
|
|
|
keyword:this.state.keywords,
|
|
|
|
|
|
|
|
type:this.state.types,
|
|
|
|
|
|
|
|
page:pages,
|
|
|
|
|
|
|
|
per_page:this.state.perpages,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
|
|
|
if(response === undefined){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(){
|
|
|
|
render(){
|
|
|
|
let {tab,count}=this.state;
|
|
|
|
let {tab,count,data,page,perpages}=this.state;
|
|
|
|
console.log(tab);
|
|
|
|
console.log(tab);
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<div className="newMain clearfix">
|
|
|
|
<div className="newMain clearfix">
|
|
|
@ -55,6 +93,7 @@ class SearchPage extends Component{
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="tabtitle">
|
|
|
|
<div className="tabtitle">
|
|
|
|
|
|
|
|
<div className="tabtitles2">
|
|
|
|
<Menu mode="horizontal" className="tabtitless" selectedKeys={tab} onClick={this.changeTab}>
|
|
|
|
<Menu mode="horizontal" className="tabtitless" selectedKeys={tab} onClick={this.changeTab}>
|
|
|
|
<Menu.Item className={"tabtitle1"} key="0">开发社区</Menu.Item>
|
|
|
|
<Menu.Item className={"tabtitle1"} key="0">开发社区</Menu.Item>
|
|
|
|
<Menu.Item className={"tabtitle2"} key="1">实践课程</Menu.Item>
|
|
|
|
<Menu.Item className={"tabtitle2"} key="1">实践课程</Menu.Item>
|
|
|
@ -62,17 +101,115 @@ class SearchPage extends Component{
|
|
|
|
<Menu.Item className={"tabtitle2"} key="3">交流问答</Menu.Item>
|
|
|
|
<Menu.Item className={"tabtitle2"} key="3">交流问答</Menu.Item>
|
|
|
|
</Menu>
|
|
|
|
</Menu>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
JSON.stringify(data) === "[]" ?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="forum_list" className="forum_table">
|
|
|
|
|
|
|
|
<div className="mh650 edu-back-white">
|
|
|
|
|
|
|
|
<div className="edu-tab-con-box clearfix edu-txt-center">
|
|
|
|
|
|
|
|
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
|
|
|
|
|
|
|
|
<p className="edu-nodata-p mb30">没有数据可以显示!</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div className="counttit">
|
|
|
|
<div className="counttit">
|
|
|
|
<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">
|
|
|
|
|
|
|
|
{data === undefined ? "" : data.map((item, key) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<div className="project-package-item">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className={"font-16 color-dark fl "} >
|
|
|
|
|
|
|
|
{/*标题*/}
|
|
|
|
|
|
|
|
<span className={"markdown-body fonttext"}
|
|
|
|
|
|
|
|
dangerouslySetInnerHTML={{__html:item.title}}/>
|
|
|
|
|
|
|
|
{/*描述*/}
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<span className={"markdown-body magr11 fontextcolor"}
|
|
|
|
|
|
|
|
dangerouslySetInnerHTML={{__html: item4}} />
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{/*内容*/}
|
|
|
|
|
|
|
|
{item.content.description === undefined || item.content.description===0?"": item.content.description.map((item3, key3) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<span className={"markdown-body magr11 fontextcolor"}
|
|
|
|
|
|
|
|
dangerouslySetInnerHTML={{__html: item3}} />
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="xuxianpro"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{/*挑战名字*/}
|
|
|
|
|
|
|
|
{item.content.challenge_names === undefined || item.content.challenge_names===0?"": item.content.challenge_names.map((item5, key5) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<span className={"markdown-body"}
|
|
|
|
|
|
|
|
dangerouslySetInnerHTML={{__html: item5}} />
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{/*挑战标签*/}
|
|
|
|
|
|
|
|
{item.content.challenge_tag_names === undefined || item.content.challenge_tag_names===0?"": item.content.challenge_tag_names.map((item6, key6) => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<span className={key6>1?"markdown-body tzbq ":"markdown-body tzbqx"}
|
|
|
|
|
|
|
|
dangerouslySetInnerHTML={{__html:item6}} />
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mt20">
|
|
|
|
|
|
|
|
<span></span> <span></span> <span></span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
count && count && count> perpages ?
|
|
|
|
|
|
|
|
<div className="edu-txt-center" style={{paddingBottom:"30px"}}>
|
|
|
|
|
|
|
|
<Pagination showQuickJumper current={page}
|
|
|
|
|
|
|
|
onChange={this.paginationonChanges} pageSize={perpages}
|
|
|
|
|
|
|
|
total={count}></Pagination>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
: ""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|