|
|
|
@@ -1,13 +1,12 @@ |
|
|
|
import { clearSessionToken } from '@/access'; |
|
|
|
import { PageEnum } from '@/enums/pagesEnums'; |
|
|
|
import { setRemoteMenu } from '@/services/session'; |
|
|
|
import { logout } from '@/services/system/auth'; |
|
|
|
import { gotoLoginPage } from '@/utils/ui'; |
|
|
|
import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; |
|
|
|
import { setAlpha } from '@ant-design/pro-components'; |
|
|
|
import { useEmotionCss } from '@ant-design/use-emotion-css'; |
|
|
|
import { history, useModel } from '@umijs/max'; |
|
|
|
import { Avatar, Spin } from 'antd'; |
|
|
|
import { stringify } from 'querystring'; |
|
|
|
import type { MenuInfo } from 'rc-menu/lib/interface'; |
|
|
|
import React, { useCallback } from 'react'; |
|
|
|
import { flushSync } from 'react-dom'; |
|
|
|
@@ -23,7 +22,7 @@ const Name = () => { |
|
|
|
|
|
|
|
const nameClassName = useEmotionCss(({ token }) => { |
|
|
|
return { |
|
|
|
width: '70px', |
|
|
|
// width: '70px', |
|
|
|
height: '48px', |
|
|
|
overflow: 'hidden', |
|
|
|
lineHeight: '48px', |
|
|
|
@@ -64,19 +63,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => { |
|
|
|
await logout(); |
|
|
|
clearSessionToken(); |
|
|
|
setRemoteMenu(null); |
|
|
|
const { search, pathname } = window.location; |
|
|
|
const urlParams = new URL(window.location.href).searchParams; |
|
|
|
/** 此方法会跳转到 redirect 参数所在的位置 */ |
|
|
|
const redirect = urlParams.get('redirect'); |
|
|
|
// Note: There may be security issues, please note |
|
|
|
if (window.location.pathname !== PageEnum.LOGIN && !redirect) { |
|
|
|
history.replace({ |
|
|
|
pathname: PageEnum.LOGIN, |
|
|
|
search: stringify({ |
|
|
|
redirect: pathname + search, |
|
|
|
}), |
|
|
|
}); |
|
|
|
} |
|
|
|
gotoLoginPage(); |
|
|
|
}; |
|
|
|
const actionClassName = useEmotionCss(({ token }) => { |
|
|
|
return { |
|
|
|
|