添加了对项目中用户贡献度显示的支持

This commit is contained in:
zhangxunhui 2023-02-02 17:01:35 +08:00
parent fbf8e7784b
commit 19d025b602
2 changed files with 11 additions and 2 deletions

View File

@ -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'}}>
{

View File

@ -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;
}