|
@@ -1,23 +1,39 @@
|
|
|
|
|
|
-import { Layout, Switch } from 'antd';
|
|
|
-import { GithubOutlined } from '@ant-design/icons';
|
|
|
+import { Button, Dropdown, Layout, message, Switch} from 'antd';
|
|
|
import useConfigStore from '../../store/config';
|
|
|
+import LogoIcon from "@src/assets/images/login/logo.svg?react";
|
|
|
+import Icon from "@ant-design/icons";
|
|
|
+import { logout } from "../../http/sso";
|
|
|
+import { useNavigate } from 'react-router-dom';
|
|
|
+
|
|
|
const { Header } = Layout;
|
|
|
|
|
|
const Headerbar = (props: { colorBgContainer: string }) => {
|
|
|
+ const navigate = useNavigate()
|
|
|
const setAlgorithm = useConfigStore(state => state.setAlgorithm)
|
|
|
- const setCompactAlgorithm = useConfigStore(state => state.setCompactAlgorithm)
|
|
|
+
|
|
|
+ const logoutHandle = async () => {
|
|
|
+ await logout()
|
|
|
+ message.success('已退出账号')
|
|
|
+ // TODO: 退出后跳转登录页
|
|
|
+ navigate('/login')
|
|
|
+ }
|
|
|
|
|
|
return (
|
|
|
- <Header title='React Admin Dashboard' style={{ padding: 0, background: props.colorBgContainer }}>
|
|
|
- <div style={{ display: 'flex', alignItems: 'center', height: '100%', padding: "0 20px", justifyContent: 'space-between' }}>
|
|
|
- <h2>React Admin Dashboard</h2>
|
|
|
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
|
|
+ <Header title='票圈内容合作平台' className='bg-[#20214F] px-[0]'>
|
|
|
+ <div className='text-[#9090a7] flex items-center justify-between h-full px-[20px] '>
|
|
|
+ <div className='flex items-center gap-[12px]'>
|
|
|
+ <Icon component={LogoIcon} className='text-[40px]' />
|
|
|
+ <span className='text-lg font-bold'>票圈内容合作平台</span>
|
|
|
+ </div>
|
|
|
+ <div className='flex items-center gap-[10px] cursor-pointer'>
|
|
|
<Switch checkedChildren="Light" unCheckedChildren="Dark" defaultChecked onChange={(checked) => setAlgorithm(checked ? 'default' : 'dark')} />
|
|
|
- <Switch checkedChildren="Compact" unCheckedChildren="Loose" onChange={(checked) => setCompactAlgorithm(checked ? 'compact' : '')} />
|
|
|
- <p style={{ marginRight: 10 }}>Yujian Xue</p>
|
|
|
- <img src="https://avatars.githubusercontent.com/u/48818060?s=48&v=4" alt="avatar" style={{ width: 40, height: 40 }} />
|
|
|
- <GithubOutlined style={{ fontSize: 30 }} onClick={() => window.open('https://github.com/larry-xue/react-admin-dashboard')} />
|
|
|
+ <Dropdown trigger={['hover']} menu={{items: [{label: (<Button type="primary" onClick={logoutHandle}>退出账号</Button>), key: 'logout'}]}}>
|
|
|
+ <view className='flex items-center gap-[10px]'>
|
|
|
+ <view>Yujian Xue</view>
|
|
|
+ <img src="https://avatars.githubusercontent.com/u/48818060?s=48&v=4" alt="avatar" style={{ width: 40, height: 40 }} />
|
|
|
+ </view>
|
|
|
+ </Dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
</Header>
|