| @@ -58,9 +58,12 @@ function IframePage({ type, openInTab = false, className, style }: IframePagePro | |||||
| useEffect(() => { | useEffect(() => { | ||||
| const requestIframeUrl = async () => { | const requestIframeUrl = async () => { | ||||
| setLoading(true); | |||||
| const [res] = await to(getRequestAPI(type)()); | const [res] = await to(getRequestAPI(type)()); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| setIframeUrl(res.data); | setIframeUrl(res.data); | ||||
| } else { | |||||
| setLoading(false); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -4,7 +4,7 @@ | |||||
| right: 0; | right: 0; | ||||
| bottom: 0; | bottom: 0; | ||||
| left: 0; | left: 0; | ||||
| z-index: 1001; | |||||
| z-index: 1001; // 设置大于 Modal 的 z-index | |||||
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| align-items: center; | align-items: center; | ||||
| @@ -2,6 +2,7 @@ import { clearSessionToken } from '@/access'; | |||||
| import { setRemoteMenu } from '@/services/session'; | import { setRemoteMenu } from '@/services/session'; | ||||
| import { logout } from '@/services/system/auth'; | import { logout } from '@/services/system/auth'; | ||||
| import { ClientInfo } from '@/types'; | import { ClientInfo } from '@/types'; | ||||
| import { sleep } from '@/utils/promise'; | |||||
| import SessionStorage from '@/utils/sessionStorage'; | import SessionStorage from '@/utils/sessionStorage'; | ||||
| import { gotoLoginPage, oauthLogout } from '@/utils/ui'; | import { gotoLoginPage, oauthLogout } from '@/utils/ui'; | ||||
| import { LogoutOutlined, UserOutlined } from '@ant-design/icons'; | import { LogoutOutlined, UserOutlined } from '@ant-design/icons'; | ||||
| @@ -63,7 +64,8 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => { | |||||
| */ | */ | ||||
| const loginOut = async () => { | const loginOut = async () => { | ||||
| oauthLogout('http://172.20.32.197:31209/oauth/logout'); | oauthLogout('http://172.20.32.197:31209/oauth/logout'); | ||||
| await logout(); | |||||
| // 至少 1 秒后跳转,希望子系统能完成注销 | |||||
| await Promise.all([logout(), sleep(1000)]); | |||||
| clearSessionToken(); | clearSessionToken(); | ||||
| setRemoteMenu(null); | setRemoteMenu(null); | ||||
| gotoLoginPage(); | gotoLoginPage(); | ||||
| @@ -13,3 +13,16 @@ export async function to<T, U = any>(promise: Promise<T>): Promise<[T, null] | [ | |||||
| } | } | ||||
| export default to; | export default to; | ||||
| /** | |||||
| * 休眠 | |||||
| * @param ms - The number of milliseconds to sleep. | |||||
| * @return A promise that resolves after the specified amount of time. | |||||
| */ | |||||
| export function sleep(ms: number) { | |||||
| return new Promise((resolve) => { | |||||
| setTimeout(() => { | |||||
| resolve(true); | |||||
| }, ms); | |||||
| }); | |||||
| } | |||||
| @@ -87,7 +87,7 @@ function formatArray(property?: string): TableCellFormatter { | |||||
| * @param ellipsis - 是否省略 | * @param ellipsis - 是否省略 | ||||
| * @param type - 类型 | * @param type - 类型 | ||||
| * @param options - 选项 | * @param options - 选项 | ||||
| * @returns React 节点 | |||||
| * @returns Ant Design Table 的 render | |||||
| */ | */ | ||||
| function tableCellRender<T>( | function tableCellRender<T>( | ||||
| ellipsis: boolean | TooltipProps | 'auto' = false, | ellipsis: boolean | TooltipProps | 'auto' = false, | ||||