Skip to content

Commit

Permalink
feat: 用户信息页静态页面
Browse files Browse the repository at this point in the history
  • Loading branch information
waiterxiaoyy committed Nov 20, 2024
1 parent 8aa6528 commit 3e26449
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 142 deletions.
22 changes: 13 additions & 9 deletions packages/editor/src/pages/feedback/FeedbackIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ const FeedbackIcon: React.FC = () => {
navigate('/feedback');
};

const hiddlenPages = [
'/feedback',
'/editor'
];

const isFeedbackPage = hiddlenPages.some(page => location.pathname.startsWith(page));
const hiddlenPages = ['/feedback', '/editor', '/user'];

const isFeedbackPage = hiddlenPages.some((page) => location.pathname.startsWith(page));

return (
<div className={`${styles.feedbackIcon} ${isFeedbackPage ? styles.hidden : ''}`} onClick={handleClick}>
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9604" >
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9604">
<path d="M504.32 513.1264m-450.816 0a450.816 450.816 0 1 0 901.632 0 450.816 450.816 0 1 0-901.632 0Z" fill="#7d3fff" p-id="9605"></path>
<path d="M453.4784 720.0256c-30.2592-0.1024-57.9584-4.1472-85.0944-12.4928a21.6576 21.6576 0 0 0-13.824 0.3072c-26.2144 9.7792-52.1216 20.2752-78.1824 30.3616-15.616 6.0416-22.5792 0.6144-20.0704-16.0768 3.3792-22.3232 6.9632-44.5952 11.1616-66.7136 1.0752-5.7344-0.256-9.2672-4.096-13.1584-36.4032-36.9152-59.5456-80.9984-69.4272-131.8912-20.5824-106.0352 25.7536-212.0192 117.4016-269.1072 93.952-58.5216 216.576-50.3296 301.8752 20.224 106.0352 87.7056 124.0064 243.5072 43.8784 351.8976-50.8928 68.9152-120.4224 103.0144-203.6224 106.6496z m-0.4096-189.7984h0.5632c11.6736 0.0512 21.1968-9.3184 21.2992-20.992 0-1.9968 0.0512-3.584 0.0512-4.352 0.1536-21.76 7.9872-25.9584 25.7024-34.8672 15.7696-7.936 30.3616-19.9168 36.096-37.1712 11.264-33.8432 5.2736-66.304-19.8144-91.5968-26.368-26.624-65.8944-34.3552-100.864-20.6848-23.1936 9.0624-39.168 27.648-47.616 50.3808-5.2736 14.1824 4.2496 29.5424 19.2 31.9488l0.6144 0.1024c10.752 1.7408 21.248-3.8912 26.0608-13.7216 7.2192-14.7968 21.6064-32.9216 48.8448-26.5216 15.8208 3.7376 29.6448 17.8176 32.2048 33.5872 2.9696 18.432-1.6896 27.4944-19.456 37.9904-2.2528 1.3312-4.608 2.56-6.8608 3.9424-21.9136 13.5168-34.816 32.9728-36.864 58.624-0.1024 1.536-0.1536 6.2976-0.1536 11.9808-0.1536 11.7248 9.2672 21.248 20.992 21.3504z m3.8912 24.0128c-15.7184 0.0512-28.7744 12.9536-28.6208 28.2624 0.1536 15.104 13.0048 27.9552 28.0576 28.0576 14.7456 0.1024 28.2112-13.1584 28.2624-27.8528 0.0512-14.8992-13.2096-28.5184-27.6992-28.4672z" fill="#FFFFFF" p-id="9606"></path>
<path d="M531.6096 755.9168c81.7152-22.5792 143.872-68.352 185.7024-139.7248 41.728-71.2704 51.0464-147.8144 30.72-229.9904 28.7232 21.504 49.3568 46.7968 63.7952 76.6976 41.0112 84.8384 25.1904 179.8144-40.704 247.7568-4.5056 4.608-6.4512 8.7552-5.0176 15.3088 2.3552 10.8544 3.9424 21.9136 5.4272 32.9216 1.5872 11.3152-2.4064 14.3872-12.8 10.0864-12.1856-5.0176-24.1664-10.5472-36.5056-15.1552-3.6352-1.3312-8.8064-1.5872-12.1856 0-49.7664 23.3984-101.0176 25.7024-153.5488 11.4688-3.1232-0.8192-6.1952-1.8432-9.1648-3.0208-4.6592-1.6896-9.216-3.6864-15.7184-6.3488z" fill="#FFFFFF" p-id="9607"></path>
<path
d="M453.4784 720.0256c-30.2592-0.1024-57.9584-4.1472-85.0944-12.4928a21.6576 21.6576 0 0 0-13.824 0.3072c-26.2144 9.7792-52.1216 20.2752-78.1824 30.3616-15.616 6.0416-22.5792 0.6144-20.0704-16.0768 3.3792-22.3232 6.9632-44.5952 11.1616-66.7136 1.0752-5.7344-0.256-9.2672-4.096-13.1584-36.4032-36.9152-59.5456-80.9984-69.4272-131.8912-20.5824-106.0352 25.7536-212.0192 117.4016-269.1072 93.952-58.5216 216.576-50.3296 301.8752 20.224 106.0352 87.7056 124.0064 243.5072 43.8784 351.8976-50.8928 68.9152-120.4224 103.0144-203.6224 106.6496z m-0.4096-189.7984h0.5632c11.6736 0.0512 21.1968-9.3184 21.2992-20.992 0-1.9968 0.0512-3.584 0.0512-4.352 0.1536-21.76 7.9872-25.9584 25.7024-34.8672 15.7696-7.936 30.3616-19.9168 36.096-37.1712 11.264-33.8432 5.2736-66.304-19.8144-91.5968-26.368-26.624-65.8944-34.3552-100.864-20.6848-23.1936 9.0624-39.168 27.648-47.616 50.3808-5.2736 14.1824 4.2496 29.5424 19.2 31.9488l0.6144 0.1024c10.752 1.7408 21.248-3.8912 26.0608-13.7216 7.2192-14.7968 21.6064-32.9216 48.8448-26.5216 15.8208 3.7376 29.6448 17.8176 32.2048 33.5872 2.9696 18.432-1.6896 27.4944-19.456 37.9904-2.2528 1.3312-4.608 2.56-6.8608 3.9424-21.9136 13.5168-34.816 32.9728-36.864 58.624-0.1024 1.536-0.1536 6.2976-0.1536 11.9808-0.1536 11.7248 9.2672 21.248 20.992 21.3504z m3.8912 24.0128c-15.7184 0.0512-28.7744 12.9536-28.6208 28.2624 0.1536 15.104 13.0048 27.9552 28.0576 28.0576 14.7456 0.1024 28.2112-13.1584 28.2624-27.8528 0.0512-14.8992-13.2096-28.5184-27.6992-28.4672z"
fill="#FFFFFF"
p-id="9606"
></path>
<path
d="M531.6096 755.9168c81.7152-22.5792 143.872-68.352 185.7024-139.7248 41.728-71.2704 51.0464-147.8144 30.72-229.9904 28.7232 21.504 49.3568 46.7968 63.7952 76.6976 41.0112 84.8384 25.1904 179.8144-40.704 247.7568-4.5056 4.608-6.4512 8.7552-5.0176 15.3088 2.3552 10.8544 3.9424 21.9136 5.4272 32.9216 1.5872 11.3152-2.4064 14.3872-12.8 10.0864-12.1856-5.0176-24.1664-10.5472-36.5056-15.1552-3.6352-1.3312-8.8064-1.5872-12.1856 0-49.7664 23.3984-101.0176 25.7024-153.5488 11.4688-3.1232-0.8192-6.1952-1.8432-9.1648-3.0208-4.6592-1.6896-9.216-3.6864-15.7184-6.3488z"
fill="#FFFFFF"
p-id="9607"
></path>
</svg>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
.card {
background-color: #fff;
height: 100%;
border-radius: 5px;
overflow: hidden;
}

.headerBanner {
height: 130px;
background: linear-gradient(to right, #7d3fff, #3f7dff);
}

.profileContent {
margin-top: -64px;
padding: 24px;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.profileInfo {
display: flex;

.userInfo {
margin-top: 60px;
margin-left: 30px;
text-align: left;
display: flex;
flex-direction: column;

.userName {
display: flex;
align-items: center;
flex-direction: row;
gap: 10px;

.nameInfo {
font-size: 26px;
font-weight: 500;
}
.nameAction {
padding: 12px 10px 8px 10px;
cursor: pointer;
&:hover {
background-color: #f0f0f0;
border-radius: 4px;
}
}
}
.userEmail {
font-size: 16px;
color: #717179;
}
}
}

.changeAvatarBtn {
margin-top: 16px;
}

.emailInput {
margin-top: 16px;
max-width: 300px;
}

.baseSection,
.settingsSection {
margin-top: 30px;
width: 100%;
max-width: 500px;
}

.baseSection {
.baseInfo {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 18px;
.baseItem {
display: flex;
flex-direction: column;
gap: 8px;

span:nth-child(1) {
color: #717179;
font-weight: 500;
font-size: 16px;
}

span:nth-child(2) {
color: #000;
font-size: 16px;
}
}
}
}

.splitLine {
margin-top: 24px;
height: 1.3px;
width: 500px;
background-color: #f0f0f0;
}

.settingsSection {
.settingsInfo {
display: flex;
margin-top: 18px;
width: 100%;

.settingsItem {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 500px;
width: 500px;
.settingsLeft {
display: flex;
gap: 10px;

.settingsIcon {
font-size: 20px;
margin-right: 8px;
color: #717179;
}

.settingsContent {
display: flex;
align-items: flex-start;

flex-direction: column;
.settingsTitle {
font-size: 16px;
font-weight: 500;
}
.settingsDesc {
font-size: 14px;
color: #717179;
}
}
}
}
}
}

.avatarWrapper {
position: relative;
width: 128px;
height: 128px;
border-radius: 8px;
.avatar {
width: 100%;
height: 100%;
border-radius: 8px;
border: 4px solid #fff;
}

.uploadOverlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
cursor: pointer;
transition: opacity 0.3s ease-in-out;
border-radius: 8px;

&:hover {
opacity: 1;
}
}

.overlayContent {
display: flex;
align-items: center;
justify-content: center;
}

.icon {
font-size: 32px; /* 替代 Tailwind 的 `h-8 w-8` */
color: #fff;
}
}
136 changes: 136 additions & 0 deletions packages/editor/src/pages/user/components/user-center/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { useState } from 'react';
import styles from './index.module.less';
import { Avatar, Input, Upload, Button } from 'antd';
import {
CameraOutlined,
EditOutlined,
LockOutlined,
MailOutlined,
PhoneOutlined,
SaveOutlined,
UserOutlined,
WechatOutlined,
} from '@ant-design/icons';

const UserCenter = () => {
const [email, setEmail] = useState('[email protected]');
const [avatar, setAvatar] = useState('https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png');
const userId = '673a9d4eb3227142511c7e1a';
const createdAt = new Date().toLocaleString();

const [userNameEdit, setUserNameEdit] = useState(false);

const handleAvatarUpload = (info: any) => {
if (info.file.status === 'done') {
const newAvatar = prompt('Enter new avatar URL');
if (newAvatar) setAvatar(newAvatar);
}
};

const uploadProps = {
action: 'https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload',
onChange: handleAvatarUpload,
multiple: true,
};

return (
<div className={styles.card}>
<div className={styles.headerBanner} />
<div className={styles.profileContent}>
<div className={styles.profileInfo}>
<div className={styles.avatarWrapper}>
<Avatar src={avatar || '/placeholder.svg'} size={128} className={styles.avatar}>
{!avatar && 'UN'}
</Avatar>
<Upload {...uploadProps} className={styles.uploadOverlay}>
<CameraOutlined className={styles.icon} />
</Upload>
</div>
<div className={styles.userInfo}>
<div className={styles.userName}>
{userNameEdit ? (
<Input type="text" value={email} onChange={(e) => setEmail(e.target.value)} onBlur={() => setUserNameEdit(false)} />
) : (
<div className={styles.nameInfo}>{email}</div>
)}
<div className={styles.nameAction} onClick={() => setUserNameEdit(!userNameEdit)}>
{userNameEdit ? <SaveOutlined /> : <EditOutlined />}
</div>
</div>
<div className={styles.userEmail}>{email}</div>
</div>
</div>
<div className={styles.baseSection}>
<h2>基本信息</h2>
<div className={styles.baseInfo}>
<div className={styles.baseItem}>
<span>User ID</span>
<span>{email}</span>
</div>
<div className={styles.baseItem}>
<span>注册日期</span>
<span>2024/11/20 21:44:35</span>
</div>
</div>
</div>
<div className={styles.splitLine} />
<div className={styles.settingsSection}>
<h2>账号安全</h2>
<div className={styles.settingsInfo}>
<div className={styles.settingsItem}>
<div className={styles.settingsLeft}>
<MailOutlined className={styles.settingsIcon} />
<div className={styles.settingsContent}>
<span className={styles.settingsTitle}>邮箱</span>
<span className={styles.settingsDesc}>[email protected]</span>
</div>
</div>
<Button>修改</Button>
</div>
</div>

<div className={styles.settingsInfo}>
<div className={styles.settingsItem}>
<div className={styles.settingsLeft}>
<LockOutlined className={styles.settingsIcon} />
<div className={styles.settingsContent}>
<span className={styles.settingsTitle}>密码更改</span>
<span className={styles.settingsDesc}>*********</span>
</div>
</div>
<Button>修改</Button>
</div>
</div>

<div className={styles.settingsInfo}>
<div className={styles.settingsItem}>
<div className={styles.settingsLeft}>
<PhoneOutlined className={styles.settingsIcon} />
<div className={styles.settingsContent}>
<span className={styles.settingsTitle}>手机绑定</span>
<span className={styles.settingsDesc}>敬请期待</span>
</div>
</div>
<Button disabled>绑定</Button>
</div>
</div>

<div className={styles.settingsInfo}>
<div className={styles.settingsItem}>
<div className={styles.settingsLeft}>
<WechatOutlined className={styles.settingsIcon} />
<div className={styles.settingsContent}>
<span className={styles.settingsTitle}>微信绑定</span>
<span className={styles.settingsDesc}>敬请期待</span>
</div>
</div>
<Button disabled>绑定</Button>
</div>
</div>
</div>
</div>
</div>
);
};

export default UserCenter;
Loading

0 comments on commit 3e26449

Please sign in to comment.