diff --git a/config/router.config.js b/config/router.config.js
index cb6fd5f1f1fca0191aa5fa6f650658bde07875c8..bef1be3819b891dae2f1401befee5d42569b9dda 100644
--- a/config/router.config.js
+++ b/config/router.config.js
@@ -15,6 +15,7 @@ export default [
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
+ authority: ['admin', 'user'],
routes: [
// dashboard
{ path: '/', redirect: '/dashboard/analysis' },
@@ -82,6 +83,7 @@ export default [
{
path: '/form/advanced-form',
name: 'advancedform',
+ authority: ['admin'],
component: './Forms/AdvancedForm',
},
],
@@ -149,6 +151,7 @@ export default [
{
path: '/profile/advanced',
name: 'advanced',
+ authority: ['admin'],
component: './Profile/AdvancedProfile',
},
],
diff --git a/package.json b/package.json
index f7211c663ebbc58eca594ee5b170134a7606a89e..432b6b05a49f2f5ecc1e3647c04f3bcc558c9354 100644
--- a/package.json
+++ b/package.json
@@ -71,6 +71,7 @@
"eslint-plugin-markdown": "^1.0.0-beta.6",
"eslint-plugin-react": "^7.11.1",
"gh-pages": "^1.2.0",
+ "husky": "^0.14.3",
"lint-staged": "^7.2.0",
"merge-umi-mock-data": "^0.0.3",
"mockjs": "^1.0.1-beta3",
diff --git a/src/components/Charts/ChartCard/index.d.ts b/src/components/Charts/ChartCard/index.d.ts
index d174593fddc4d0e6aa59b4726a973e1f7ca90673..ae25ec64c9d238b9edddaa1e0b6486069b94c50b 100644
--- a/src/components/Charts/ChartCard/index.d.ts
+++ b/src/components/Charts/ChartCard/index.d.ts
@@ -1,5 +1,7 @@
import * as React from 'react';
-export interface IChartCardProps {
+import { CardProps } from 'antd/lib/card';
+
+export interface IChartCardProps extends CardProps {
title: React.ReactNode;
action?: React.ReactNode;
total?: React.ReactNode | number | (() => React.ReactNode | number);
diff --git a/src/components/Charts/MiniArea/index.d.ts b/src/components/Charts/MiniArea/index.d.ts
index 2bcac70c5f1da3582e4bdf4e1d41e8c9e576014a..b223b68ca097e01f1c76e4e2cb4e95e9db4dc39b 100644
--- a/src/components/Charts/MiniArea/index.d.ts
+++ b/src/components/Charts/MiniArea/index.d.ts
@@ -21,7 +21,7 @@ export interface IMiniAreaProps {
xAxis?: IAxis;
yAxis?: IAxis;
data: Array<{
- x: number;
+ x: number | string;
y: number;
}>;
}
diff --git a/src/components/GlobalHeader/RightContent.js b/src/components/GlobalHeader/RightContent.js
index 3c882b9f36b40c51d13bbcf36124a7313b63ec3e..12d69516f53facd3676fcf0efb35b26826624575 100644
--- a/src/components/GlobalHeader/RightContent.js
+++ b/src/components/GlobalHeader/RightContent.js
@@ -74,7 +74,7 @@ export default class GlobalHeaderRight extends PureComponent {
- 退出登录
+
);
diff --git a/src/components/GlobalHeader/index.less b/src/components/GlobalHeader/index.less
index 1a3cf7dbd3d39ec53cc3464dc24fafb140c288d8..52f5ed4f6e5a45ff2354d1d6bc79cee7f60100ec 100644
--- a/src/components/GlobalHeader/index.less
+++ b/src/components/GlobalHeader/index.less
@@ -55,7 +55,6 @@ i.trigger {
transition: all 0.3s;
height: 100%;
> i {
- font-size: 18px;
vertical-align: middle;
color: @text-color;
}
diff --git a/src/components/NoticeIcon/index.less b/src/components/NoticeIcon/index.less
index 4f66bbb8a66a291e44d0362badb43782e843cd55..794376b51e5bee7729ec4f1db8b24a7ea87da6cd 100644
--- a/src/components/NoticeIcon/index.less
+++ b/src/components/NoticeIcon/index.less
@@ -14,7 +14,6 @@
}
.icon {
- font-size: 18px;
padding: 4px;
}
diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js
index e457f2f5b6f12524b26c112302e2e6c0cbe91f67..785a97cad165decd513a0be8d9a30d0656adaa1b 100644
--- a/src/components/SiderMenu/SiderMenu.js
+++ b/src/components/SiderMenu/SiderMenu.js
@@ -87,7 +87,7 @@ export default class SiderMenu extends PureComponent {
};
render() {
- const { logo, collapsed, onCollapse, fixSiderbar, theme } = this.props;
+ const { logo, collapsed, fixSiderbar, theme } = this.props;
const { openKeys } = this.state;
const defaultProps = collapsed ? {} : { openKeys };
@@ -95,14 +95,12 @@ export default class SiderMenu extends PureComponent {
[styles.fixSiderbar]: fixSiderbar,
[styles.light]: theme === 'light',
});
-
return (
@zindex-tooltip
+ z-index: 1061;
transition: width 0.2s;
}
diff --git a/src/locales/en-US.js b/src/locales/en-US.js
index 729836ec0a79440fa461af63171cb9fd7b7f920a..c0a7c5eefe1f55350d6a1d31e5582607b6a366a4 100644
--- a/src/locales/en-US.js
+++ b/src/locales/en-US.js
@@ -35,6 +35,7 @@ export default {
'menu.account.center': 'Account Center',
'menu.account.settings': 'Account Settings',
'menu.account.trigger': 'Trigger Error',
+ 'menu.account.logout': 'Logout',
'app.home.introduce': 'introduce',
'app.analysis.test': 'Gongzhuan No.{no} shop',
'app.analysis.introduce': 'Introduce',
diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js
index 81d766a684989fb06e6979e2e9e64a598fb10ac3..7c6f363243f035d995c24dd171d3ed15ba7621c5 100644
--- a/src/locales/zh-CN.js
+++ b/src/locales/zh-CN.js
@@ -37,6 +37,7 @@ export default {
'menu.account.center': '个人中心',
'menu.account.settings': '个人设置',
'menu.account.trigger': '触发报错',
+ 'menu.account.logout': '退出登录',
'app.home.introduce': '介绍',
'app.analysis.test': '工专路 {no} 号店',
'app.analysis.introduce': '指标说明',
diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js
index e0e18d7036e0fccee6ce33ad6b49e9ca7cf7626b..238888a7bc750647e1fb25aaec763e7782eb03b7 100644
--- a/src/pages/Authorized.js
+++ b/src/pages/Authorized.js
@@ -2,24 +2,15 @@ import React from 'react';
import RenderAuthorized from '@/components/Authorized';
import Exception from '@/components/Exception';
import { getAuthority } from '@/utils/authority';
-import { matchRoutes } from 'react-router-config';
-import intersection from 'lodash/intersection';
import { formatMessage } from 'umi/locale';
import Link from 'umi/link';
+import Redirect from 'umi/redirect';
-const Authorized = RenderAuthorized(getAuthority());
+const Authority = getAuthority();
+const Authorized = RenderAuthorized(Authority);
-export default ({ children, route, location }) => {
- const routes = matchRoutes(route.routes, location.pathname);
- const authorities = [];
- routes.forEach(item => {
- if (Array.isArray(item.route.authority) && item.route.authority.length) {
- authorities.push(item.route.authority);
- } else if (typeof item.route.authority === 'string' && item.route.authority) {
- authorities.push([item.route.authority]);
- }
- });
- const noMatch = (
+export default ({ children }) => {
+ let noMatch = (
{
backText={formatMessage({ id: 'app.exception.back' })}
/>
);
+ // if Authority === ['guest'] redirect to /user/login
+ // You can implement the logic here.
+ if (Authority.join('') === 'guest') {
+ noMatch = ;
+ }
return (
-
+
{children}
);