构建列表里的提交信息,作者头像错误

This commit is contained in:
caishi 2021-04-02 11:57:48 +08:00
parent a0ebba839e
commit dccbd6735d
2 changed files with 8 additions and 6 deletions

View File

@ -58,6 +58,7 @@ function Structure(props,ref){
return {
...item,
author:item.author && item.author.name,
image_url:item.author && item.author.image_url,
message: {
branch: item.branch_target,
message: item.message,
@ -244,7 +245,7 @@ function Structure(props,ref){
{meg.sha && <span className="color-orange">{meg.sha}</span>}
</div>
<AlignCenter>
<img style={{borderRadius:"50%",marginRight:"10px",width:"25px",height:"25px"}} src={`${current_user && getUrl(`/images/${current_user.image_url}`)}`} />
<img style={{borderRadius:"50%",marginRight:"10px",width:"25px",height:"25px"}} alt="" src={`${item.image_url && getUrl(`/images/${item.image_url}`)}`} />
<div className="task-hide ml5" style={{ maxWidth: "300px" }}>
{meg.message}
</div>

View File

@ -13,9 +13,9 @@ const sort = [
"按引用排序"
]
const limit = 15;
const https = 'http://117.50.100.12:8001';
const https = 'https://testfiles.trustie.net';
function Index(props){
const [ sortValue , setSortValue ] = useState(1);
const [ sortValue , setSortValue ] = useState(0);
const [ page , setPage ] = useState(1);
const [ total , setTotal ] = useState(0);
const [ search , setSearch ] = useState(undefined);
@ -28,7 +28,7 @@ function Index(props){
if(owner && repo_id){
getData();
}
},[repo_id,owner,search,sort,page])
},[repo_id,owner,search,sortValue,page])
function getData(){
const url = https +`/api/project/achievement/`;
@ -38,7 +38,7 @@ function Index(props){
curPage:page,
pageSize:limit,
name:search,
sort:sortValue,
sort:sortValue+1,
}
}).then(result=>{
if(result && result.data){
@ -54,6 +54,7 @@ function Index(props){
//
function changeSort(e,index){
console.log(index);
setSortValue(index);
}
@ -63,7 +64,7 @@ function Index(props){
{
sort && sort.map((item,key)=>{
return(
<Menu.Item onClick={(e)=>changeSort(e,key+1)} value={key} className={key+1 === sortValue ?"color-blue":""}>{item}</Menu.Item>
<Menu.Item onClick={(e)=>changeSort(e,key)} value={key} className={key=== sortValue ?"color-blue":""}>{item}</Menu.Item>
)
})
}