| | |
| | | import defaultSettings from '../config/defaultSettings'; |
| | | import { errorConfig } from './requestErrorConfig'; |
| | | import { getRemoteMenu, getRoutersInfo, getUserInfo, setRemoteMenu, patchRouteWithRemoteMenus } from './services/route'; |
| | | import { getToken } from '@/utils/token-util' |
| | | import { getToken, setToken } from '@/utils/token-util' |
| | | import { TOKEN_HEADER_NAME, TOKEN_STORE_NAME } from '@/config/setting'; |
| | | import { API_BASE_URL } from '@/config/setting' |
| | | import { message } from 'antd'; |
| | |
| | | const loginPath = '/user/login'; |
| | | const defaultAvatar = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png' |
| | | |
| | | // https://xflow.antv.vision/zh-CN/docs/tutorial/solutions/dag DAG 流程图 |
| | | // https://ant-design.antgroup.com/components/table-cn 表格 |
| | | // https://procomponents.ant.design/components/form 表单pro |
| | | export function render(oldRender) { |
| | | const token = getToken(); |
| | | if (!token || token?.length === 0) { |
| | |
| | | }, |
| | | }, |
| | | waterMarkProps: { |
| | | content: initialState?.currentUser?.nickname, |
| | | // content: initialState?.currentUser?.nickname, |
| | | }, |
| | | footerRender: () => <Footer />, |
| | | onPageChange: () => { |
| | |
| | | history.push(loginPath); |
| | | } |
| | | }, |
| | | // token: { |
| | | // bgLayout: '#fff', |
| | | // header: { |
| | | // colorBgHeader: '#fff', |
| | | // }, |
| | | // sider: { |
| | | // colorMenuBackground: '#fff', |
| | | // }, |
| | | // pageContainer: { |
| | | // colorBgPageContainer: '#fff', |
| | | // }, |
| | | // }, |
| | | bgLayoutImgList: [ |
| | | { |
| | | src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr', |
| | |
| | | // 前置守卫 |
| | | requestInterceptors: [ |
| | | (url, options) => { |
| | | console.log('request ====>:', url); |
| | | const token = getToken(); |
| | | if (token && options.headers) { |
| | | options.headers[TOKEN_HEADER_NAME] = token; |
| | |
| | | // })); |
| | | history.push(loginPath) |
| | | } |
| | | console.log(response); |
| | | const token = response.headers[TOKEN_HEADER_NAME]; |
| | | if (token) { |
| | | setToken(token); |
| | | } |
| | | return response; |
| | | } |
| | | ] |