front and back

This commit is contained in:
silenceqi 2020-03-11 07:56:05 +08:00
parent ba3dabd3ca
commit e37be7167c
19 changed files with 62 additions and 281 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
.umi .umi
dist dist
run
# Logs # Logs
logs logs

Binary file not shown.

View File

@ -1,8 +1,9 @@
//import webpackPlugin from './plugin.config'; //import webpackPlugin from './plugin.config';
import pageRoutes from './router.config'; import pageRoutes from './router.config';
import defaultSettings from '../src/defaultSettings';
export default { export default {
singular: true, //singular: true,
routes: [{ routes: [{
path: '/', path: '/',
component: 'helloworld', component: 'helloworld',
@ -14,6 +15,12 @@ export default {
baseNavigator: true, baseNavigator: true,
}, },
routes: pageRoutes, routes: pageRoutes,
define:{
APP_TYPE: process.env.APP_TYPE || '',
},
theme: {
'primary-color': defaultSettings.primaryColor,
},
runtimePublicPath: true, runtimePublicPath: true,
hash: true, hash: true,
outputPath: '../public', outputPath: '../public',

View File

@ -5,16 +5,17 @@ export default [
component: '../layouts/UserLayout', component: '../layouts/UserLayout',
routes: [ routes: [
{ path: '/user', redirect: '/user/login' }, { path: '/user', redirect: '/user/login' },
{ path: '/user/login', component: './User/Login' }, /*{ path: '/user/login', component: '' },
{ path: '/user/register', component: './User/Register' }, { path: '/user/register', component: './User/Register' },
{ path: '/user/register-result', component: './User/RegisterResult' }, { path: '/user/register-result', component: './User/RegisterResult' },
*/
], ],
}, },
// app // app
{ {
path: '/', path: '/',
component: '../layouts/BasicLayout', component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'], //Routes: ['src/pages/Authorized'],
authority: ['admin', 'user'], authority: ['admin', 'user'],
routes: [ routes: [
// dashboard // dashboard
@ -26,239 +27,25 @@ export default [
routes: [ routes: [
{ {
path: '/dashboard/analysis', path: '/dashboard/analysis',
name: 'analysis', name: 'collect',
component: './Dashboard/Analysis', // component: './Dashboard/Analysis',
}, },
{ {
path: '/dashboard/monitor', path: '/dashboard/monitor',
name: 'monitor', name: 'notification',
component: './Dashboard/Monitor', //component: './Dashboard/Monitor',
}, },
{ {
path: '/dashboard/workplace', path: '/dashboard/workplace',
name: 'workplace', name: 'logging',
component: './Dashboard/Workplace', //component: './Dashboard/Workplace',
},
{
path:'/dashboard/',
name:'gateway',
}, },
], ],
}, },
// forms
{
path: '/form',
icon: 'form',
name: 'form',
routes: [
{
path: '/form/basic-form',
name: 'basicform',
component: './Forms/BasicForm',
},
{
path: '/form/step-form',
name: 'stepform',
component: './Forms/StepForm',
hideChildrenInMenu: true,
routes: [
{
path: '/form/step-form',
name: 'stepform',
redirect: '/form/step-form/info',
},
{
path: '/form/step-form/info',
name: 'info',
component: './Forms/StepForm/Step1',
},
{
path: '/form/step-form/confirm',
name: 'confirm',
component: './Forms/StepForm/Step2',
},
{
path: '/form/step-form/result',
name: 'result',
component: './Forms/StepForm/Step3',
},
],
},
{
path: '/form/advanced-form',
name: 'advancedform',
authority: ['admin'],
component: './Forms/AdvancedForm',
},
],
},
// list
{
path: '/list',
icon: 'table',
name: 'list',
routes: [
{
path: '/list/table-list',
name: 'searchtable',
component: './List/TableList',
},
{
path: '/list/basic-list',
name: 'basiclist',
component: './List/BasicList',
},
{
path: '/list/card-list',
name: 'cardlist',
component: './List/CardList',
},
{
path: '/list/search',
name: 'searchlist',
component: './List/List',
routes: [
{
path: '/list/search',
redirect: '/list/search/articles',
},
{
path: '/list/search/articles',
name: 'articles',
component: './List/Articles',
},
{
path: '/list/search/projects',
name: 'projects',
component: './List/Projects',
},
{
path: '/list/search/applications',
name: 'applications',
component: './List/Applications',
},
],
},
],
},
{
path: '/profile',
name: 'profile',
icon: 'profile',
routes: [
// profile
{
path: '/profile/basic',
name: 'basic',
component: './Profile/BasicProfile',
},
{
path: '/profile/advanced',
name: 'advanced',
authority: ['admin'],
component: './Profile/AdvancedProfile',
},
],
},
{
name: 'result',
icon: 'check-circle-o',
path: '/result',
routes: [
// result
{
path: '/result/success',
name: 'success',
component: './Result/Success',
},
{ path: '/result/fail', name: 'fail', component: './Result/Error' },
],
},
{
name: 'exception',
icon: 'warning',
path: '/exception',
routes: [
// exception
{
path: '/exception/403',
name: 'not-permission',
component: './Exception/403',
},
{
path: '/exception/404',
name: 'not-find',
component: './Exception/404',
},
{
path: '/exception/500',
name: 'server-error',
component: './Exception/500',
},
{
path: '/exception/trigger',
name: 'trigger',
hideInMenu: true,
component: './Exception/TriggerException',
},
],
},
{
name: 'account',
icon: 'user',
path: '/account',
routes: [
{
path: '/account/center',
name: 'center',
component: './Account/Center/Center',
routes: [
{
path: '/account/center',
redirect: '/account/center/articles',
},
{
path: '/account/center/articles',
component: './Account/Center/Articles',
},
{
path: '/account/center/applications',
component: './Account/Center/Applications',
},
{
path: '/account/center/projects',
component: './Account/Center/Projects',
},
],
},
{
path: '/account/settings',
name: 'settings',
component: './Account/Settings/Info',
routes: [
{
path: '/account/settings',
redirect: '/account/settings/base',
},
{
path: '/account/settings/base',
component: './Account/Settings/BaseView',
},
{
path: '/account/settings/security',
component: './Account/Settings/SecurityView',
},
{
path: '/account/settings/binding',
component: './Account/Settings/BindingView',
},
{
path: '/account/settings/notification',
component: './Account/Settings/NotificationView',
},
],
},
],
},
{
component: '404',
},
], ],
}, },
]; ];

View File

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { FormattedMessage, formatMessage } from 'umi/locale'; import { FormattedMessage, formatMessage } from 'umi';
import { Spin, Tag, Menu, Icon, Dropdown, Avatar, Tooltip } from 'antd'; import { Spin, Tag, Menu, Icon, Dropdown, Avatar, Tooltip } from 'antd';
import moment from 'moment'; import moment from 'moment';
import groupBy from 'lodash/groupBy'; import groupBy from 'lodash/groupBy';

View File

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Icon } from 'antd'; import { Icon } from 'antd';
import Link from 'umi/link'; import {Link} from 'umi';
import Debounce from 'lodash-decorators/debounce'; import Debounce from 'lodash-decorators/debounce';
import styles from './index.less'; import styles from './index.less';
import RightContent from './RightContent'; import RightContent from './RightContent';

