From ecff5f487db997225e726ca20a7303ae27b08c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 10 Mar 2023 10:28:59 +0800 Subject: [PATCH] =?UTF-8?q?token=E8=BD=AC=E8=B4=A6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E9=A1=B5+=E8=A2=AB=E5=88=A0=E9=99=A4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/users/contribution/index.jsx | 34 ++++++++++++++++++------- src/forge/users/contribution/index.scss | 3 +++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/forge/users/contribution/index.jsx b/src/forge/users/contribution/index.jsx index fa1a15edf..f79b047a9 100644 --- a/src/forge/users/contribution/index.jsx +++ b/src/forge/users/contribution/index.jsx @@ -12,8 +12,7 @@ import { FlexAJ } from '../../Component/layout'; // 个人中心-贡献确权 function Contribution(props){ - // 接口暂不支持分页 - const limit = 15; + const limit = 10; const [page, setPage] = useState(1); const [total, setTotal] = useState(undefined); // 转账列表 @@ -34,13 +33,30 @@ function Contribution(props){ useEffect(()=>{ // token转账列表 - axios.get(`/users/blockchain/balance.json`,{params: {user_id}}).then(res=>{ + axios.get(`/users/blockchain/balance.json`,{params: { + user_id, + limit, + page + }}).then(res=>{ if(res && res.data){ - setList(res.data.projects); + const {projects} = res.data; + const newProjects = []; + let deleteProjectCount = 0; + projects.map(item=>{ + if(item.id){ + newProjects.unshift(item); + }else{ + deleteProjectCount++; + } + }) + deleteProjectCount && newProjects.push({ + 'balance': deleteProjectCount + }) + setList(newProjects); setTotal(res.data.total_count); } }) - }, [reload]) + }, [reload, page]) useEffect(()=>{ if(user){ @@ -115,7 +131,7 @@ function Contribution(props){
操作
} {list && !list.length && } - {list && list.map(item=>{return
+ {list && list.map(item=>{return item.id ?
{item.name}
{item.balance}
@@ -127,7 +143,7 @@ function Contribution(props){ {proId === item.id && error2 &&
{error2}
}
-
})} +
:
{item.balance}个项目被删除
})} :
蒋宇航GilLink/确实开源给你转账了1000个tiken @@ -138,9 +154,9 @@ function Contribution(props){ 6小时前
} - {/* {total > limit &&
+ {total > limit &&
setPage(page)}/> -
} */} +
} ) } diff --git a/src/forge/users/contribution/index.scss b/src/forge/users/contribution/index.scss index ba3ee58a4..a0e26842f 100644 --- a/src/forge/users/contribution/index.scss +++ b/src/forge/users/contribution/index.scss @@ -40,6 +40,9 @@ padding: 15px 0; border-bottom: 1px solid #eee; } + .deleteRepo{ + color: slategrey; + } .tableColumn3, .tableColumn4{ width: 200px; }