增加了悬赏,标签查看,评论页面,标签上传后端有问题,评论还没跟后端连,优化了一些小界面
Change-Id: I44f5ef2eb0a8ebd91a4b3b3b446f897bea41435f
diff --git a/react-ui/src/pages/User/Center/index.tsx b/react-ui/src/pages/User/Center/index.tsx
index 2ce308c..7272fa3 100644
--- a/react-ui/src/pages/User/Center/index.tsx
+++ b/react-ui/src/pages/User/Center/index.tsx
@@ -14,6 +14,7 @@
import AvatarCropper from './components/AvatarCropper';
import { useRequest } from '@umijs/max';
import { getUserInfo } from '@/services/session';
+import { getUserRateInfo } from '@/services/system/user';
import { PageLoading } from '@ant-design/pro-components';
const operationTabList = [
@@ -38,20 +39,25 @@
export type tabKeyType = 'base' | 'password';
const Center: React.FC = () => {
-
+
const [tabKey, setTabKey] = useState<tabKeyType>('base');
-
+
const [cropperModalOpen, setCropperModalOpen] = useState<boolean>(false);
-
+
// 获取用户信息
const { data: userInfo, loading } = useRequest(async () => {
- return { data: await getUserInfo()};
+ return { data: await getUserInfo() };
+ });
+
+ const { data: userRateInfo } = useRequest(async () => {
+ return { data: await getUserRateInfo() };
});
if (loading) {
return <div>loading...</div>;
}
- const currentUser = userInfo?.user;
+ const currentUser = { ...userInfo?.user, ...userRateInfo?.data };
+
// 渲染用户信息
const renderUserInfo = ({
@@ -60,6 +66,10 @@
email,
sex,
dept,
+ uploadCount,
+ downloadCount,
+ rateCount,
+ score,
}: Partial<API.CurrentUser>) => {
return (
<List>
@@ -109,6 +119,39 @@
</List.Item>
<List.Item>
<div>
+ <MailOutlined
+ style={{
+ marginRight: 8,
+ }}
+ />
+ 上传量
+ </div>
+ <div>{uploadCount}</div>
+ </List.Item>
+ <List.Item>
+ <div>
+ <MailOutlined
+ style={{
+ marginRight: 8,
+ }}
+ />
+ 下载量
+ </div>
+ <div>{downloadCount}</div>
+ </List.Item>
+ <List.Item>
+ <div>
+ <MailOutlined
+ style={{
+ marginRight: 8,
+ }}
+ />
+ 分享率
+ </div>
+ <div>{rateCount}</div>
+ </List.Item>
+ {/* <List.Item>
+ <div>
<ClusterOutlined
style={{
marginRight: 8,
@@ -117,6 +160,17 @@
部门
</div>
<div>{dept?.deptName}</div>
+ </List.Item> */}
+ <List.Item>
+ <div>
+ <MailOutlined
+ style={{
+ marginRight: 8,
+ }}
+ />
+ 积分
+ </div>
+ <div>{score}</div>
</List.Item>
</List>
);
@@ -147,13 +201,13 @@
loading={loading}
>
{!loading && (
- <div style={{ textAlign: "center"}}>
- <div className={styles.avatarHolder} onClick={()=>{setCropperModalOpen(true)}}>
+ <div style={{ textAlign: "center" }}>
+ <div className={styles.avatarHolder} onClick={() => { setCropperModalOpen(true) }}>
<img alt="" src={currentUser.avatar} />
</div>
{renderUserInfo(currentUser)}
<Divider dashed />
- <div className={styles.team}>
+ {/* <div className={styles.team}>
<div className={styles.teamTitle}>角色</div>
<Row gutter={36}>
{currentUser.roles &&
@@ -168,7 +222,7 @@
</Col>
))}
</Row>
- </div>
+ </div> */}
</div>
)}
</Card>
@@ -188,7 +242,7 @@
</Row>
<AvatarCropper
onFinished={() => {
- setCropperModalOpen(false);
+ setCropperModalOpen(false);
}}
open={cropperModalOpen}
data={currentUser.avatar}