diff --git a/src/forge/Main/Index.js b/src/forge/Main/Index.js index b82db46e..ede9c535 100644 --- a/src/forge/Main/Index.js +++ b/src/forge/Main/Index.js @@ -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 ( -
  • this.changeCategory(`${item.id}`, list)}> -

    - {item.name} - {item.projects_count} -

    -
  • - ) - }) + 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 {