forked from Gitlink/forgeplus-react
explore/all 筛选
This commit is contained in:
parent
9786aaa4fe
commit
91338c863c
|
@ -37,7 +37,10 @@ class Index extends Component {
|
|||
recommendOriList:undefined,
|
||||
|
||||
languageList:undefined,
|
||||
languageId:undefined
|
||||
languageId:undefined,
|
||||
|
||||
CategoryList:undefined
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -147,11 +150,13 @@ class Index extends Component {
|
|||
this.setState({
|
||||
isSpin: true,
|
||||
project_type: type,
|
||||
search: undefined
|
||||
search: undefined,
|
||||
category_id: undefined,
|
||||
},()=>{
|
||||
this.setTypeList(list, type)
|
||||
const { page, limit, sort , languageId } = this.state;
|
||||
this.getListData(page, limit, undefined, sort, type, undefined , languageId);
|
||||
})
|
||||
this.setTypeList(list, type)
|
||||
const { page, limit, sort, category_id , languageId } = this.state;
|
||||
this.getListData(page, limit, undefined, sort, type, category_id , languageId);
|
||||
}
|
||||
|
||||
// 获取类型
|
||||
|
@ -160,23 +165,15 @@ class Index extends Component {
|
|||
|
||||
axios.get(url).then((result) => {
|
||||
if (result && result.data) {
|
||||
|
||||
this.setCategoryList(result.data, undefined);
|
||||
}
|
||||
}).catch((error) => { })
|
||||
}
|
||||
|
||||
setCategoryList = (list, active_id) => {
|
||||
setCategoryList = (list) => {
|
||||
this.setState({
|
||||
categoryList: list.map((item, key) => {
|
||||
return (
|
||||
<li key={key} className={active_id && parseInt(active_id) === item.id ? 'active' : ''} onClick={() => this.changeCategory(`${item.id}`, list)}>
|
||||
<p>
|
||||
<span className="font-16">{item.name}</span>
|
||||
<span className="color-blue">{item.projects_count}</span>
|
||||
</p>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
CategoryList: list
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -184,10 +181,10 @@ class Index extends Component {
|
|||
this.setState({
|
||||
category_id: id,
|
||||
page: 1
|
||||
},()=>{
|
||||
const { limit, sort, project_type , languageId } = this.state;
|
||||
this.getListData(1, limit, undefined, sort, project_type, id , languageId);
|
||||
});
|
||||
this.setCategoryList(list, id)
|
||||
const { limit, sort, project_type , languageId } = this.state;
|
||||
this.getListData(1, limit, undefined, sort, project_type, id , languageId);
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
@ -279,7 +276,8 @@ class Index extends Component {
|
|||
const { current_user } = this.props;
|
||||
|
||||
const { projectsList , recommendList , languageList , languageId ,
|
||||
isSpin, total, search, limit, page, typeList, categoryList , recommendOriList } = this.state;
|
||||
isSpin, total, search, limit, page, typeList, categoryList ,
|
||||
recommendOriList , CategoryList , category_id } = this.state;
|
||||
|
||||
const setting={
|
||||
dots: true,
|
||||
|
@ -350,7 +348,19 @@ class Index extends Component {
|
|||
</ul>
|
||||
<ul className="list-l-Menu">
|
||||
<li className="MenuTitle"><i className="iconfont icon-xiangmuleibie color-grey-9 font-15 mr5"></i>项目类别</li>
|
||||
{categoryList}
|
||||
{
|
||||
CategoryList && CategoryList.length > 0 ? CategoryList.map((item,key)=>{
|
||||
return(
|
||||
<li key={key} className={category_id && parseInt(category_id) === item.id ? 'active' : ''} onClick={() => this.changeCategory(`${item.id}`)}>
|
||||
<p>
|
||||
<span className="font-16">{item.name}</span>
|
||||
<span className="color-blue">{item.projects_count}</span>
|
||||
</p>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
:""
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div className="list-right boxShandow radius-2" style={{padding:0}}>
|
||||
|
|
Loading…
Reference in New Issue