| | |
| | | }, |
| | | "lint-staged": { |
| | | "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", |
| | | "**/*.{js,jsx,tsx,ts,less,md,json}": ["prettier --write"] |
| | | "**/*.{js,jsx,tsx,ts,less,md,json}": [ |
| | | "prettier --write" |
| | | ] |
| | | }, |
| | | "browserslist": ["> 1%", "last 2 versions", "not ie <= 10"], |
| | | "browserslist": [ |
| | | "> 1%", |
| | | "last 2 versions", |
| | | "not ie <= 10" |
| | | ], |
| | | "dependencies": { |
| | | "@ant-design/icons": "^4.8.1", |
| | | "@ant-design/icons": "^5.3.0", |
| | | "@ant-design/pro-components": "^2.6.48", |
| | | "@umijs/route-utils": "^2.2.2", |
| | | "antd": "^5.13.2", |
| | |
| | | "umi-presets-pro": "^2.0.3", |
| | | "umi-serve": "^1.9.11" |
| | | }, |
| | | "engines": { "node": ">=12.0.0" } |
| | | "engines": { |
| | | "node": ">=12.0.0" |
| | | } |
| | | } |
| | |
| | | import React from 'react'; |
| | | import { Footer, Question, SelectLang, AvatarDropdown, AvatarName } from '@/components'; |
| | | import { Footer, Question, SelectLang, AvatarDropdown, AvatarName, Brightness } from '@/components'; |
| | | import { LinkOutlined } from '@ant-design/icons'; |
| | | import { SettingDrawer } from '@ant-design/pro-components'; |
| | | import { history, Link } from '@umijs/max'; |
| | |
| | | // 优先级 layout > config > defaultSetting |
| | | export const layout = ({ initialState, setInitialState }) => { |
| | | return { |
| | | actionsRender: () => [<Question key="doc" />, <SelectLang key="SelectLang" />], |
| | | actionsRender: () => [<Brightness />, <Question key="doc" />, <SelectLang key="SelectLang" />], |
| | | avatarProps: { |
| | | src: initialState?.currentUser?.avatar, |
| | | title: <AvatarName />, |
| | |
| | | }, |
| | | ], |
| | | // 显示在菜单右下角的快捷操作 |
| | | links: false |
| | | // links: isDev |
| | | ? [ |
| | | <Link key="openapi" to="/umi/plugin/openapi" target="_blank"> |
| | | <LinkOutlined /> |
| | | <span>OpenAPI 文档</span> |
| | | </Link>, |
| | | ] |
| | | : [], |
| | | links: [], |
| | | menuHeaderRender: undefined, |
| | | // 自定义 403 页面 |
| | | // unAccessible: <div>unAccessible</div>, |
| | |
| | | ); |
| | | }, |
| | | ...initialState?.settings, |
| | | layout: 'top', // layout 的菜单模式,side:右侧导航,top:顶部导航 |
| | | layout: 'mix', // layout 的菜单模式,side:右侧导航,top:顶部导航 |
| | | // contentStyle: () => { // layout 的内容区 style |
| | | // return |
| | | // }, |
| | |
| | | fixedHeader: true, // 固定 header |
| | | fixSiderbar: true, // 固定导航 |
| | | // settings: defaultSettings, // layout 的设置 |
| | | waterMarkProps: { content: initialState?.currentUser?.nickname }, //水印 |
| | | // waterMarkProps: { content: initialState?.currentUser?.nickname }, //水印 |
| | | navTheme: 'realDark', // 默认主题颜色 "realDark" | "light" | undef... |
| | | footerRender: false, // 页脚 启用请注释,不是设置为true |
| | | }; |
| | |
| | | import { QuestionCircleOutlined } from '@ant-design/icons'; |
| | | import { SelectLang as UmiSelectLang } from '@umijs/max'; |
| | | import React from 'react'; |
| | | import { MoonOutlined, BulbOutlined } from '@ant-design/icons'; |
| | | |
| | | export type SiderTheme = 'light' | 'dark'; |
| | | |
| | |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | | export const Brightness = () => { |
| | | return ( |
| | | <> |
| | | <div |
| | | style={{ |
| | | display: 'flex', |
| | | height: 26, |
| | | }} |
| | | onClick={() => { |
| | | window.open('https://pro.ant.design/docs/getting-started'); |
| | | }} |
| | | > |
| | | {/* <BulbOutlined /> */} |
| | | <MoonOutlined /> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | |
| | | * 布局组件 |
| | | */ |
| | | import Footer from './Footer'; |
| | | import { Question, SelectLang } from './RightContent'; |
| | | import { Question, SelectLang, Brightness } from './RightContent'; |
| | | import { AvatarDropdown, AvatarName } from './RightContent/AvatarDropdown'; |
| | | |
| | | export { Footer, Question, SelectLang, AvatarDropdown, AvatarName }; |
| | | export { Footer, Question, SelectLang, AvatarDropdown, AvatarName, Brightness }; |