-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8aa6528
commit 3e26449
Showing
5 changed files
with
354 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 187 additions & 0 deletions
187
packages/editor/src/pages/user/components/user-center/index.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
136
packages/editor/src/pages/user/components/user-center/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.