import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {Tooltip,Menu,Pagination,Spin} from 'antd'; import axios from 'axios'; import {getImageUrl} from 'educoder'; import NoneData from '../../courses/coursesPublic/NoneData' import "./usersInfo.css" import moment from 'moment'; 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 InfosPackage extends Component{ constructor(props){ super(props); this.state={ category:undefined, status:undefined, page:1, per_page:20, sort_direction:'desc', totalCount:undefined, data:undefined, isSpin:false } } componentDidMount=()=>{ this.setState({ isSpin:true }) let{category,status,page}=this.state; this.getCourses(category,status,page); } getCourses=(category,status,page)=>{ let url=`/users/${this.props.match.params.username}/project_packages.json`; axios.get((url),{params:{ category, status, page, sort_by:"published_at", sort_direction:'desc', per_page:20 }}).then((result)=>{ if(result){ this.setState({ totalCount:result.data.count, data:result.data, isSpin:false }) } }).catch((error)=>{ console.log(error); }) } //切换种类 changeCategory=(cate)=>{ this.setState({ category:cate, page:1, isSpin:true }) let{status}=this.state; this.getCourses(cate,status,1); } //切换状态 changeStatus=(status)=>{ this.setState({ status:status, page:1, isSpin:true }) let{category}=this.state; this.getCourses(category,status,1); } //切换页数 changePage=(page)=>{ this.setState({ page, isSpin:true }) let{category,status}=this.state; this.getCourses(category,status,page); } // 进入课堂 turnToCourses=(url,flag)=>{ if(flag){ this.props.history.push(url); } } render(){ let{ category, status, page, data, totalCount, isSpin } = this.state; let is_current=this.props.is_current; // console.log(data) return(
  • this.changeCategory()}>全部
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • this.changeCategory("bidden")}>{is_current ? "我":"TA"}参与的
  • { category=="manage"?
  • this.changeStatus()}>全部
  • this.changeStatus("unpublished")}>未发布
  • this.changeStatus("bidding")}>竞标中
  • this.changeStatus("finished")}>已完成
  • : category=="bidden"?
  • this.changeStatus()}>全部
  • this.changeStatus("bidding_lost")}>未中标
  • this.changeStatus("bidding_won")}>已中标
  • :"" }

    共{totalCount}个 发布时间

    {/*bidden_status: "pending"*/} {/*category_id: 2*/} {/*status: "published"*/} {/*type: "bidden"*/} {data===undefined?:data.project_packages.length===0?:data.project_packages.map((item,key)=>{ return(
    图片
    {item.min_price===null?"":¥{item.min_price}} {item.max_price===null||item.min_price===null?"":~} {item.max_price===null?"":¥{item.max_price}} {item.min_price===null&&item.max_price===null?可议价:""}
    {item.category_name}
    {item.visit_count}人浏览
    {moment(item.deadline_at).format("YYYY-MM-DD HH:mm")}竞标截止
    {item.bidding_users_count}人竞标
    发布于:{moment(item.published_at).format("YYYY-MM-DD HH:mm")}
    )})} { totalCount >20 &&
    }
    ) } } export default InfosPackage;