Commit dc5b0f67 authored by 愚道's avatar 愚道

use config routes

parent 64b5984a
......@@ -3,83 +3,88 @@
// https://umijs.org/config/
const path = require('path');
const pageRoutes = require('../src/pages/_routes');
// const pageRoutes = require('../_routes');
export default {
// add for transfer to umi
plugins: [
'umi-plugin-dva',
// TODO 决定是否使用约定路由,如果使用配置路由那么 umi-plugin-routes 可以去掉了
[
'umi-plugin-routes',
{
exclude: [/\.test\.js/],
update(routes) {
return [...pageRoutes, ...routes];
},
},
],
// [
// 'umi-plugin-routes',
// {
// exclude: [/\.test\.js/],
// update(routes) {
// return [...pageRoutes, ...routes];
// },
// },
// ],
],
disableServiceWorker: true,
// 路由配置
// TODO ./src/pages 太冗余了
// routes: [{
// path: '/',
// component: './src/layouts/BasicLayout',
// indexRoute: { redirect: '/dashboard/analysis' },
// childRoutes: [
// // dashboard
// { path: 'dashboard/analysis', component: './src/pages/Dashboard/Analysis' },
// { path: 'dashboard/monitor', component: './src/pages/Dashboard/Monitor' },
// { path: 'dashboard/workplace', component: './src/pages/Dashboard/Workplace' },
routes: [
{
path: '/',
component: './layouts/index',
routes: [
// dashboard
{ path: '/', redirect: '/dashboard/analysis' },
{ path: '/dashboard/analysis', component: './Dashboard/Analysis' },
{ path: '/dashboard/monitor', component: './Dashboard/Monitor' },
{ path: '/dashboard/workplace', component: './Dashboard/Workplace' },
// // forms
// { path: 'form/basic-form', component: './src/pages/Forms/BasicForm' },
// {
// path: 'form/step-form',
// component: './src/pages/Forms/StepForm',
// indexRoute: { redirect: '/form/step-form/info' },
// childRoutes: [
// { path: 'info', component: './src/pages/Forms/StepForm/Step1' },
// { path: 'confirm', component: './src/pages/Forms/StepForm/Step2' },
// { path: 'result', component: './src/pages/Forms/StepForm/Step3' },
// ],
// },
// { path: 'form/advanced-form', component: './src/pages/Forms/AdvancedForm' },
// forms
{ path: '/form/basic-form', component: './Forms/BasicForm' },
{
path: '/form/step-form',
component: './Forms/StepForm',
routes: [
{ path: '/form/step-form', redirect: '/form/step-form/info' },
{ path: '/form/step-form/info', component: './Forms/StepForm/Step1' },
{ path: '/form/step-form/confirm', component: './Forms/StepForm/Step2' },
{ path: '/form/step-form/result', component: './Forms/StepForm/Step3' },
],
},
{ path: '/form/advanced-form', component: './Forms/AdvancedForm' },
// // list
// { path: 'list/table-list', component: './src/pages/List/TableList' },
// { path: 'list/table-list', component: './src/pages/List/TableList' },
// { path: 'list/basic-list', component: './src/pages/List/BasicList' },
// { path: 'list/card-list', component: './src/pages/List/CardList' },
// {
// path: 'list/search',
// component: './src/pages/List/List',
// indexRoute: { redirect: '/list/search/projects' },
// childRoutes: [
// { path: 'articles', component: './src/pages/List/Articles' },
// { path: 'projects', component: './src/pages/List/Projects' },
// { path: 'applications', component: './src/pages/List/Applications' },
// ],
// },
// list
{ path: '/list/table-list', component: './List/TableList' },
{ path: '/list/table-list', component: './List/TableList' },
{ path: '/list/basic-list', component: './List/BasicList' },
{ path: '/list/card-list', component: './List/CardList' },
{
path: '/list/search',
component: './List/List',
routes: [
{ path: '/list/search', redirect: '/list/search/projects' },
{ path: '/list/search/articles', component: './List/Articles' },
{ path: '/list/search/projects', component: './List/Projects' },
{ path: '/list/search/applications', component: './List/Applications' },
],
},
// // profile
// { path: 'profile/basic', component: './src/pages/Profile/BasicProfile' },
// { path: 'profile/advanced', component: './src/pages/Profile/AdvancedProfile' },
// profile
{ path: '/profile/basic', component: './Profile/BasicProfile' },
{ path: '/profile/advanced', component: './Profile/AdvancedProfile' },
// // result
// { path: 'result/success', component: './src/pages/Result/Success' },
// { path: 'result/fail', component: './src/pages/Result/Error' },
// result
{ path: '/result/success', component: './Result/Success' },
{ path: '/result/fail', component: './Result/Error' },
// // exception
// { path: 'exception/403', component: './src/pages/Exception/403' },
// { path: 'exception/404', component: './src/pages/Exception/404' },
// { path: 'exception/500', component: './src/pages/Exception/500' },
// exception
{ path: '/exception/403', component: './Exception/403' },
{ path: '/exception/404', component: './Exception/404' },
{ path: '/exception/500', component: './Exception/500' },
],
},
],
// // ],
// }],
// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
theme: {
// 'primary-color': '#10e99b',
'card-actions-background': '#f5f8fa',
},
// copy from old webpackrc.js
......@@ -102,9 +107,9 @@ export default {
common: path.resolve(__dirname, '../src/common/'),
},
ignoreMomentLocale: true,
theme: './src/theme.js',
// theme: './theme.js',
// html: { TODO remove
// template: './src/index.ejs',
// template: './index.ejs',
// },
publicPath: '/',
// TODO check hash config
......@@ -130,3 +135,46 @@ export default {
},
},
};
// [
// {
// "path": "/Dashboard",
// "exact": true,
// "redirect": "/Dashboard/Analysis"
// },
// {
// "path": "/Forms",
// "exact": true,
// "redirect": "/Forms/BasicForm"
// },
// {
// "path": "/Forms/StepForm",
// "exact": true,
// "redirect": "/Forms/StepForm/Step1"
// },
// {
// "path": "/List",
// "exact": true,
// "redirect": "/List/TableList"
// },
// {
// "path": "/List/Search",
// "exact": true,
// "redirect": "/List/Search/Articles"
// },
// {
// "path": "/Profile",
// "exact": true,
// "redirect": "/Profile/BasicProfile"
// },
// {
// "path": "/Result",
// "exact": true,
// "redirect": "/Result/Success"
// },
// {
// "path": "/Exception",
// "exact": true,
// "redirect": "/Exception/403"
// }
// ]
......@@ -199,19 +199,19 @@ const menuData = [
{
name: 'dashboard',
icon: 'dashboard',
path: 'Dashboard',
path: 'dashboard',
children: [
{
name: '分析页',
path: 'Analysis',
path: 'analysis',
},
{
name: '监控页',
path: 'Monitor',
path: 'monitor',
},
{
name: '工作台',
path: 'Workplace',
path: 'workplace',
// hideInBreadcrumb: true,
// hideInMenu: true,
},
......@@ -220,55 +220,55 @@ const menuData = [
{
name: '表单页',
icon: 'form',
path: 'Forms',
path: 'form',
children: [
{
name: '基础表单',
path: 'BasicForm',
path: 'basic-form',
},
{
name: '分步表单',
path: 'StepForm',
path: 'step-form',
},
{
name: '高级表单',
// authority: 'admin',
path: 'AdvancedForm',
path: 'advanced-form',
},
],
},
{
name: '列表页',
icon: 'table',
path: 'List',
path: 'list',
children: [
{
name: '查询表格',
path: 'TableList',
path: 'table-list',
},
{
name: '标准列表',
path: 'basicList',
path: 'basic-list',
},
{
name: '卡片列表',
path: 'CardList',
path: 'card-list',
},
{
name: '搜索列表',
path: 'Search',
path: 'search',
children: [
{
name: '搜索列表(文章)',
path: 'Articles',
path: 'articles',
},
{
name: '搜索列表(项目)',
path: 'Projects',
path: 'projects',
},
{
name: '搜索列表(应用)',
path: 'Applications',
path: 'applications',
},
],
},
......@@ -277,15 +277,15 @@ const menuData = [
{
name: '详情页',
icon: 'profile',
path: 'Profile',
path: 'profile',
children: [
{
name: '基础详情页',
path: 'BasicProfile',
path: 'basic',
},
{
name: '高级详情页',
path: 'AdvancedProfile',
path: 'advanced',
// authority: 'admin',
},
],
......@@ -293,22 +293,22 @@ const menuData = [
{
name: '结果页',
icon: 'check-circle-o',
path: 'Result',
path: 'result',
children: [
{
name: '成功',
path: 'Success',
path: 'success',
},
{
name: '失败',
path: 'Error',
path: 'fail',
},
],
},
{
name: '异常页',
icon: 'warning',
path: 'Exception',
path: 'exception',
children: [
{
name: '403',
......@@ -322,11 +322,11 @@ const menuData = [
name: '500',
path: '500',
},
{
name: '触发异常',
path: 'triggerException',
hideInMenu: true,
},
// {
// name: '触发异常',
// path: 'triggerException',
// hideInMenu: true,
// },
],
},
{
......@@ -337,30 +337,30 @@ const menuData = [
children: [
{
name: '登录',
path: 'Login',
path: 'login',
},
{
name: '注册',
path: 'Register',
path: 'register',
},
{
name: '注册结果',
path: 'RegisterResult',
path: 'register-result',
},
],
},
{
name: '个人页',
icon: 'user',
path: 'Account',
path: 'acount',
children: [
{
name: '个人中心',
path: 'Center',
path: 'center',
},
{
name: '个人设置',
path: 'Settings',
path: 'settings',
},
],
},
......
......@@ -3,7 +3,7 @@ import { connect } from 'dva';
import { Link, routerRedux, Route, Switch, Redirect } from 'dva/router';
import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd';
import { getRoutes } from '../../../utils/utils';
import GridContent from '../../../layouts/GridContent';
import GridContent from '../../layouts/GridContent';
import styles from './Center.less';
@connect(({ list, loading, user, project }) => ({
......
......@@ -4,7 +4,7 @@ import { Route, routerRedux, Switch, Redirect } from 'dva/router';
import { Menu } from 'antd';
import styles from './Info.less';
import { getRoutes } from '../../../utils/utils';
import GridContent from '../../../layouts/GridContent';
import GridContent from '../../layouts/GridContent';
const { Item } = Menu;
......
......@@ -26,7 +26,7 @@ import {
import Trend from 'components/Trend';
import NumberInfo from 'components/NumberInfo';
import numeral from 'numeral';
import GridContent from '../../layouts/GridContent';
import GridContent from '../layouts/GridContent';
import Yuan from '../../utils/Yuan';
import { getTimeDistance } from '../../utils/utils';
......
......@@ -6,7 +6,7 @@ import NumberInfo from 'components/NumberInfo';
import CountDown from 'components/CountDown';
import ActiveChart from 'components/ActiveChart';
import numeral from 'numeral';
import GridContent from '../../layouts/GridContent';
import GridContent from '../layouts/GridContent';
import Authorized from '../../utils/Authorized';
import styles from './Monitor.less';
......
......@@ -6,7 +6,7 @@ import { Row, Col, Card, List, Avatar } from 'antd';
import { Radar } from 'components/Charts';
import EditableLinkGroup from 'components/EditableLinkGroup';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './Workplace.less';
......
......@@ -14,7 +14,7 @@ import {
} from 'antd';
import { connect } from 'dva';
import FooterToolbar from 'components/FooterToolbar';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import TableForm from './TableForm';
import styles from './style.less';
......
......@@ -12,7 +12,7 @@ import {
Icon,
Tooltip,
} from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './style.less';
const FormItem = Form.Item;
......
import React, { PureComponent, Fragment } from 'react';
import { Card, Steps } from 'antd';
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from '../style.less';
// import { Route, Redirect, Switch } from 'dva/router';
......
......@@ -5,7 +5,7 @@ import { Row, Col, Form, Card, Select, Icon, Avatar, List, Tooltip, Dropdown, Me
import TagSelect from 'components/TagSelect';
import StandardFormRow from 'components/StandardFormRow';
import { formatWan } from '../../../utils/utils';
import { formatWan } from '../../utils/utils';
import styles from './Applications.less';
......
@import '~antd/lib/style/themes/default.less';
@import '../../../utils/utils.less';
@import '../../utils/utils.less';
.filterCardList {
margin-bottom: -24px;
......
@import '~antd/lib/style/themes/default.less';
@import '../../../utils/utils.less';
@import '../../utils/utils.less';
.listContent {
.description {
......
......@@ -21,7 +21,7 @@ import {
Select,
} from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import Result from '../../components/Result';
import styles from './BasicList.less';
......
......@@ -3,7 +3,7 @@ import { connect } from 'dva';
import { Card, Button, Icon, List } from 'antd';
import Ellipsis from 'components/Ellipsis';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './CardList.less';
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { routerRedux } from 'dva/router';
import { connect } from 'dva';
import { Input } from 'antd';
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
@connect()
export default class SearchList extends Component {
......
@import '~antd/lib/style/themes/default.less';
@import '../../../utils/utils.less';
@import '../../utils/utils.less';
.coverCardList {
margin-bottom: -24px;
......
......@@ -22,7 +22,7 @@ import {
Radio,
} from 'antd';
import StandardTable from 'components/StandardTable';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './TableList.less';
......
......@@ -19,7 +19,7 @@ import {
} from 'antd';
import classNames from 'classnames';
import DescriptionList from 'components/DescriptionList';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './AdvancedProfile.less';
const { Step } = Steps;
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { connect } from 'dva';
import { Card, Badge, Table, Divider } from 'antd';
import DescriptionList from 'components/DescriptionList';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
import styles from './BasicProfile.less';
const { Description } = DescriptionList;
......
import React, { Fragment } from 'react';
import { Button, Icon, Card } from 'antd';
import Result from 'components/Result';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
const extra = (
<Fragment>
......
import React, { Fragment } from 'react';
import { Button, Row, Col, Icon, Steps, Card } from 'antd';
import Result from 'components/Result';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import PageHeaderLayout from '../layouts/PageHeaderLayout';
const { Step } = Steps;
......
import React from 'react';
import { getRouterData } from 'common/router';
import { getMenuData } from 'common/menu';
import UserLayout from '../../layouts/UserLayout';
import UserLayout from '../layouts/UserLayout';
export default props => {
const { children, location } = props;
......
[
{
"path": "/Dashboard",
"exact": true,
"redirect": "/Dashboard/Analysis"
},
{
"path": "/Forms",
"exact": true,
"redirect": "/Forms/BasicForm"
},
{
"path": "/Forms/StepForm",
"exact": true,
"redirect": "/Forms/StepForm/Step1"
},
{
"path": "/List",
"exact": true,
"redirect": "/List/TableList"
},
{
"path": "/List/Search",
"exact": true,
"redirect": "/List/Search/Articles"
},
{
"path": "/Profile",
"exact": true,
"redirect": "/Profile/BasicProfile"
},
{
"path": "/Result",
"exact": true,
"redirect": "/Result/Success"
},
{
"path": "/Exception",
"exact": true,
"redirect": "/Exception/403"
}
]
import React from 'react';
export default () => <div />;
......@@ -4,16 +4,16 @@ import React from 'react';
import { Layout } from 'antd';
import DocumentTitle from 'react-document-title';
import { connect } from 'dva';
import { Route, Redirect, Switch } from 'dva/router';
// import { Route, Redirect, Switch } from 'dva/router';
import { ContainerQuery } from 'react-container-query';
import classNames from 'classnames';
import pathToRegexp from 'path-to-regexp';
import SiderMenu from '../components/SiderMenu';
import NotFound from '../pages/Exception/404';
import { getRoutes } from '../utils/utils';
import Authorized from '../utils/Authorized';
import SettingDarwer from '../components/SettingDarwer';
import logo from '../assets/logo.svg';
import SiderMenu from '../../components/SiderMenu';
// import NotFound from '../Exception/404';
// import { getRoutes } from '../utils/utils';
import Authorized from '../../utils/Authorized';
import SettingDarwer from '../../components/SettingDarwer';
import logo from '../../assets/logo.svg';
import Footer from './Footer';
import Header from './Header';
import Context from './MenuContext';
......
import React, { Fragment } from 'react';
import { Layout, Icon } from 'antd';
import GlobalFooter from '../components/GlobalFooter';
import GlobalFooter from '../../components/GlobalFooter';
const { Footer } = Layout;
const FooterView = () => (
......
......@@ -3,10 +3,10 @@ import { Layout, message } from 'antd';
import Animate from 'rc-animate';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import GlobalHeader from '../components/GlobalHeader';
import TopNavHeader from '../components/TopNavHeader';
import GlobalHeader from '../../components/GlobalHeader';
import TopNavHeader from '../../components/TopNavHeader';
import styles from './Header.less';
import Authorized from '../utils/Authorized';
import Authorized from '../../utils/Authorized';
const { Header } = Layout;
......
import React from 'react';
import { Link } from 'dva/router';
import PageHeader from '../components/PageHeader';
import PageHeader from '../../components/PageHeader';
import GridContent from './GridContent';
import styles from './PageHeaderLayout.less';
import MenuContext from './MenuContext';
......
// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
module.exports = {
// 'primary-color': '#10e99b',
'card-actions-background': '#f5f8fa',
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment