个人中心

This commit is contained in:
caishi 2020-06-18 16:05:22 +08:00
parent 9d957af422
commit 6570985b68
5 changed files with 53 additions and 13 deletions

View File

@ -35,7 +35,6 @@ const Infos = Loadable({
class Index extends Component {
render() {
console.log("1",this.props);
return (
<div className="newMain clearfix">
<Switch {...this.props}>

View File

@ -416,7 +416,7 @@ class Detail extends Component {
<li className={url.indexOf("merge") > -1 ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/merge`, state }}>
<img alt="" src={img_3} width="13" />合并请求
{ projectDetail && projectDetail.pull_requests_count ? <span>{projectDetail.issues_count}</span> : "" }
{ projectDetail && projectDetail.pull_requests_count ? <span>{projectDetail.pull_requests_count}</span> : "" }
</Link>
</li>
<li className={(url.indexOf("Milepost") > -1 || url.indexOf("meilpost") > -1) ? "active" : ""}>

View File

@ -53,7 +53,7 @@ class IndexItem extends Component {
<span><i className="iconfont icon-fork mr3 font-16" style={{ color: "#1B8FFF" }} />fork ({item.forked_count})</span>
</span>
</div>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "40px" }}>{item.description}</p>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "44px",lineHeight:"22px" }}>{item.description}</p>
<div className="p-r-about">
<span className="p-r-detail">

View File

@ -41,4 +41,30 @@ $flex:flex;
color: #888;
margin-top: 3px;
}
}
.infosType{
padding:20px 30px 0px 30px;
display: flex;
justify-content: space-between;
.infoStatus{
height:30px;
background:rgba(255,255,255,1);
border-radius:15px;
border:1px solid rgba(221,221,221,1);
line-height: 30px;
font-size: 12px;
color: #888;
display: flex;
& > span{
display: block;
padding:0px 12px;
border-radius:15px;
cursor: pointer;
}
& > span.active{
background-color:#5091FF ;
color: #fff;
padding:0px 15px;
}
}
}

View File

@ -1,5 +1,4 @@
import React, { Component } from "react";
// import { SnackbarHOC } from 'educoder';
import { Link } from "react-router-dom";
import { Menu, Input, Spin, Pagination, Popover, Button } from "antd";
@ -21,6 +20,7 @@ class InfosUser extends Component {
projectsList: undefined,
total: undefined,
category: undefined,
is_public:"public"
};
}
@ -29,12 +29,12 @@ class InfosUser extends Component {
};
componentDidUpdate = (prevProps) => {
if (prevProps.project_type != this.props.project_type) {
if (prevProps.project_type !== this.props.project_type) {
this.get_projects();
}
};
get_projects = () => {
get_projects = (is_public) => {
const { user, project_type } = this.props;
const url = `/users/${user && user.login}/projects.json`;
const { page, limit, search, sort_by, category } = this.state;
@ -50,6 +50,7 @@ class InfosUser extends Component {
sort_by,
category,
project_type,
is_public:is_public!==undefined ? is_public : "public"
},
})
.then((result) => {
@ -91,9 +92,17 @@ class InfosUser extends Component {
});
};
// 切换公有私有
changeStatus=(is_public)=>{
this.setState({
is_public
})
this.get_projects(is_public);
}
render() {
const { current_user, user } = this.props;
const { category } = this.state;
const { category , is_public } = this.state;
const menu = (
<Menu onClick={this.ChangeSoryBy}>
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
@ -116,20 +125,20 @@ class InfosUser extends Component {
user && current_user && user.login === current_user.login
? [
{ type: undefined, name: "所有" },
{ type: "manage", name: "我自己的" },
{ type: "manage", name: "我创建的" },
{ type: "join", name: "我参与的" },
{ type: "watched", name: "我关注的" },
{ type: "forked", name: "我Fork的" },
{ type: "public", name: "公开的" },
{ type: "private", name: "私有的" },
// { type: "public", name: "公开的" },
// { type: "private", name: "私有的" },
]
: [
{ type: undefined, name: "所有" },
{ type: "manage", name: "TA自己的" },
{ type: "manage", name: "TA创建的" },
{ type: "join", name: "TA参与的" },
{ type: "watched", name: "TA关注的" },
{ type: "forked", name: "TAFork的" },
{ type: "public", name: "公开的" },
// { type: "public", name: "公开的" },
];
const category_button = button_lists.map((item, key) => {
@ -207,7 +216,13 @@ class InfosUser extends Component {
</Popover>
</div>
</div>
<div className="project-list mt20">{category_button}</div>
<div className="infosType">
<div>{category_button}</div>
<p className="infoStatus">
<span className={is_public === "public" ? "active" : "" } onClick={()=>this.changeStatus("public")}>公有</span>
<span className={is_public === "private" ? "active" : "" } onClick={()=>this.changeStatus("private")}>私有</span>
</p>
</div>
{projectsList && projectsList.length > 0 ? (
<div>