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
dist
run
# Logs
logs

Binary file not shown.

View File

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

View File

@ -5,16 +5,17 @@ export default [
component: '../layouts/UserLayout',
routes: [
{ path: '/user', redirect: '/user/login' },
{ path: '/user/login', component: './User/Login' },
/*{ path: '/user/login', component: '' },
{ path: '/user/register', component: './User/Register' },
{ path: '/user/register-result', component: './User/RegisterResult' },
*/
],
},
// app
{
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
//Routes: ['src/pages/Authorized'],
authority: ['admin', 'user'],
routes: [
// dashboard
@ -26,239 +27,25 @@ export default [
routes: [
{
path: '/dashboard/analysis',
name: 'analysis',
component: './Dashboard/Analysis',
name: 'collect',
// component: './Dashboard/Analysis',
},
{
path: '/dashboard/monitor',
name: 'monitor',
component: './Dashboard/Monitor',
name: 'notification',
//component: './Dashboard/Monitor',
},
{
path: '/dashboard/workplace',
name: 'workplace',
component: './Dashboard/Workplace',
name: 'logging',
//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 { FormattedMessage, formatMessage } from 'umi/locale';
import { FormattedMessage, formatMessage } from 'umi';
import { Spin, Tag, Menu, Icon, Dropdown, Avatar, Tooltip } from 'antd';
import moment from 'moment';
import groupBy from 'lodash/groupBy';

View File

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

View File

@ -1,5 +1,5 @@
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 classNames from 'classnames';
import styles from './index.less';

View File

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

View File

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
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 { connect } from 'dva';
import omit from 'omit.js';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,10 +67,11 @@ export default {
'component.noticeIcon.cleared': '清空了',
'component.noticeIcon.empty': '暂无数据',
'menu.home': '首页',
'menu.dashboard': 'Dashboard',
'menu.dashboard.analysis': '分析页',
'menu.dashboard.monitor': '监控页',
'menu.dashboard.workplace': '工作台',
'menu.dashboard': '平台概述',
'menu.dashboard.collect': '采集端统计',
'menu.dashboard.notification': '告警统计',
'menu.dashboard.logging': '日志数据统计',
'menu.dashboard.gateway': '采集网关统计',
'menu.form': '表单页',
'menu.form.basicform': '基础表单',
'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-scripts": "^2.11.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": {
"@umijs/preset-react": "^1.3.9",
@ -21,6 +25,8 @@
"egg-mock": "^3.21.0",
"eslint": "^5.13.0",
"eslint-config-egg": "^7.1.0",
"react-container-query": "^0.11.1",
"react-document-title": "^2.0.3",
"umi": "^3.0.4"
},
"engines": {