View File

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { formatMessage, setLocale, getLocale } from 'umi/locale'; import { formatMessage, setLocale, getLocale } from 'umi';
import { Menu, Icon, Dropdown } from 'antd'; import { Menu, Icon, Dropdown } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './index.less'; import styles from './index.less';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Tooltip, Icon } from 'antd'; import { Tooltip, Icon } from 'antd';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import styles from './ThemeColor.less'; import styles from './ThemeColor.less';
const Tag = ({ color, check, ...rest }) => ( const Tag = ({ color, check, ...rest }) => (

View File

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert, Tooltip } from 'antd'; import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert, Tooltip } from 'antd';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import { CopyToClipboard } from 'react-copy-to-clipboard'; import { CopyToClipboard } from 'react-copy-to-clipboard';
import { connect } from 'dva'; import { connect } from 'dva';
import omit from 'omit.js'; import omit from 'omit.js';

View File

@ -1,9 +1,9 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Menu, Icon } from 'antd'; import { Menu, Icon } from 'antd';
import Link from 'umi/link'; import {Link} from 'umi';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import memoizeOne from 'memoize-one'; import memoizeOne from 'memoize-one';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import pathToRegexp from 'path-to-regexp'; import pathToRegexp from 'path-to-regexp';
import { urlToList } from '../_utils/pathTools'; import { urlToList } from '../_utils/pathTools';
import styles from './index.less'; import styles from './index.less';

View File

