import React, {Component} from 'react'; import {Link} from "react-router-dom"; import axios from 'axios'; import { Input ,Icon,Button,Pagination,Spin} from 'antd'; import moment from 'moment'; import '../packageconcnet.css'; import AccountProfile from"../../user/AccountProfile"; import LoginDialog from '../../login/LoginDialog'; const { Search } = Input; let categorylist=[ {name:"全部",value:undefined}, {name:"前端开发",value:"front"}, {name:"后端开发",value:"backend"}, {name:"移动开发",value:"mobile"}, {name:"数据库",value:"database"}, {name:"云计算和大数据",value:"cloud_compute_and_big_data"}, {name:"人工智能",value:"ai"}, {name:"运维与测试",value:"devops_and_test"}, {name:"其他",value:"other"}, ] // function setcategorylist(val){ let vals="" categorylist.some((item,key)=> { if (item.name === val) { vals=item.value return true } } ) return vals } class PackageConcent extends Component { constructor(props) { super(props) this.state = { data:undefined, project_packages:undefined, category:undefined, keyword:undefined, sort_by:"recently", sort_direction:"desc", page:1, per_page:20, categories:[], isRender:false, AccountProfiletype:false, isSpin:false } } //desc’, ‘desc’, ‘asc’ //否 string 排序,默认最新, ‘recently’, ‘price’ // 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other componentDidMount() { window.document.title = '众包创新' let {category,keyword,sort_by,sort_direction,page}=this.state this.setdatas(category,keyword,sort_by,sort_direction,page) let Url = `/project_package_categories.json`; axios.get(Url).then((response) => { // console.log(response) this.setState({ categories:response.data.categories }) }).catch((error) => { console.log(error) }) } setdatas=(category,keyword,sort_by,sort_direction,page)=>{ this.setState({ isSpin:true }) let Url = `/project_packages.json`; axios.get(Url,{params:{ category_id:category, keyword:keyword, sort_by:sort_by, sort_direction:sort_direction, page:page, per_page:20, }} ).then((response) => { this.setState({ data:response.data, isSpin:false, project_packages:response.data.project_packages }) }).catch((error) => { console.log(error) }) } setdatafuns=(value)=>{ let {category,keyword,sort_by,sort_direction,page}=this.state this.setState({ keyword:value }) this.setdatas(category,value,sort_by,sort_direction,page) } setcategory=(value)=>{ let {category,keyword,sort_by,sort_direction,page}=this.state this.setState({ category:value }) this.setdatas(value,keyword,sort_by,sort_direction,page) } setsort_byfun=(value)=>{ let {category,keyword,sort_by,sort_direction,page}=this.state this.setState({ sort_by:value }) let sort_directionvalue; if(value===sort_by){ if(sort_direction==="desc"){ this.setState({ sort_direction:"asc" }) sort_directionvalue="asc"; }else{ this.setState({ sort_direction:"desc" }) sort_directionvalue="desc"; } }else{ this.setState({ sort_direction:"desc" }) sort_directionvalue="desc"; } this.setdatas(category,keyword,value,sort_directionvalue,page) } onReleaseRequirements=(url)=>{ let{current_user} =this.props; if(current_user===undefined){ this.setState({ isRender:true }) return } if(current_user&¤t_user.login===""){ this.setState({ isRender:true }) return; } if(current_user&¤t_user.profile_completed===false){ this.setState({ AccountProfiletype:true }) return; } if(url !== undefined || url!==""){ window.location.href = url; } } // 登录 Modifyloginvalue=()=>{ this.setState({ isRender:false, }) } hideAccountProfile=()=>{ this.setState({ AccountProfiletype:false }) } render() { let {data,page,category,sort_by,sort_direction,project_packages, isRender,AccountProfiletype }=this.state; return (
类型:
排序:
暂无数据哦~