explore/all 筛选
This commit is contained in:
parent
9786aaa4fe
commit
91338c863c
|
@ -37,7 +37,10 @@ class Index extends Component {
|
||||||
recommendOriList:undefined,
|
recommendOriList:undefined,
|
||||||
|
|
||||||
languageList:undefined,
|
languageList:undefined,
|
||||||
languageId:undefined
|
languageId:undefined,
|
||||||
|
|
||||||
|
CategoryList:undefined
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -147,11 +150,13 @@ class Index extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true,
|
isSpin: true,
|
||||||
project_type: type,
|
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) => {
|
axios.get(url).then((result) => {
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
|
|
||||||
this.setCategoryList(result.data, undefined);
|
this.setCategoryList(result.data, undefined);
|
||||||
}
|
}
|
||||||
}).catch((error) => { })
|
}).catch((error) => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
setCategoryList = (list, active_id) => {
|
setCategoryList = (list) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
categoryList: list.map((item, key) => {
|
CategoryList: list
|
||||||
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>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,10 +181,10 @@ class Index extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
category_id: id,
|
category_id: id,
|
||||||
page: 1
|
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 { current_user } = this.props;
|
||||||
|
|
||||||
const { projectsList , recommendList , languageList , languageId ,
|
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={
|
const setting={
|
||||||
dots: true,
|
dots: true,
|
||||||
|
@ -350,7 +348,19 @@ class Index extends Component {
|
||||||
</ul>
|
</ul>
|
||||||
<ul className="list-l-Menu">
|
<ul className="list-l-Menu">
|
||||||
<li className="MenuTitle"><i className="iconfont icon-xiangmuleibie color-grey-9 font-15 mr5"></i>项目类别</li>
|
<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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="list-right boxShandow radius-2" style={{padding:0}}>
|
<div className="list-right boxShandow radius-2" style={{padding:0}}>
|
||||||
|
|
Loading…
Reference in New Issue