feat: menu

This commit is contained in:
2025-09-17 10:41:00 +08:00
parent 9d5a289929
commit aada97ed22
27 changed files with 973 additions and 527 deletions

View File

@@ -1,5 +1,11 @@
import React, { Children, Component, JSX, Suspense } from "react";
import { Spin } from "antd";
import React, {
Children,
Component,
createContext,
JSX,
Suspense,
} from "react";
import { Modal, Spin } from "antd";
import type { Settings as LayoutSettings } from "@ant-design/pro-components";
import { SettingDrawer } from "@ant-design/pro-components";
import type { RequestConfig, RunTimeLayoutConfig } from "@umijs/max";
@@ -197,6 +203,34 @@ export const request: RequestConfig = {
return { url, options: { ...options, headers } };
},
],
// 添加参数序列化配置
paramsSerializer: (params) => {
const searchParams = new URLSearchParams();
const appendParams = (key: string, value: any) => {
if (Array.isArray(value)) {
// 特殊处理 createTime 数组,转换为 createTime[0] 和 createTime[1] 格式
if (key === "createTime") {
value.forEach((val, index) => {
searchParams.append(`${key}[${index}]`, val);
});
} else {
// 其他数组参数保持默认行为
value.forEach((val) => {
searchParams.append(`${key}[]`, val);
});
}
} else if (value !== null && value !== undefined) {
searchParams.append(key, String(value));
}
};
Object.keys(params).forEach((key) => {
appendParams(key, params[key]);
});
return searchParams.toString();
},
};
// umi 4 使用 modifyRoutes
export function patchClientRoutes({ routes }: { routes: any }) {