pay-admin/src/common/libs/umi/layoutConfig.tsx
Your Name 4b850b41bc style: update theme tokens to white color scheme
- Update bgLayout to #f5f5f5 (light gray layout background)
- Update header colorBgHeader to #ffffff (white header background)
- Update header text colors to dark (#262626, #595959)
- Increase header height to 64px
- Add comprehensive sider color tokens for white menu theme
- Add selected menu item styling with blue highlight

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 14:52:18 +08:00

83 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// import Logo from '@/assets/bitcoin.webp';
import { MyIcons, MyIconsType, PermissionsType, useMyState } from '@/common';
import { Link, RuntimeConfig, history } from '@umijs/max';
import AvatarProps from '../../components/layout/AvatarProps';
const loopMenu = (permissions: PermissionsType[] | undefined) => {
let tree: PermissionsType[] = [];
let map: Record<number, PermissionsType> = {};
permissions?.forEach((permission) => {
map[permission.id] = {
path: permission.type === 'Button' ? 'null' : permission.path,
name: permission.name,
icon: permission.icon && MyIcons[permission.icon as MyIconsType],
children: [],
hideInMenu: permission.type === 'Button',
};
});
permissions?.forEach((permission) => {
let node = map[permission.id];
if (permission.parent_id !== null) {
map[permission.parent_id].children.push(node);
} else {
tree.push(node);
}
});
return tree?.[0]?.children;
};
export const LayoutConfig: RuntimeConfig['layout'] = () => {
const { snap } = useMyState();
return {
title: snap.session.campus?.name ?? '总后台',
logo: false, // 禁用默认logo使用自定义
layout: 'side', // 从 'mix' 改为 'side'
colorPrimary: '#1890ff',
siderWidth: 220,
pure: history.location.pathname === '/login',
avatarProps: {
render: () => <AvatarProps user={snap.session.user} />,
},
//水印设置
// waterMarkProps: {
// content: snap.session.user?.username,
// },
collapsedButtonRender: false,
token: {
bgLayout: '#f5f5f5', // 浅灰布局背景
header: {
colorBgHeader: '#ffffff', // 白色header背景
colorHeaderTitle: '#262626', // 深色标题文字
colorTextRightActionsItem: '#595959', // 深色操作文字
heightLayoutHeader: 64, // Header高度64px
},
sider: {
colorMenuBackground: '#ffffff', // 白色菜单背景
colorMenuText: '#595959', // 深色菜单文字
colorMenuTextSelected: '#1890ff', // 激活菜单文字蓝色
colorMenuItemBgSelected: '#e6f7ff', // 激活菜单背景浅蓝
colorMenuDivider: '#f0f0f0', // 分割线颜色
},
},
menuItemRender: (item, dom) => <Link to={item.path || '/'}>{dom}</Link>,
menu: {
params: snap.session.permissions,
request: async () => {
let objjs: any = [];
snap.session.permissions?.forEach((res: any) => {
objjs.push(res);
});
let data = objjs.sort((a: any, b: any) => {
return a._lft - b._lft;
});
const menus = loopMenu(data);
return Promise.resolve(menus);
},
},
unAccessible: <div>unAccessible</div>,
};
};