@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { Layout } from 'antd'; import { Layout } from 'antd';
import pathToRegexp from 'path-to-regexp'; import pathToRegexp from 'path-to-regexp';
import classNames from 'classnames'; import classNames from 'classnames';
import Link from 'umi/link'; import {Link} from 'umi';
import styles from './index.less'; import styles from './index.less';
import BaseMenu, { getMenuMatches } from './BaseMenu'; import BaseMenu, { getMenuMatches } from './BaseMenu';
import { urlToList } from '../_utils/pathTools'; import { urlToList } from '../_utils/pathTools';
@ -110,7 +110,7 @@ export default class SiderMenu extends PureComponent {
<div className={styles.logo} id="logo"> <div className={styles.logo} id="logo">
<Link to="/"> <Link to="/">
<img src={logo} alt="logo" /> <img src={logo} alt="logo" />
<h1>Ant Design Pro</h1> <h1>Logging Center</h1>
</Link> </Link>
</div> </div>
<BaseMenu <BaseMenu

View File

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import Link from 'umi/link'; import {Link} from 'umi';
import RightContent from '../GlobalHeader/RightContent'; import RightContent from '../GlobalHeader/RightContent';
import BaseMenu from '../SiderMenu/BaseMenu'; import BaseMenu from '../SiderMenu/BaseMenu';
import styles from './index.less'; import styles from './index.less';
@ -30,7 +30,7 @@ export default class TopNavHeader extends PureComponent {
<div className={styles.logo} key="logo" id="logo"> <div className={styles.logo} key="logo" id="logo">
<Link to="/"> <Link to="/">
<img src={logo} alt="logo" /> <img src={logo} alt="logo" />
<h1>Ant Design Pro</h1> <h1>Logging Center</h1>
</Link> </Link>
</div> </div>
<div <div

View File

@ -8,7 +8,7 @@ import { ContainerQuery } from 'react-container-query';
import classNames from 'classnames'; import classNames from 'classnames';
import pathToRegexp from 'path-to-regexp'; import pathToRegexp from 'path-to-regexp';
import { enquireScreen, unenquireScreen } from 'enquire-js'; import { enquireScreen, unenquireScreen } from 'enquire-js';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import SiderMenu from '@/components/SiderMenu'; import SiderMenu from '@/components/SiderMenu';
import Authorized from '@/utils/Authorized'; import Authorized from '@/utils/Authorized';
import SettingDrawer from '@/components/SettingDrawer'; import SettingDrawer from '@/components/SettingDrawer';
@ -18,6 +18,7 @@ import Header from './Header';
import Context from './MenuContext'; import Context from './MenuContext';
import Exception403 from '../pages/Exception/403'; import Exception403 from '../pages/Exception/403';
const { Content } = Layout; const { Content } = Layout;
// Conversion router to menu. // Conversion router to menu.
@ -178,13 +179,13 @@ class BasicLayout extends React.PureComponent {
const currRouterData = this.matchParamsPath(pathname); const currRouterData = this.matchParamsPath(pathname);
if (!currRouterData) { if (!currRouterData) {
return 'Ant Design Pro'; return 'Logging Center';
} }
const message = formatMessage({ const message = formatMessage({
id: currRouterData.locale || currRouterData.name, id: currRouterData.locale || currRouterData.name,
defaultMessage: currRouterData.name, defaultMessage: currRouterData.name,
}); });
return `${message} - Ant Design Pro`; return `${message} - Logging Center`;
}; };
getLayoutStyle = () => { getLayoutStyle = () => {

View File

@ -7,7 +7,7 @@ const FooterView = () => (
<Footer style={{ padding: 0 }}> <Footer style={{ padding: 0 }}>
<GlobalFooter <GlobalFooter
links={[ links={[
{ /*{
key: 'Pro 首页', key: 'Pro 首页',
title: 'Pro 首页', title: 'Pro 首页',
href: 'https://pro.ant.design', href: 'https://pro.ant.design',
@ -24,11 +24,11 @@ const FooterView = () => (
title: 'Ant Design', title: 'Ant Design',
href: 'https://ant.design', href: 'https://ant.design',
blankTarget: true, blankTarget: true,
}, },*/
]} ]}
copyright={ copyright={
<Fragment> <Fragment>
Copyright <Icon type="copyright" /> 2018 蚂蚁金服体验技术部出品 Copyright <Icon type="copyright" /> 2020 ©极限科技
</Fragment> </Fragment>
} }
/> />

View File

@ -1,9 +1,9 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import { Layout, message } from 'antd'; import { Layout, message } from 'antd';
import Animate from 'rc-animate'; import Animate from 'rc-animate';
import { connect } from 'dva'; import { connect } from 'dva';
import router from 'umi/router'; import {history} from 'umi';
import GlobalHeader from '@/components/GlobalHeader'; import GlobalHeader from '@/components/GlobalHeader';
import TopNavHeader from '@/components/TopNavHeader'; import TopNavHeader from '@/components/TopNavHeader';
import styles from './Header.less'; import styles from './Header.less';
@ -54,15 +54,15 @@ class HeaderView extends PureComponent {
handleMenuClick = ({ key }) => { handleMenuClick = ({ key }) => {
const { dispatch } = this.props; const { dispatch } = this.props;
if (key === 'userCenter') { if (key === 'userCenter') {
router.push('/account/center'); history.push('/account/center');
return; return;
} }
if (key === 'triggerError') { if (key === 'triggerError') {
router.push('/exception/trigger'); history.push('/exception/trigger');
return; return;
} }
if (key === 'userinfo') { if (key === 'userinfo') {
router.push('/account/settings/base'); history.push('/account/settings/base');
return; return;
} }
if (key === 'logout') { if (key === 'logout') {

View File

@ -1,6 +1,6 @@
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { formatMessage } from 'umi/locale'; import { formatMessage } from 'umi';
import Link from 'umi/link'; import {Link} from 'umi';
import { Icon } from 'antd'; import { Icon } from 'antd';
import GlobalFooter from '@/components/GlobalFooter'; import GlobalFooter from '@/components/GlobalFooter';
import SelectLang from '@/components/SelectLang'; import SelectLang from '@/components/SelectLang';
@ -27,7 +27,7 @@ const links = [
const copyright = ( const copyright = (
<Fragment> <Fragment>
Copyright <Icon type="copyright" /> 2018 蚂蚁金服体验技术部出品 Copyright <Icon type="copyright" /> 2018 ©极限科技
</Fragment> </Fragment>
); );
@ -56,10 +56,10 @@ class UserLayout extends React.PureComponent {
<div className={styles.header}> <div className={styles.header}>
<Link to="/"> <Link to="/">
<img alt="logo" className={styles.logo} src={logo} /> <img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>Ant Design</span> <span className={styles.title}>Logging Center</span>
</Link> </Link>
</div> </div>
<div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div> <div className={styles.desc}>Logging Center</div>
</div> </div>
{children} {children}
</div> </div>

View File

@ -67,10 +67,11 @@ export default {
'component.noticeIcon.cleared': '清空了', 'component.noticeIcon.cleared': '清空了',
'component.noticeIcon.empty': '暂无数据', 'component.noticeIcon.empty': '暂无数据',
'menu.home': '首页', 'menu.home': '首页',
'menu.dashboard': 'Dashboard', 'menu.dashboard': '平台概述',
'menu.dashboard.analysis': '分析页', 'menu.dashboard.collect': '采集端统计',
'menu.dashboard.monitor': '监控页', 'menu.dashboard.notification': '告警统计',
'menu.dashboard.workplace': '工作台', 'menu.dashboard.logging': '日志数据统计',
'menu.dashboard.gateway': '采集网关统计',
'menu.form': '表单页', 'menu.form': '表单页',
'menu.form.basicform': '基础表单', 'menu.form.basicform': '基础表单',
'menu.form.stepform': '分步表单', 'menu.form.stepform': '分步表单',

View File

@ -1,22 +0,0 @@
import {Component} from 'react';
import {Card} from 'antd';
class Helloworld extends Component {
render() {
return (
<Card>
<Card.Meta
avatar={<img
alt=""
style={{ width: '64px', height: '64px', borderRadius: '32px' }}
src="https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png"
/>}
title="Alipay"
description="在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。"
/>
</Card>
);
}
}
export default Helloworld;

View File

@ -10,7 +10,11 @@
"egg": "^2.15.1", "egg": "^2.15.1",
"egg-scripts": "^2.11.0", "egg-scripts": "^2.11.0",
"egg-view-assets": "^1.6.0", "egg-view-assets": "^1.6.0",
"egg-view-nunjucks": "^2.2.0" "egg-view-nunjucks": "^2.2.0",
"enquire-js": "^0.2.1",
"lodash-decorators": "^6.0.1",
"nzh": "^1.0.4",
"react-container-query": "^0.11.1"
}, },
"devDependencies": { "devDependencies": {
"@umijs/preset-react": "^1.3.9", "@umijs/preset-react": "^1.3.9",
@ -21,6 +25,8 @@
"egg-mock": "^3.21.0", "egg-mock": "^3.21.0",
"eslint": "^5.13.0", "eslint": "^5.13.0",
"eslint-config-egg": "^7.1.0", "eslint-config-egg": "^7.1.0",
"react-container-query": "^0.11.1",
"react-document-title": "^2.0.3",
"umi": "^3.0.4" "umi": "^3.0.4"
}, },
"engines": { "engines": {