feat: 更新我的分享页面

This commit is contained in:
landaiqing
2024-07-20 16:54:08 +08:00
parent 6e8b2ae643
commit 3dacedf7fd
15 changed files with 399 additions and 208 deletions

View File

@@ -1,12 +1,9 @@
/** @format */
import { FunctionComponent, useEffect, useState } from "react";
import { ProCard, ProForm, ProFormCascader } from "@ant-design/pro-components";
import { AntDesignOutlined } from "@ant-design/icons";
import {
Avatar,
Button,
Descriptions,
DescriptionsProps,
Flex,
Form,
FormProps,
@@ -14,42 +11,26 @@ import {
Select,
Skeleton,
Space,
Tabs,
Tabs, Tag
} from "antd";
import styles from "./index.module.less";
import TextArea from "antd/es/input/TextArea";
import { city } from "@/constant/five-level-address.ts";
import { getUserInfoApi } from "@/api/user";
const UserSetting: FunctionComponent = () => {
const [disable, setDisable] = useState(true);
const [loading, setLoading] = useState(true);
const items: DescriptionsProps["items"] = [
{
key: "1",
label: "用户名",
children: "Zhou Maomao",
},
{
key: "2",
label: "账号ID",
children: "1810000000",
},
{
key: "3",
label: "注册时间",
children: "Hangzhou, Zhejiang",
},
{
key: "4",
label: "邮箱",
children: "landaiqing@126.com",
},
{
key: "5",
label: "手机号",
children: "13333333333333",
},
];
const [userInfo, setUserInfo] = useState<any>({} as any);
async function getUserInfo() {
getUserInfoApi("17").then((res: any) => {
console.log(res);
if (res && res.success && res.data) {
setUserInfo(res.data);
setLoading(false);
}
});
}
type FieldType = {
email?: string;
nickname?: string;
@@ -66,7 +47,9 @@ const UserSetting: FunctionComponent = () => {
const onFinishFailed: FormProps<FieldType>["onFinishFailed"] = (errorInfo) => {
console.log("Failed:", errorInfo);
};
useEffect(() => {
getUserInfo().then();
}, []);
const prefixSelector = (
<Form.Item name="prefix" noStyle>
<Select style={{ width: 90 }}>
@@ -87,9 +70,6 @@ const UserSetting: FunctionComponent = () => {
);
};
useEffect(() => {
setTimeout(() => {
setLoading(false);
}, 2000);
}, []);
const TabItems = [
{
@@ -207,16 +187,31 @@ const UserSetting: FunctionComponent = () => {
<Skeleton loading={loading} active>
<Space direction={"vertical"} style={{ width: "100%" }}>
<ProCard hoverable bordered>
<Flex vertical={false} align={"center"} justify={"space-between"}>
<span style={{ width: 80 }}></span>
<Input variant="borderless" value={"******************"} />
<Flex vertical={false} align={"center"}>
<span style={{width: 100}}></span>
<Space.Compact style={{ width: '100%' }}>
<Input.Password value={"123456"} variant="borderless"/>
<Button type="text"></Button>
</Space.Compact>
</Flex>
</ProCard>
<ProCard hoverable bordered>
1333333333333333
<Flex vertical={false} align={"center"}>
<span style={{width: 100}}></span>
<Space.Compact style={{ width: '100%' }}>
<Input.Password value={"123456"} variant="borderless"/>
<Button type="text"></Button>
</Space.Compact>
</Flex>
</ProCard>
<ProCard hoverable bordered>
landaiqing@126.com
<Flex vertical={false} align={"center"}>
<span style={{width: 100}}></span>
<Space.Compact style={{ width: '100%' }}>
<Input.Password value={"123456"} variant="borderless"/>
<Button type="text"></Button>
</Space.Compact>
</Flex>
</ProCard>
</Space>
</Skeleton>
@@ -233,14 +228,41 @@ const UserSetting: FunctionComponent = () => {
<div className={styles.user_setting_header}>
<Avatar
size={{ xs: 24, sm: 32, md: 40, lg: 64, xl: 80, xxl: 100 }}
icon={<AntDesignOutlined />}
src={userInfo.avatar}
/>
<Descriptions
style={{ width: "80%", marginLeft: "50px" }}
items={items}
column={3}
size={"small"}></Descriptions>
<Flex vertical={false} align={"center"} style={{ height: "100px",marginLeft: 40 }}>
<Flex vertical={true} justify={"flex-start"}>
<Flex vertical={false} align={"center"}>
<span style={{ color: "grey" }}></span>
<span style={{width: 130}}>{userInfo.userName}</span>
</Flex>
<Flex vertical={false} align={"center"} style={{marginTop: 20}}>
<span style={{ color: "grey" }}>ID</span>
<span style={{width: 130}}>{userInfo.id}</span>
</Flex>
</Flex>
<Flex vertical={true} style={{marginLeft: 50}}>
<Flex vertical={false} align={"center"}>
<span style={{ color: "grey" }}> </span>
<span style={{width: 130}}>{userInfo.email || "---------"}</span>
</Flex>
<Flex vertical={false} align={"center"} style={{marginTop: 20}}>
<span style={{ color: "grey" }}></span>
<span style={{width: 130}}>{userInfo.phone || "---------"}</span>
</Flex>
</Flex>
<Flex vertical={true} style={{marginLeft: 50}}>
<Flex vertical={false} align={"center"}>
<span style={{ color: "grey" }}></span>
<span style={{width: 130}}>{userInfo.createdTime}</span>
</Flex>
<Flex vertical={false} align={"center"} style={{marginTop: 20}}>
<span style={{ color: "grey" }}> </span>
{userInfo.status===0 ? <Tag color={"success"}></Tag>:<Tag color={"red"}></Tag>}
</Flex>
</Flex>
</Flex>
</div>
</Skeleton>
</ProCard>