Skip to content

Commit 21110ee

Browse files
committed
Fixed UI
1 parent 23e52b7 commit 21110ee

File tree

7 files changed

+40
-102
lines changed

7 files changed

+40
-102
lines changed

config/config.ts

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { IConfig, IPlugin } from 'umi-types';
2-
32
import defaultSettings from './defaultSettings'; // https://umijs.org/config/
3+
44
import slash from 'slash2';
55
import webpackPlugin from './plugin.config';
6-
76
const { pwa, primaryColor } = defaultSettings;
8-
97
const plugins: IPlugin[] = [
108
[
119
'umi-plugin-react',
@@ -14,19 +12,12 @@ const plugins: IPlugin[] = [
1412
dva: {
1513
hmr: true,
1614
},
17-
locale: {
18-
// default false
19-
enable: true,
20-
// default zh-CN
21-
default: 'zh-CN',
22-
// default true, when it is true, will use `navigator.language` overwrite default
23-
baseNavigator: true,
15+
locale: true,
16+
dynamicImport: {
17+
loadingComponent: './components/PageLoading/index',
18+
webpackChunkName: true,
19+
level: 3,
2420
},
25-
// dynamicImport: {
26-
// loadingComponent: './components/PageLoading/index',
27-
// webpackChunkName: true,
28-
// level: 3,
29-
// },
3021
pwa: pwa
3122
? {
3223
workboxPluginMode: 'InjectManifest',
@@ -41,6 +32,7 @@ const plugins: IPlugin[] = [
4132
// include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
4233
// exclude: ['@babel/runtime', 'netlify-lambda'],
4334
// },
35+
dll: true,
4436
},
4537
],
4638
[
@@ -53,7 +45,6 @@ const plugins: IPlugin[] = [
5345
},
5446
],
5547
];
56-
5748
export default {
5849
plugins,
5950
block: {
@@ -82,14 +73,29 @@ export default {
8273
path: '/',
8374
component: '../layouts/SecurityLayout',
8475
routes: [
85-
{ path: '/', redirect: '/dashboard' },
86-
{ path: '/dashboard', component: './Dashboard/Home' },
76+
{
77+
path: '/',
78+
redirect: '/dashboard',
79+
},
80+
{
81+
path: '/dashboard',
82+
component: './Dashboard/Home',
83+
},
8784
{
8885
path: '/system',
8986
routes: [
90-
{ path: '/system/menu', component: './Menu/MenuList' },
91-
{ path: '/system/role', component: './Role/RoleList' },
92-
{ path: '/system/user', component: './User/UserList' },
87+
{
88+
path: '/system/menu',
89+
component: './Menu/MenuList',
90+
},
91+
{
92+
path: '/system/role',
93+
component: './Role/RoleList',
94+
},
95+
{
96+
path: '/system/user',
97+
component: './User/UserList',
98+
},
9399
],
94100
},
95101
{

config/plugin.config.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Change theme plugin
22
// eslint-disable-next-line eslint-comments/abdeils - enable - pair;
33
/* eslint-disable import/no-extraneous-dependencies */
4-
import ThemeColorReplacer from 'webpack-theme-color-replacer';
5-
import generate from '@ant-design/colors/lib/generate';
64
import path from 'path';
75

86
function getModulePackageName(module: { context: string }) {
@@ -25,33 +23,6 @@ function getModulePackageName(module: { context: string }) {
2523
}
2624

2725
export default (config: any) => {
28-
// preview.pro.ant.design only do not use in your production;
29-
if (
30-
process.env.ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ||
31-
process.env.NODE_ENV !== 'production'
32-
) {
33-
config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [
34-
{
35-
fileName: 'css/theme-colors-[contenthash:8].css',
36-
matchColors: getAntdSerials('#1890ff'), // 主色系列
37-
// 改变样式选择器,解决样式覆盖问题
38-
changeSelector(selector: string): string {
39-
switch (selector) {
40-
case '.ant-calendar-today .ant-calendar-date':
41-
return ':not(.ant-calendar-selected-date)' + selector;
42-
case '.ant-btn:focus,.ant-btn:hover':
43-
return '.ant-btn:focus:not(.ant-btn-primary),.ant-btn:hover:not(.ant-btn-primary)';
44-
case '.ant-btn.active,.ant-btn:active':
45-
return '.ant-btn.active:not(.ant-btn-primary),.ant-btn:active:not(.ant-btn-primary)';
46-
default:
47-
return selector;
48-
}
49-
},
50-
// isJsUgly: true,
51-
},
52-
]);
53-
}
54-
5526
// optimize chunks
5627
config.optimization
5728
// share the same chunks across different modules
@@ -90,15 +61,3 @@ export default (config: any) => {
9061
},
9162
});
9263
};
93-
94-
const getAntdSerials = (color: string) => {
95-
const lightNum = 9;
96-
const devide10 = 10;
97-
// 淡化(即less的tint)
98-
const lightens = new Array(lightNum).fill(undefined).map((_, i: number) => {
99-
return ThemeColorReplacer.varyColor.lighten(color, i / devide10);
100-
});
101-
const colorPalettes = generate(color);
102-
const rgb = ThemeColorReplacer.varyColor.toNum3(color.replace('#', '')).join(',');
103-
return lightens.concat(colorPalettes).concat(rgb);
104-
};

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@
6666
"react-helmet": "^5.2.1",
6767
"redux": "^4.0.1",
6868
"slash2": "^2.0.0",
69-
"umi": "^2.9.6",
69+
"umi": "^2.12.5",
7070
"umi-plugin-pro-block": "^1.3.4",
71-
"umi-plugin-react": "^1.10.1",
72-
"umi-request": "^1.2.7",
73-
"uuid": "^3.3.3",
74-
"webpack-theme-color-replacer": "^1.2.15"
71+
"umi-plugin-react": "^1.14.8",
72+
"uuid": "^3.3.3"
7573
},
7674
"devDependencies": {
7775
"@ant-design/pro-cli": "^1.0.13",
@@ -111,7 +109,6 @@
111109
"prettier": "^1.17.1",
112110
"pro-download": "1.0.1",
113111
"stylelint": "^10.1.0",
114-
"umi-plugin-ga": "^1.1.3",
115112
"umi-plugin-pro": "^1.0.2",
116113
"umi-types": "^0.5.0"
117114
},

src/components/SettingDrawer/themeColorClient.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/e2e/baseLayout.e2e.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ describe('Ant Design Pro E2E test', () => {
3232
};
3333

3434
const routers = formatter(RouterConfig);
35-
console.log('routers', routers);
3635
routers.forEach(route => {
3736
it(`test pages ${route}`, testPage(route));
3837
});

src/layouts/SecurityLayout.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
.header {
44
position: relative;
5-
padding: 0 12px 0 0;
65
background: #002140;
76
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
87
}

src/layouts/SecurityLayout.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ConnectState } from '@/models/connect';
55
import { ContainerQuery } from 'react-container-query';
66
import CopyRight from '@/components/CopyRight';
77
import DocumentTitle from 'react-document-title';
8+
import { Debounce } from 'lodash-decorators/debounce';
89
import { GlobalContext } from '@/utils/context';
910
import GlobalFooter from '@/components/GlobalFooter';
1011
import { GlobalModelState } from '@/models/global';
@@ -69,6 +70,14 @@ class SecurityLayout extends React.PureComponent<SecurityLayoutProps> {
6970
});
7071
}
7172

73+
@Debounce(600)
74+
onTriggerResizeEvent() {
75+
/* eslint class-methods-use-this: 0 */
76+
const event = document.createEvent('HTMLEvents');
77+
event.initEvent('resize', true, false);
78+
window.dispatchEvent(event);
79+
}
80+
7281
dispatch = (action: any) => {
7382
const { dispatch } = this.props;
7483
dispatch(action);
@@ -285,7 +294,7 @@ class SecurityLayout extends React.PureComponent<SecurityLayoutProps> {
285294
</Menu>
286295
</Sider>
287296
<Layout>
288-
<Header className={styles.header}>
297+
<Header className={styles.header} style={{ padding: 0, paddingRight: 30 }}>
289298
<Icon
290299
className={styles.trigger}
291300
type={collapsed ? 'menu-unfold' : 'menu-fold'}

0 commit comments

Comments
 (0)