Skip to content

Commit b622a9b

Browse files
committed
feat: 优化页面设置
1 parent 410712d commit b622a9b

File tree

7 files changed

+51
-21
lines changed

7 files changed

+51
-21
lines changed

src/components/Header/Right.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ export default () => {
5858
<MoreOutlined style={{ fontSize: '16px', fontWeight: 'bolder' }} />
5959
</span>
6060

61-
<SettingDrawer hideHintAlert collapse={showSetting} onCollapseChange={setShowSetting} />
61+
<SettingDrawer
62+
hideHintAlert
63+
hideColors
64+
hideCopyButton
65+
collapse={showSetting}
66+
onCollapseChange={setShowSetting}
67+
/>
6268
</Space>
6369
);
6470
};

src/components/SettingDrawer/BlockCheckbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { Tooltip } from 'antd';
33
import { CheckOutlined } from '@ant-design/icons';
44
import classNames from 'classnames';

src/components/SettingDrawer/LayoutChange.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const LayoutSetting: React.FC<{
3939
value={contentWidth || 'Fixed'}
4040
size="small"
4141
className="content-width"
42-
onSelect={(value) => {
42+
onSelect={(value: any) => {
4343
changeSetting('contentWidth', value);
4444
}}
4545
style={{ width: 80 }}
@@ -131,7 +131,7 @@ const LayoutSetting: React.FC<{
131131
value={multiTabStyle || 'default'}
132132
size="small"
133133
className="multi-tab-style"
134-
onSelect={(value) => {
134+
onSelect={(value: any) => {
135135
changeSetting('multiTabStyle', value);
136136
}}
137137
style={{ width: 80 }}

src/components/SettingDrawer/RegionalChange.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Switch, List } from 'antd';
2+
import { List, Switch } from 'antd';
33
import type { ProSettings } from '@ant-design/pro-layout';
44
import { getFormatMessage } from './index';
55
import { renderLayoutSettingItem } from './LayoutChange';
@@ -13,6 +13,8 @@ const RegionalSetting: React.FC<{
1313

1414
// 默认自己绑定在顶栏, 关闭了自己就没了
1515
regionalSetting.splice(regionalSetting.indexOf('header'), 1);
16+
// 页脚不允许配置
17+
regionalSetting.splice(regionalSetting.indexOf('footer'), 1);
1618

1719
return (
1820
<List

src/components/SettingDrawer/ThemeColor.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
@import './index.less';
2+
23
.@{ant-pro-setting-drawer}-content {
34
.theme-color {
45
margin-top: 16px;
56
overflow: hidden;
7+
68
.theme-color-title {
79
margin-bottom: 12px;
810
font-size: 14px;
911
line-height: 22px;
1012
}
13+
1114
.theme-color-block {
1215
float: left;
1316
width: 20px;

src/components/SettingDrawer/index.less

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
.@{ant-pro-setting-drawer} {
66
&-content {
77
position: relative;
8-
min-height: 100%;
8+
//min-height: 100%;
9+
10+
.ant-pro-setting-drawer-content {
11+
height: 100% !important;
12+
}
13+
914
.@{ant-prefix}-list-item {
1015
span {
1116
flex: 1;
@@ -15,6 +20,7 @@
1520

1621
&-block-checkbox {
1722
display: flex;
23+
1824
&-item {
1925
position: relative;
2026
width: 44px;
@@ -35,6 +41,7 @@
3541
background-color: #fff;
3642
content: '';
3743
}
44+
3845
&::after {
3946
position: absolute;
4047
top: 0;
@@ -47,10 +54,12 @@
4754

4855
&-realDark {
4956
background-color: fade(@menu-dark-bg, 85%);
57+
5058
&::before {
5159
background-color: fade(@menu-dark-bg, 65%);
5260
content: '';
5361
}
62+
5463
&::after {
5564
background-color: fade(@menu-dark-bg, 85%);
5665
}
@@ -62,6 +71,7 @@
6271
background-color: @white;
6372
content: '';
6473
}
74+
6575
&::after {
6676
background-color: @white;
6777
}
@@ -75,6 +85,7 @@
7585
background-color: @menu-dark-bg;
7686
content: '';
7787
}
88+
7889
&::after {
7990
background-color: @white;
8091
}
@@ -86,6 +97,7 @@
8697
background-color: transparent;
8798
content: '';
8899
}
100+
89101
&::after {
90102
background-color: @menu-dark-bg;
91103
}
@@ -97,11 +109,13 @@
97109
background-color: @white;
98110
content: '';
99111
}
112+
100113
&::after {
101114
background-color: @menu-dark-bg;
102115
}
103116
}
104117
}
118+
105119
&-selectIcon {
106120
position: absolute;
107121
right: 6px;
@@ -110,6 +124,7 @@
110124
font-weight: bold;
111125
font-size: 14px;
112126
pointer-events: none;
127+
113128
.action {
114129
color: @primary-color;
115130
}

src/components/SettingDrawer/index.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ import { Alert, Button, Divider, Drawer, List, message, Switch } from 'antd';
55
import React, { useEffect, useState } from 'react';
66
import useMergedState from 'rc-util/lib/hooks/useMergedState';
77
import omit from 'omit.js';
8-
import type { ProSettings } from '@ant-design/pro-layout';
8+
import type { ProSettings, Settings as LayoutSettings } from '@ant-design/pro-layout';
99
import BlockCheckbox from './BlockCheckbox';
1010
import ThemeColor from './ThemeColor';
1111
import getLocales, { getLanguage } from './locales';
1212
import { genStringToTheme } from './utils';
1313
import LayoutSetting, { renderLayoutSettingItem } from './LayoutChange';
14-
import RegionalSetting from './RegionalChange';
1514
import { useModel } from 'umi';
1615
import ConfigUtils from '@/utils/ConfigUtils';
1716
import type { BodyProps, MergerSettingsType, SettingDrawerProps } from './typings';
1817
import { LayoutSetting as LayoutSettingUtils } from '@/utils/Ballcat';
19-
import type { Settings as LayoutSettings } from '@ant-design/pro-layout';
2018

2119
export const getFormatMessage = (): ((data: { id: string; defaultMessage?: string }) => string) => {
2220
const formatMessage = ({ id }: { id: string; defaultMessage?: string }): string => {
@@ -182,6 +180,9 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
182180
style={{
183181
zIndex: 999,
184182
}}
183+
bodyStyle={{ paddingBottom: '0' }}
184+
drawerStyle={{ height: '100%' }}
185+
contentWrapperStyle={{ height: 'auto' }}
185186
>
186187
<div className={`${baseClassName}-drawer-content`}>
187188
<Body titleKey="pagestyle" prefixCls={baseClassName}>
@@ -194,14 +195,17 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
194195
onChange={(value) => changeSetting('navTheme', value)}
195196
/>
196197
</Body>
197-
<Body titleKey="themecolor" prefixCls={baseClassName}>
198-
<ThemeColor
199-
value={primaryColor!}
200-
colors={hideColors ? [] : colorList}
201-
formatMessage={formatMessage}
202-
onChange={(color) => changeSetting('primaryColor', color)}
203-
/>
204-
</Body>
198+
199+
{!hideColors && (
200+
<Body titleKey="themecolor" prefixCls={baseClassName}>
201+
<ThemeColor
202+
value={primaryColor!}
203+
colors={colorList}
204+
formatMessage={formatMessage}
205+
onChange={(color) => changeSetting('primaryColor', color)}
206+
/>
207+
</Body>
208+
)}
205209

206210
<Divider />
207211

@@ -231,11 +235,11 @@ const SettingDrawer: React.FC<SettingDrawerProps> = (props) => {
231235
<LayoutSetting settings={layoutSetting} changeSetting={changeSetting} />
232236
<Divider />
233237

234-
<Body titleKey="regionalsettings" prefixCls={baseClassName}>
235-
<RegionalSetting settings={layoutSetting} changeSetting={changeSetting} />
236-
</Body>
238+
{/*<Body titleKey="regionalsettings" prefixCls={baseClassName}>*/}
239+
{/* <RegionalSetting settings={layoutSetting} changeSetting={changeSetting}/>*/}
240+
{/*</Body>*/}
237241

238-
<Divider />
242+
{/*<Divider/>*/}
239243

240244
<Body titleKey="othersettings" prefixCls={baseClassName}>
241245
<List

0 commit comments

Comments
 (0)