forked from Gitlink/forgeplus-react
添加了对项目中用户贡献度显示的支持
This commit is contained in:
parent
fbf8e7784b
commit
19d025b602
|
|
@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
|
|||
import { Popover , Spin , Button } from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import './Component.scss';
|
||||
import { getUser } from '../GetData/getData';
|
||||
import { getUser4Proj } from '../GetData/getData';
|
||||
import axios from 'axios';
|
||||
|
||||
function Contributors({owner,projectsId,currentLogin}){
|
||||
|
|
@ -41,7 +41,7 @@ function Contributors({owner,projectsId,currentLogin}){
|
|||
setIsSpin(true);
|
||||
let a = menuList && menuList.filter(i=>i.login === login);
|
||||
if(a.length === 0){
|
||||
let result = await getUser(login);
|
||||
let result = await getUser4Proj(login, projectsId);
|
||||
let arr = menuList;
|
||||
arr.push({...result});
|
||||
setMenuList(arr);
|
||||
|
|
@ -94,6 +94,10 @@ function Contributors({owner,projectsId,currentLogin}){
|
|||
<span>{data.following_count}</span>
|
||||
<span>关注数</span>
|
||||
</Link>
|
||||
<Link to={`#`}>
|
||||
<span>{data.contribution_perc}</span>
|
||||
<span>贡献度</span>
|
||||
</Link>
|
||||
</AlignCenter>
|
||||
<div className={"pb20"} style={{display:"flex",justifyContent:'center'}}>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,4 +19,9 @@ export const getSubEntries = async (owner,projectsId,params)=>{
|
|||
// 获取用户信息
|
||||
export const getUser = async (login)=>{
|
||||
return (await axios.get(`/users/${login}/hovercard.json`)).data;
|
||||
}
|
||||
|
||||
// 获取用户对应项目内的信息(例如:用户对某个项目的贡献情况) author: zxh
|
||||
export const getUser4Proj = async (login, projectsId)=>{
|
||||
return (await axios.get(`/users/${login}/hovercard4proj.json?project_name=${projectsId}`)).data;
|
||||
}
|
||||
Loading…
Reference in New Issue