6c04bb53ad
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m7s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m8s
CI/CD Pipeline / Frontend Unit Tests (push) Failing after 6m2s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m21s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 7m22s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 7m43s
CI/CD Pipeline / Integration Tests (push) Successful in 2m59s
CI/CD Pipeline / Unit Tests (push) Successful in 11m46s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 24m25s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
108 lines
2.6 KiB
TypeScript
108 lines
2.6 KiB
TypeScript
/**
|
|
* 更新主入口,引入全局样式
|
|
* V21 设计系统配置
|
|
*/
|
|
import React from "react"
|
|
import ReactDOM from "react-dom/client"
|
|
import { RouterProvider } from "react-router-dom"
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
|
import { ConfigProvider, App as AntApp } from "antd"
|
|
import zhCN from "antd/locale/zh_CN"
|
|
import router from "./router"
|
|
import { scheduleProactiveRefresh } from "./api/auth/tokenRefresh"
|
|
|
|
// 应用启动时,如果用户已登录,立即调度主动 token 刷新
|
|
// 这样可以在 token 过期前自动刷新,避免 API 请求触发 401
|
|
if (localStorage.getItem("access_token")) {
|
|
scheduleProactiveRefresh()
|
|
}
|
|
import "./index.css"
|
|
import "./styles/global.css"
|
|
|
|
// 创建 React Query 客户端
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
retry: 1,
|
|
refetchOnWindowFocus: false,
|
|
staleTime: 5 * 60 * 1000, // 5 分钟
|
|
gcTime: 10 * 60 * 1000, // 10 分钟
|
|
},
|
|
},
|
|
})
|
|
|
|
// V21 Ant Design 主题配置 - Indigo 主色 / 大圆角
|
|
const theme = {
|
|
token: {
|
|
// 主色调 - Indigo
|
|
colorPrimary: "#4f46e5",
|
|
colorSuccess: "#10b981",
|
|
colorWarning: "#f59e0b",
|
|
colorError: "#ef4444",
|
|
colorInfo: "#4f46e5",
|
|
|
|
// 圆角 - V21 大圆角
|
|
borderRadius: 14,
|
|
borderRadiusLG: 24,
|
|
borderRadiusSM: 8,
|
|
|
|
// 文字色
|
|
colorText: "#0f172a",
|
|
colorTextSecondary: "#64748b",
|
|
colorTextTertiary: "#94a3b8",
|
|
|
|
// 背景色
|
|
colorBgContainer: "#ffffff",
|
|
colorBgLayout: "#f8fafc",
|
|
|
|
// 边框色
|
|
colorBorder: "#e2e8f0",
|
|
colorBorderSecondary: "#f1f5f9",
|
|
|
|
// 阴影
|
|
boxShadow: "0 10px 30px rgba(15, 23, 42, 0.06)",
|
|
boxShadowSecondary: "0 24px 70px rgba(15, 23, 42, 0.09)",
|
|
},
|
|
components: {
|
|
Button: {
|
|
// 按钮圆角
|
|
borderRadius: 14,
|
|
// 主按钮渐变通过 CSS 实现
|
|
colorPrimary: "#4f46e5",
|
|
colorPrimaryHover: "#6366f1",
|
|
primaryShadow: "0 14px 26px rgba(79, 70, 229, 0.22)",
|
|
},
|
|
Card: {
|
|
borderRadiusLG: 28,
|
|
paddingLG: 28,
|
|
},
|
|
Input: {
|
|
borderRadius: 14,
|
|
},
|
|
Select: {
|
|
borderRadius: 14,
|
|
},
|
|
Modal: {
|
|
borderRadiusLG: 28,
|
|
},
|
|
InputNumber: {
|
|
borderRadius: 14,
|
|
},
|
|
DatePicker: {
|
|
borderRadius: 14,
|
|
},
|
|
},
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
<React.StrictMode>
|
|
<QueryClientProvider client={queryClient}>
|
|
<ConfigProvider locale={zhCN} theme={theme}>
|
|
<AntApp>
|
|
<RouterProvider router={router} />
|
|
</AntApp>
|
|
</ConfigProvider>
|
|
</QueryClientProvider>
|
|
</React.StrictMode>,
|
|
)
|