|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-11-09 13:57:41
|
|
|
- * @LastEditTime: 2022-02-09 14:09:24
|
|
|
+ * @LastEditTime: 2022-02-14 17:33:26
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
* @FilePath: /KC-MiddlePlatform/src/app.ts
|
|
@@ -14,10 +14,11 @@ import { RequestConfig, history } from 'umi';
|
|
|
import type { RequestOptionsInit } from 'umi-request';
|
|
|
import { getHospSubSystemList } from '@/service/login';
|
|
|
|
|
|
-import {
|
|
|
- BasicLayoutProps,
|
|
|
- Settings as LayoutSettings,
|
|
|
-} from '@ant-design/pro-layout';
|
|
|
+import { BasicLayoutProps, Settings as LayoutSettings } from '@ant-design/pro-layout';
|
|
|
+import { logoutHandle } from './global';
|
|
|
+
|
|
|
+import platformIcon from '../public/images/platformIcon.png';
|
|
|
+import { Platforms } from './constant';
|
|
|
|
|
|
const loginPath = '/login';
|
|
|
|
|
@@ -63,16 +64,19 @@ export async function getInitialState(): Promise<InitialStateType> {
|
|
|
return undefined;
|
|
|
};
|
|
|
|
|
|
+ const getAppIcon = (name: string) => {
|
|
|
+ return Platforms.filter((i) => i.name == name).length > 0
|
|
|
+ ? Platforms.filter((i) => i.name == name)[0].logo
|
|
|
+ : '';
|
|
|
+ };
|
|
|
+
|
|
|
//获取当前账号所有子应用列表
|
|
|
const getHospSubSystemListFunc = async () => {
|
|
|
const data = await getHospSubSystemList();
|
|
|
if (data) {
|
|
|
const _data = data.map((t) => ({
|
|
|
...t,
|
|
|
- icon:
|
|
|
- t.name == '业务中台'
|
|
|
- ? 'https://i.postimg.cc/J4fsWx1V/2x.png'
|
|
|
- : 'https://i.postimg.cc/yNrSZ4pN/2x.png',
|
|
|
+ icon: getAppIcon(t.name),
|
|
|
url: t.name == '业务中台' ? '/platform/setting/userManage' : '/app1',
|
|
|
}));
|
|
|
|
|
@@ -81,11 +85,7 @@ export async function getInitialState(): Promise<InitialStateType> {
|
|
|
return [];
|
|
|
};
|
|
|
|
|
|
- const logout = () => {
|
|
|
- localStorage.removeItem('userData');
|
|
|
- history.replace(`${loginPath}?hospSign=${hospSign}`);
|
|
|
- return Promise.resolve(true);
|
|
|
- };
|
|
|
+ const logout = logoutHandle;
|
|
|
|
|
|
const userData = await fetchUserInfo();
|
|
|
|
|
@@ -108,10 +108,7 @@ export async function getInitialState(): Promise<InitialStateType> {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-const requestInterceptorsHandle = (
|
|
|
- url: string,
|
|
|
- options: RequestOptionsInit,
|
|
|
-) => {
|
|
|
+const requestInterceptorsHandle = (url: string, options: RequestOptionsInit) => {
|
|
|
const userData = localStorage.getItem('userData');
|
|
|
let authHeader = { token: '' };
|
|
|
|
|
@@ -126,10 +123,7 @@ const requestInterceptorsHandle = (
|
|
|
};
|
|
|
};
|
|
|
|
|
|
-const responseInterceptorsHandle = async (
|
|
|
- response: Response,
|
|
|
- options: RequestOptionsInit,
|
|
|
-) => {
|
|
|
+const responseInterceptorsHandle = async (response: Response, options: RequestOptionsInit) => {
|
|
|
const _response: {
|
|
|
data?: any;
|
|
|
status: number;
|
|
@@ -141,8 +135,11 @@ const responseInterceptorsHandle = async (
|
|
|
if (_response.data) {
|
|
|
return _response.data;
|
|
|
}
|
|
|
+ // notification.success({
|
|
|
+ // message: `${_response.msg}`,
|
|
|
+ // });
|
|
|
notification.success({
|
|
|
- message: `${_response.msg}`,
|
|
|
+ message: `操作成功!`,
|
|
|
});
|
|
|
return {
|
|
|
status: _response.status,
|
|
@@ -242,9 +239,7 @@ export const qiankun = fetch('/config').then(() => ({
|
|
|
],
|
|
|
// 完整生命周期钩子请看 https://qiankun.umijs.org/zh/api/#registermicroapps-apps-lifecycles
|
|
|
lifeCycles: {
|
|
|
- afterMount: (props: any) => {
|
|
|
- console.log(props);
|
|
|
- },
|
|
|
+ afterMount: (props: any) => {},
|
|
|
},
|
|
|
// 支持更多的其他配置,详细看这里 https://qiankun.umijs.org/zh/api/#start-opts
|
|
|
}));
|
|
@@ -260,19 +255,11 @@ export function useQiankunStateForSlave() {
|
|
|
}
|
|
|
|
|
|
export const layout = ({
|
|
|
- initialState: {
|
|
|
- systemLists = [],
|
|
|
- openedSysLists = [],
|
|
|
- userData,
|
|
|
- currentSelectedSys,
|
|
|
- },
|
|
|
+ initialState: { userData },
|
|
|
}: {
|
|
|
initialState: InitialStateType;
|
|
|
}): BasicLayoutProps => {
|
|
|
return {
|
|
|
- // headerRender: () => (
|
|
|
- // <TopHoc systemLists={systemLists} openedSysLists={openedSysLists} currentSelectedSys={currentSelectedSys} />
|
|
|
- // ),
|
|
|
headerRender: false,
|
|
|
rightContentRender: () => <>right</>,
|
|
|
footerRender: () => null,
|