|
|
@@ -11,6 +11,8 @@ import { useCallback } from 'react'; |
|
|
|
import { useState } from 'react'; |
|
|
|
import styles from './UserCenter.less'; |
|
|
|
import defaultAvatorImg from '@/assets/avator_default.svg'; |
|
|
|
import FolderSetModal from './FolderSetModal'; |
|
|
|
import { isClient } from '@/services/system'; |
|
|
|
|
|
|
|
interface UserCenterProps { |
|
|
|
className?: string; |
|
|
@@ -25,14 +27,14 @@ export default function UserCenter(props: UserCenterProps) { |
|
|
|
setPopVisible(nextVisible); |
|
|
|
}, []); |
|
|
|
|
|
|
|
const onLogoutBtnClick = useCallback(() => { |
|
|
|
const hidePop = useCallback(() => { |
|
|
|
setPopVisible(false); |
|
|
|
}, []); |
|
|
|
|
|
|
|
return ( |
|
|
|
<Popover |
|
|
|
overlayClassName={styles.popWrapper} |
|
|
|
content={<PopContent onLogoutBtnClick={onLogoutBtnClick} />} |
|
|
|
content={<PopContent hidePop={hidePop} />} |
|
|
|
trigger="click" |
|
|
|
visible={popVisible} |
|
|
|
onVisibleChange={onVisibleChange} |
|
|
@@ -50,19 +52,20 @@ export default function UserCenter(props: UserCenterProps) { |
|
|
|
} |
|
|
|
|
|
|
|
interface PopContentProps { |
|
|
|
onLogoutBtnClick: () => void; |
|
|
|
hidePop: () => void; |
|
|
|
} |
|
|
|
|
|
|
|
function PopContent(props: PopContentProps) { |
|
|
|
const { onLogoutBtnClick } = props; |
|
|
|
const { hidePop } = props; |
|
|
|
const { |
|
|
|
refresh, |
|
|
|
initialState: { currentUser } = {}, |
|
|
|
setInitialState, |
|
|
|
} = useModel('@@initialState'); |
|
|
|
const [folderSetModalVisible, setFolderSetModalVisbile] = useState(false); |
|
|
|
|
|
|
|
const tryLogout = useCallback(() => { |
|
|
|
if (onLogoutBtnClick) onLogoutBtnClick(); |
|
|
|
if (hidePop) hidePop(); |
|
|
|
confirm({ |
|
|
|
onOk() { |
|
|
|
logout(); |
|
|
@@ -88,16 +91,24 @@ function PopContent(props: PopContentProps) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles.popContent}> |
|
|
|
{/* <div className={styles.listGroupTitle}><div>账号</div></div> |
|
|
|
<div className={styles.listItem}> |
|
|
|
{/* <div className={styles.listGroupTitle}><div>账号</div></div> */} |
|
|
|
{/* <div className={styles.listItem}> |
|
|
|
<span>账号设置</span> |
|
|
|
<RightOutlined color="#8E909F" /> |
|
|
|
</div> |
|
|
|
<div className={styles.listItem}> |
|
|
|
<span>同步设置</span> |
|
|
|
<RightOutlined color="#8E909F" /> |
|
|
|
</div> |
|
|
|
<div className={styles.listGroupTitle}><div>其他</div></div> |
|
|
|
</div> */} |
|
|
|
{isClient ? ( |
|
|
|
<div |
|
|
|
className={styles.listItem} |
|
|
|
onClick={() => { |
|
|
|
setFolderSetModalVisbile(true); |
|
|
|
hidePop(); |
|
|
|
}} |
|
|
|
> |
|
|
|
<span>同步设置</span> |
|
|
|
<RightOutlined color="#8E909F" /> |
|
|
|
</div> |
|
|
|
) : null} |
|
|
|
{/* <div className={styles.listGroupTitle}><div>其他</div></div> |
|
|
|
<div className={styles.listItem}> |
|
|
|
<span>系统版本</span> |
|
|
|
<RightOutlined color="#8E909F" /> |
|
|
@@ -112,6 +123,12 @@ function PopContent(props: PopContentProps) { |
|
|
|
</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{isClient ? ( |
|
|
|
<FolderSetModal |
|
|
|
visible={folderSetModalVisible} |
|
|
|
onCancel={() => setFolderSetModalVisbile(false)} |
|
|
|
/> |
|
|
|
) : null} |
|
|
|
</div> |
|
|
|
); |
|
|
|
} |