From dc5b0f67a6eebc2ee008d36a5b25e25979549a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Tue, 10 Jul 2018 15:45:44 +0800 Subject: [PATCH] use config routes --- config/config.js | 174 +++++++++++------- src/common/menu.js | 68 +++---- src/pages/Account/Center/Center.js | 2 +- src/pages/Account/Settings/Info.js | 2 +- src/pages/Dashboard/Analysis.js | 2 +- src/pages/Dashboard/Monitor.js | 2 +- src/pages/Dashboard/Workplace.js | 2 +- src/pages/Forms/AdvancedForm.js | 2 +- src/pages/Forms/BasicForm.js | 2 +- .../Forms/StepForm/{_layout.js => index.js} | 2 +- src/pages/List/{Search => }/Applications.js | 2 +- src/pages/List/{Search => }/Applications.less | 2 +- src/pages/List/{Search => }/Articles.js | 0 src/pages/List/{Search => }/Articles.less | 2 +- src/pages/List/BasicList.js | 2 +- src/pages/List/CardList.js | 2 +- src/pages/List/{Search/_layout.js => List.js} | 2 +- src/pages/List/{Search => }/Projects.js | 0 src/pages/List/{Search => }/Projects.less | 2 +- src/pages/List/TableList.js | 2 +- src/pages/Profile/AdvancedProfile.js | 2 +- src/pages/Profile/BasicProfile.js | 2 +- src/pages/Result/Error.js | 2 +- src/pages/Result/Success.js | 2 +- src/pages/User/_layout.js | 2 +- src/pages/_routes.json | 42 ----- src/pages/index.js | 3 - src/{ => pages}/layouts/BasicLayout.js | 14 +- src/{ => pages}/layouts/BlankLayout.js | 0 src/{ => pages}/layouts/Footer.js | 2 +- src/{ => pages}/layouts/GridContent.js | 0 src/{ => pages}/layouts/GridContent.less | 0 src/{ => pages}/layouts/Header.js | 6 +- src/{ => pages}/layouts/Header.less | 0 src/{ => pages}/layouts/LoadingPage.js | 0 src/{ => pages}/layouts/MenuContext.js | 0 src/{ => pages}/layouts/PageHeaderLayout.js | 2 +- src/{ => pages}/layouts/PageHeaderLayout.less | 0 src/{ => pages}/layouts/UserLayout.js | 0 src/{ => pages}/layouts/UserLayout.less | 0 src/{ => pages}/layouts/index.js | 0 src/theme.js | 5 - 42 files changed, 178 insertions(+), 180 deletions(-) rename src/pages/Forms/StepForm/{_layout.js => index.js} (96%) rename src/pages/List/{Search => }/Applications.js (99%) rename src/pages/List/{Search => }/Applications.less (95%) rename src/pages/List/{Search => }/Articles.js (100%) rename src/pages/List/{Search => }/Articles.less (96%) rename src/pages/List/{Search/_layout.js => List.js} (96%) rename src/pages/List/{Search => }/Projects.js (100%) rename src/pages/List/{Search => }/Projects.less (96%) delete mode 100644 src/pages/_routes.json delete mode 100644 src/pages/index.js rename src/{ => pages}/layouts/BasicLayout.js (94%) rename src/{ => pages}/layouts/BlankLayout.js (100%) rename src/{ => pages}/layouts/Footer.js (93%) rename src/{ => pages}/layouts/GridContent.js (100%) rename src/{ => pages}/layouts/GridContent.less (100%) rename src/{ => pages}/layouts/Header.js (95%) rename src/{ => pages}/layouts/Header.less (100%) rename src/{ => pages}/layouts/LoadingPage.js (100%) rename src/{ => pages}/layouts/MenuContext.js (100%) rename src/{ => pages}/layouts/PageHeaderLayout.js (92%) rename src/{ => pages}/layouts/PageHeaderLayout.less (100%) rename src/{ => pages}/layouts/UserLayout.js (100%) rename src/{ => pages}/layouts/UserLayout.less (100%) rename src/{ => pages}/layouts/index.js (100%) delete mode 100644 src/theme.js diff --git a/config/config.js b/config/config.js index 9fed9972..e86ac61d 100644 --- a/config/config.js +++ b/config/config.js @@ -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" +// } +// ] diff --git a/src/common/menu.js b/src/common/menu.js index 060d81a3..4fc7ffc1 100644 --- a/src/common/menu.js +++ b/src/common/menu.js @@ -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', }, ], }, diff --git a/src/pages/Account/Center/Center.js b/src/pages/Account/Center/Center.js index d8e3d0fb..66a1a03e 100644 --- a/src/pages/Account/Center/Center.js +++ b/src/pages/Account/Center/Center.js @@ -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 }) => ({ diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js index 69d87a1c..516fe0f5 100644 --- a/src/pages/Account/Settings/Info.js +++ b/src/pages/Account/Settings/Info.js @@ -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; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 0a3b2de0..072f79fa 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -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'; diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index d8f1aa0c..cbc29daf 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -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'; diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 91e5dd28..40851e38 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -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'; diff --git a/src/pages/Forms/AdvancedForm.js b/src/pages/Forms/AdvancedForm.js index 7fea0d71..49f7d70a 100644 --- a/src/pages/Forms/AdvancedForm.js +++ b/src/pages/Forms/AdvancedForm.js @@ -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'; diff --git a/src/pages/Forms/BasicForm.js b/src/pages/Forms/BasicForm.js index a971a33e..073c7f7a 100644 --- a/src/pages/Forms/BasicForm.js +++ b/src/pages/Forms/BasicForm.js @@ -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; diff --git a/src/pages/Forms/StepForm/_layout.js b/src/pages/Forms/StepForm/index.js similarity index 96% rename from src/pages/Forms/StepForm/_layout.js rename to src/pages/Forms/StepForm/index.js index e71e0e96..d67be97a 100644 --- a/src/pages/Forms/StepForm/_layout.js +++ b/src/pages/Forms/StepForm/index.js @@ -1,6 +1,6 @@ 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'; diff --git a/src/pages/List/Search/Applications.js b/src/pages/List/Applications.js similarity index 99% rename from src/pages/List/Search/Applications.js rename to src/pages/List/Applications.js index 650f4529..1503c6f4 100644 --- a/src/pages/List/Search/Applications.js +++ b/src/pages/List/Applications.js @@ -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'; diff --git a/src/pages/List/Search/Applications.less b/src/pages/List/Applications.less similarity index 95% rename from src/pages/List/Search/Applications.less rename to src/pages/List/Applications.less index c0ca31a4..ba6cfa79 100644 --- a/src/pages/List/Search/Applications.less +++ b/src/pages/List/Applications.less @@ -1,5 +1,5 @@ @import '~antd/lib/style/themes/default.less'; -@import '../../../utils/utils.less'; +@import '../../utils/utils.less'; .filterCardList { margin-bottom: -24px; diff --git a/src/pages/List/Search/Articles.js b/src/pages/List/Articles.js similarity index 100% rename from src/pages/List/Search/Articles.js rename to src/pages/List/Articles.js diff --git a/src/pages/List/Search/Articles.less b/src/pages/List/Articles.less similarity index 96% rename from src/pages/List/Search/Articles.less rename to src/pages/List/Articles.less index e357f4a6..364063a3 100644 --- a/src/pages/List/Search/Articles.less +++ b/src/pages/List/Articles.less @@ -1,5 +1,5 @@ @import '~antd/lib/style/themes/default.less'; -@import '../../../utils/utils.less'; +@import '../../utils/utils.less'; .listContent { .description { diff --git a/src/pages/List/BasicList.js b/src/pages/List/BasicList.js index 97b8e31a..c0821fbb 100644 --- a/src/pages/List/BasicList.js +++ b/src/pages/List/BasicList.js @@ -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'; diff --git a/src/pages/List/CardList.js b/src/pages/List/CardList.js index bf981bf0..41e8a84c 100644 --- a/src/pages/List/CardList.js +++ b/src/pages/List/CardList.js @@ -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'; diff --git a/src/pages/List/Search/_layout.js b/src/pages/List/List.js similarity index 96% rename from src/pages/List/Search/_layout.js rename to src/pages/List/List.js index 0290d059..8a68c9dd 100644 --- a/src/pages/List/Search/_layout.js +++ b/src/pages/List/List.js @@ -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 { diff --git a/src/pages/List/Search/Projects.js b/src/pages/List/Projects.js similarity index 100% rename from src/pages/List/Search/Projects.js rename to src/pages/List/Projects.js diff --git a/src/pages/List/Search/Projects.less b/src/pages/List/Projects.less similarity index 96% rename from src/pages/List/Search/Projects.less rename to src/pages/List/Projects.less index 00e50b80..aeda83c1 100644 --- a/src/pages/List/Search/Projects.less +++ b/src/pages/List/Projects.less @@ -1,5 +1,5 @@ @import '~antd/lib/style/themes/default.less'; -@import '../../../utils/utils.less'; +@import '../../utils/utils.less'; .coverCardList { margin-bottom: -24px; diff --git a/src/pages/List/TableList.js b/src/pages/List/TableList.js index 2aa3697d..bda9c9da 100644 --- a/src/pages/List/TableList.js +++ b/src/pages/List/TableList.js @@ -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'; diff --git a/src/pages/Profile/AdvancedProfile.js b/src/pages/Profile/AdvancedProfile.js index 93d407f2..9039609e 100644 --- a/src/pages/Profile/AdvancedProfile.js +++ b/src/pages/Profile/AdvancedProfile.js @@ -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; diff --git a/src/pages/Profile/BasicProfile.js b/src/pages/Profile/BasicProfile.js index b226de39..10c9e14f 100644 --- a/src/pages/Profile/BasicProfile.js +++ b/src/pages/Profile/BasicProfile.js @@ -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; diff --git a/src/pages/Result/Error.js b/src/pages/Result/Error.js index 3663dbc2..fc33129d 100644 --- a/src/pages/Result/Error.js +++ b/src/pages/Result/Error.js @@ -1,7 +1,7 @@ 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 = ( diff --git a/src/pages/Result/Success.js b/src/pages/Result/Success.js index 61263b56..45a2f02b 100644 --- a/src/pages/Result/Success.js +++ b/src/pages/Result/Success.js @@ -1,7 +1,7 @@ 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; diff --git a/src/pages/User/_layout.js b/src/pages/User/_layout.js index ab782db6..978c8a11 100644 --- a/src/pages/User/_layout.js +++ b/src/pages/User/_layout.js @@ -1,7 +1,7 @@ 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; diff --git a/src/pages/_routes.json b/src/pages/_routes.json deleted file mode 100644 index 3ac872b2..00000000 --- a/src/pages/_routes.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "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" - } -] diff --git a/src/pages/index.js b/src/pages/index.js deleted file mode 100644 index 3c4c9034..00000000 --- a/src/pages/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import React from 'react'; - -export default () =>
; diff --git a/src/layouts/BasicLayout.js b/src/pages/layouts/BasicLayout.js similarity index 94% rename from src/layouts/BasicLayout.js rename to src/pages/layouts/BasicLayout.js index f2de429f..8885e786 100644 --- a/src/layouts/BasicLayout.js +++ b/src/pages/layouts/BasicLayout.js @@ -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'; diff --git a/src/layouts/BlankLayout.js b/src/pages/layouts/BlankLayout.js similarity index 100% rename from src/layouts/BlankLayout.js rename to src/pages/layouts/BlankLayout.js diff --git a/src/layouts/Footer.js b/src/pages/layouts/Footer.js similarity index 93% rename from src/layouts/Footer.js rename to src/pages/layouts/Footer.js index 69c2c2a8..84ec0254 100644 --- a/src/layouts/Footer.js +++ b/src/pages/layouts/Footer.js @@ -1,6 +1,6 @@ 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 = () => ( diff --git a/src/layouts/GridContent.js b/src/pages/layouts/GridContent.js similarity index 100% rename from src/layouts/GridContent.js rename to src/pages/layouts/GridContent.js diff --git a/src/layouts/GridContent.less b/src/pages/layouts/GridContent.less similarity index 100% rename from src/layouts/GridContent.less rename to src/pages/layouts/GridContent.less diff --git a/src/layouts/Header.js b/src/pages/layouts/Header.js similarity index 95% rename from src/layouts/Header.js rename to src/pages/layouts/Header.js index 4e6b13ec..6f3169e6 100644 --- a/src/layouts/Header.js +++ b/src/pages/layouts/Header.js @@ -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; diff --git a/src/layouts/Header.less b/src/pages/layouts/Header.less similarity index 100% rename from src/layouts/Header.less rename to src/pages/layouts/Header.less diff --git a/src/layouts/LoadingPage.js b/src/pages/layouts/LoadingPage.js similarity index 100% rename from src/layouts/LoadingPage.js rename to src/pages/layouts/LoadingPage.js diff --git a/src/layouts/MenuContext.js b/src/pages/layouts/MenuContext.js similarity index 100% rename from src/layouts/MenuContext.js rename to src/pages/layouts/MenuContext.js diff --git a/src/layouts/PageHeaderLayout.js b/src/pages/layouts/PageHeaderLayout.js similarity index 92% rename from src/layouts/PageHeaderLayout.js rename to src/pages/layouts/PageHeaderLayout.js index 2d5df965..ebd24fa8 100644 --- a/src/layouts/PageHeaderLayout.js +++ b/src/pages/layouts/PageHeaderLayout.js @@ -1,6 +1,6 @@ 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'; diff --git a/src/layouts/PageHeaderLayout.less b/src/pages/layouts/PageHeaderLayout.less similarity index 100% rename from src/layouts/PageHeaderLayout.less rename to src/pages/layouts/PageHeaderLayout.less diff --git a/src/layouts/UserLayout.js b/src/pages/layouts/UserLayout.js similarity index 100% rename from src/layouts/UserLayout.js rename to src/pages/layouts/UserLayout.js diff --git a/src/layouts/UserLayout.less b/src/pages/layouts/UserLayout.less similarity index 100% rename from src/layouts/UserLayout.less rename to src/pages/layouts/UserLayout.less diff --git a/src/layouts/index.js b/src/pages/layouts/index.js similarity index 100% rename from src/layouts/index.js rename to src/pages/layouts/index.js diff --git a/src/theme.js b/src/theme.js deleted file mode 100644 index 9e125114..00000000 --- a/src/theme.js +++ /dev/null @@ -1,5 +0,0 @@ -// https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less -module.exports = { - // 'primary-color': '#10e99b', - 'card-actions-background': '#f5f8fa', -}; -- GitLab