| File was renamed from zy-asrs-flow/src/components/RightContent/AvatarDropdown.tsx | 
|  |  |  | 
|---|
|  |  |  | import { Spin } from 'antd'; | 
|---|
|  |  |  | import { createStyles } from 'antd-style'; | 
|---|
|  |  |  | import { stringify } from 'querystring'; | 
|---|
|  |  |  | import type { MenuInfo } from 'rc-menu/lib/interface'; | 
|---|
|  |  |  | import React, { useCallback } from 'react'; | 
|---|
|  |  |  | import { flushSync } from 'react-dom'; | 
|---|
|  |  |  | import HeaderDropdown from '../HeaderDropdown'; | 
|---|
|  |  |  | import { setRemoteMenu } from '@/services/route' | 
|---|
|  |  |  | import { removeToken } from '@/utils/token-util' | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export type GlobalHeaderRightProps = { | 
|---|
|  |  |  | menu?: boolean; | 
|---|
|  |  |  | children?: React.ReactNode; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const AvatarName = () => { | 
|---|
|  |  |  | const { initialState } = useModel('@@initialState'); | 
|---|
|  |  |  | const { currentUser } = initialState || {}; | 
|---|
|  |  |  | return <span className="anticon">{currentUser?.name}</span>; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const useStyles = createStyles(({ token }) => { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, children }) => { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 退出登录,并且将当前的 url 保存 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | export const AvatarName = () => { | 
|---|
|  |  |  | const { initialState } = useModel('@@initialState'); | 
|---|
|  |  |  | const { currentUser } = initialState || {}; | 
|---|
|  |  |  | return <span className="anticon">{currentUser?.name}</span>; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const AvatarDropdown = ({ menu, children }) => { | 
|---|
|  |  |  | const { styles } = useStyles(); | 
|---|
|  |  |  | const { initialState, setInitialState } = useModel('@@initialState'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 退出登录,并且将当前的 url 保存 | 
|---|
|  |  |  | const loginOut = async () => { | 
|---|
|  |  |  | // await outLogin(); | 
|---|
|  |  |  | removeToken(); | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | const { styles } = useStyles(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { initialState, setInitialState } = useModel('@@initialState'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const onMenuClick = useCallback( | 
|---|
|  |  |  | (event: MenuInfo) => { | 
|---|
|  |  |  | const onMenuClick = useCallback((event) => { | 
|---|
|  |  |  | const { key } = event; | 
|---|
|  |  |  | if (key === 'logout') { | 
|---|
|  |  |  | flushSync(() => { | 
|---|
|  |  |  | 
|---|
|  |  |  | label: '个人设置', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: 'divider' as const, | 
|---|
|  |  |  | type: 'divider' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | key: 'logout', | 
|---|
|  |  |  | 
|---|
|  |  |  | "@@test/*": ["./src/.umi-test/*"] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | "include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx", "src/app.tsx", "src/utils/icon-util.js", "src/pages/User/Login/index1.jsx", "src/components/Footer/index.jsx", "src/components/HeaderDropdown/index.jsx", "src/pages/system/host/components/UpdateForm.jsx", "src/pages/system/host/index.jsx", "src/utils/tree-util.js", "src/components/RightContent/index.jsx"] | 
|---|
|  |  |  | "include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx", "src/app.tsx", "src/utils/icon-util.js", "src/pages/User/Login/index1.jsx", "src/components/Footer/index.jsx", "src/components/HeaderDropdown/index.jsx", "src/pages/system/host/components/UpdateForm.jsx", "src/pages/system/host/index.jsx", "src/utils/tree-util.js", "src/components/RightContent/index.jsx", "src/components/RightContent/AvatarDropdown.jsx"] | 
|---|
|  |  |  | } | 
|---|