| @@ -163,5 +163,4 @@ export default defineConfig({ | |||||
| }, | }, | ||||
| javascriptEnabled: true, | javascriptEnabled: true, | ||||
| }, | }, | ||||
| // plugins: ['umi-plugin-keep-alive'], | |||||
| }); | }); | ||||
| @@ -29,6 +29,8 @@ export async function getInitialState(): Promise<{ | |||||
| loading?: boolean; | loading?: boolean; | ||||
| fetchUserInfo?: () => Promise<API.CurrentUser | undefined>; | fetchUserInfo?: () => Promise<API.CurrentUser | undefined>; | ||||
| }> { | }> { | ||||
| console.log('getInitialState'); | |||||
| const fetchUserInfo = async () => { | const fetchUserInfo = async () => { | ||||
| try { | try { | ||||
| const response = await getUserInfo({ | const response = await getUserInfo({ | ||||
| @@ -1,3 +1,9 @@ | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-28 08:47:43 | |||||
| * @Description: 覆盖 antd 样式 | |||||
| */ | |||||
| // 设置 Table 可以滑动 | // 设置 Table 可以滑动 | ||||
| .vertical-scroll-table { | .vertical-scroll-table { | ||||
| .ant-table-wrapper { | .ant-table-wrapper { | ||||
| @@ -9,7 +15,7 @@ | |||||
| height: 100%; | height: 100%; | ||||
| .ant-table { | .ant-table { | ||||
| height: calc(100% - 74px); | |||||
| height: calc(100% - 74px); // 分页控件的高度 | |||||
| .ant-table-container { | .ant-table-container { | ||||
| height: 100%; | height: 100%; | ||||
| @@ -380,10 +380,10 @@ const EditPipeline = () => { | |||||
| return ( | return ( | ||||
| cfg.anchorPoints || [ | cfg.anchorPoints || [ | ||||
| // 四个 | // 四个 | ||||
| // [0.5, 0], | |||||
| // [0.5, 1], | |||||
| [0, 0.5], | |||||
| [1, 0.5], | |||||
| [0.5, 0], | |||||
| [0.5, 1], | |||||
| // [0, 0.5], | |||||
| // [1, 0.5], | |||||
| ] | ] | ||||
| ); | ); | ||||
| }, | }, | ||||
| @@ -1,11 +1,11 @@ | |||||
| /* | /* | ||||
| * @Author: 赵伟 | * @Author: 赵伟 | ||||
| * @Date: 2024-03-25 13:52:54 | * @Date: 2024-03-25 13:52:54 | ||||
| * @Description: | |||||
| * @Description: 网络请求配置,详情请参考 https://umijs.org/docs/max/request | |||||
| */ | */ | ||||
| import type { RequestConfig } from '@umijs/max'; | import type { RequestConfig } from '@umijs/max'; | ||||
| import { message } from 'antd'; | import { message } from 'antd'; | ||||
| import { clearSessionToken, getAccessToken, getRefreshToken, getTokenExpireTime } from './access'; | |||||
| import { clearSessionToken, getAccessToken } from './access'; | |||||
| import { setRemoteMenu } from './services/session'; | import { setRemoteMenu } from './services/session'; | ||||
| import { gotoLoginPage } from './utils/ui'; | import { gotoLoginPage } from './utils/ui'; | ||||
| @@ -21,21 +21,25 @@ export const requestConfig: RequestConfig = { | |||||
| const authHeader = headers['Authorization']; | const authHeader = headers['Authorization']; | ||||
| const isToken = headers['isToken']; | const isToken = headers['isToken']; | ||||
| if (!authHeader && isToken !== false) { | if (!authHeader && isToken !== false) { | ||||
| const expireTime = getTokenExpireTime(); | |||||
| if (expireTime) { | |||||
| const left = Number(expireTime) - new Date().getTime(); | |||||
| const refreshToken = getRefreshToken(); | |||||
| if (left < 0 && refreshToken) { | |||||
| clearSessionToken(); | |||||
| } else { | |||||
| const accessToken = getAccessToken(); | |||||
| if (accessToken) { | |||||
| headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| } | |||||
| } | |||||
| } else { | |||||
| clearSessionToken(); | |||||
| const accessToken = getAccessToken(); | |||||
| if (accessToken) { | |||||
| headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| } | } | ||||
| // const expireTime = getTokenExpireTime(); | |||||
| // if (expireTime) { | |||||
| // const left = Number(expireTime) - new Date().getTime(); | |||||
| // const refreshToken = getRefreshToken(); | |||||
| // if (left < 0 && refreshToken) { | |||||
| // clearSessionToken(); | |||||
| // } else { | |||||
| // const accessToken = getAccessToken(); | |||||
| // if (accessToken) { | |||||
| // headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| // } | |||||
| // } | |||||
| // } else { | |||||
| // clearSessionToken(); | |||||
| // } | |||||
| } | } | ||||
| return { url, options }; | return { url, options }; | ||||
| }, | }, | ||||
| @@ -1,4 +1,10 @@ | |||||
| // 全局颜色变量 | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-28 08:47:43 | |||||
| * @Description: 全局变量,可以直接在 less 文件里使用,无需引入;也可以导入到 js 里使用;为 antd 主题修改提供常量值 | |||||
| */ | |||||
| // 颜色 | |||||
| @primary-color: #1664ff; // 主色调 | @primary-color: #1664ff; // 主色调 | ||||
| @primary-color-hover: #69b1ff; | @primary-color-hover: #69b1ff; | ||||
| @background-color: #f9fafb; // 页面背景颜色 | @background-color: #f9fafb; // 页面背景颜色 | ||||
| @@ -1,3 +1,9 @@ | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-08 09:54:39 | |||||
| * @Description: 定义全局类型,比如无关联的页面都需要要的类型 | |||||
| */ | |||||
| // 流水线全局参数 | // 流水线全局参数 | ||||
| export type PipelineGlobalParam = { | export type PipelineGlobalParam = { | ||||
| param_name: string; | param_name: string; | ||||
| @@ -48,7 +48,7 @@ export const getFileListFromEvent = (e: any) => { | |||||
| // 去登录页面 | // 去登录页面 | ||||
| export const gotoLoginPage = (toHome: boolean = true) => { | export const gotoLoginPage = (toHome: boolean = true) => { | ||||
| const { search, pathname } = window.location; | |||||
| const { pathname, search } = window.location; | |||||
| const urlParams = new URLSearchParams(); | const urlParams = new URLSearchParams(); | ||||
| urlParams.append('redirect', pathname + search); | urlParams.append('redirect', pathname + search); | ||||
| const newSearch = toHome ? '' : urlParams.toString(); | const newSearch = toHome ? '' : urlParams.toString(); | ||||