diff --git a/src/components/SettingDrawer/RegionalChange.tsx b/src/components/SettingDrawer/RegionalChange.tsx index a9310eb..39df126 100644 --- a/src/components/SettingDrawer/RegionalChange.tsx +++ b/src/components/SettingDrawer/RegionalChange.tsx @@ -11,8 +11,6 @@ const RegionalSetting: React.FC<{ const formatMessage = getFormatMessage(); const regionalSetting = ['header', 'footer', 'menu', 'menuHeader']; - // 目前版本 settingDrawer 脚本配置 footer 有问题. 关了无法展示. 移除 - regionalSetting.splice(regionalSetting.indexOf('footer'), 1); // 默认自己绑定在顶栏, 关闭了自己就没了 regionalSetting.splice(regionalSetting.indexOf('header'), 1); diff --git a/src/components/SettingDrawer/index.tsx b/src/components/SettingDrawer/index.tsx index a110a42..1be2e5b 100644 --- a/src/components/SettingDrawer/index.tsx +++ b/src/components/SettingDrawer/index.tsx @@ -16,6 +16,7 @@ import { useModel } from 'umi'; import ConfigUtils from '@/utils/ConfigUtils'; import type { BodyProps, MergerSettingsType, SettingDrawerProps } from './typings'; import { LayoutSetting as LayoutSettingUtils } from '@/utils/Ballcat'; +import type { Settings as LayoutSettings } from '@ant-design/pro-layout'; export const getFormatMessage = (): ((data: { id: string; defaultMessage?: string }) => string) => { const formatMessage = ({ id }: { id: string; defaultMessage?: string }): string => { @@ -97,7 +98,7 @@ const SettingDrawer: React.FC = (props) => { const { hideColors, hideHintAlert, hideCopyButton, getContainer, prefixCls = 'ant-pro' } = props; const { initialState, setInitialState } = useModel('@@initialState'); - const layoutSetting = initialState?.settings || ConfigUtils.settings; + const layoutSetting: Partial = initialState?.settings || ConfigUtils.settings; const [show, setShow] = useMergedState(false, { value: props.collapse, @@ -134,8 +135,10 @@ const SettingDrawer: React.FC = (props) => { const nextState = { ...layoutSetting }; nextState[key] = value; - if (key === 'navTheme') { - nextState.primaryColor = 'daybreak'; + if (value === undefined) { + delete nextState[key]; + } else { + nextState[key] = value; } if (key === 'layout') { diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index bafb8d0..66027e5 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -78,6 +78,8 @@ const renderMenuItem = (collapsed: boolean, title: string, hasSub: boolean, icon ); }; +const footerRender = () =>