diff --git a/src/forge/Main/Index.js b/src/forge/Main/Index.js index 9cba30fe..d127775d 100644 --- a/src/forge/Main/Index.js +++ b/src/forge/Main/Index.js @@ -22,7 +22,6 @@ class Index extends Component { sort: undefined, total: 0, isSpin: true, - project_type: undefined, category_id: undefined, typeList: undefined, @@ -36,8 +35,8 @@ class Index extends Component { } componentDidMount = () => { - const { page,search, sort, project_type, category_id , languageId } = this.state; - this.getListData(page,search, sort, project_type, category_id , languageId); + const { page,search, sort,category_id , languageId } = this.state; + this.getListData(page,search, sort,category_id , languageId); this.getType(); @@ -72,7 +71,7 @@ class Index extends Component { } // 获取列表 - getListData = (page,search, sort, project_type, category_id,languageId) => { + getListData = (page,search, sort,category_id,language_id) => { const { current_user } = this.props; const url = `/projects.json`; axios.get(url, { @@ -82,9 +81,8 @@ class Index extends Component { limit:15, search, sort_by: sort, - project_type, category_id, - language_id:languageId + language_id } }).then((result) => { if (result) { @@ -111,7 +109,7 @@ class Index extends Component { this.setState({ typeList: list.map((item, key) => { return ( -
{item.name} {item.projects_count} @@ -123,15 +121,15 @@ class Index extends Component { } // 切换类型 - changeType = (type, list) => { + changeType = (id, list) => { this.setState({ isSpin: true, - project_type: type, + languageId: id, search: undefined }) - this.setTypeList(list, type) - const { page,sort, category_id , languageId } = this.state; - this.getListData(page,undefined, sort, type, category_id , languageId); + this.setTypeList(list, id) + const { page,sort, category_id} = this.state; + this.getListData(page,undefined, sort,category_id , id); } // 获取类型 @@ -166,8 +164,8 @@ class Index extends Component { page: 1 }); this.setCategoryList(list, id) - const { sort, project_type , languageId } = this.state; - this.getListData(1,undefined, sort, project_type, id , languageId); + const { sort,languageId } = this.state; + this.getListData(1,undefined, sort,id , languageId); } // 排序 @@ -178,8 +176,8 @@ class Index extends Component { search: undefined, isSpin: true }) - const {project_type, category_id , languageId } = this.state; - this.getListData(1,undefined, e.key, project_type, category_id , languageId); + const {category_id , languageId } = this.state; + this.getListData(1,undefined, e.key,category_id , languageId); } // 搜索 @@ -192,7 +190,7 @@ class Index extends Component { sort: "updated_on" }) const {sort, category_id , languageId } = this.state; - this.getListData(1,value, sort, undefined, category_id , languageId); + this.getListData(1,value, sort,category_id , languageId); } changeSearchValue = (e) => { this.setState({ @@ -204,23 +202,14 @@ class Index extends Component { this.setState({ page }) - const {search, sort, project_type, category_id , languageId } = this.state; - this.getListData(page,search, sort, project_type, category_id , languageId); + const {search, sort,category_id , languageId } = this.state; + this.getListData(page,search, sort, category_id , languageId); } getoDetail=(login,identifier)=>{ this.props.history.push(`/projects/${login}/${identifier}`); } - // 选择语言类别 - changeLanguage=(e)=>{ - this.setState({ - isSpin:true, - languageId:e === 0 ?undefined:e - }) - const { page,sort , project_type , category_id } = this.state; - this.getListData(page, undefined, sort, project_type, category_id ,e === 0 ?undefined:e); - } menu =()=> { return( diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index f5b6ca9a..6b8ea202 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -227,7 +227,7 @@ class Infos extends Component {