From d4e10ad5c231a486cb993b8f9ff308607e7004af Mon Sep 17 00:00:00 2001 From: chencheng Date: Fri, 23 Mar 2018 23:31:09 +0800 Subject: [PATCH] refact the directory structure --- .umirc.js | 19 +++++++++++++ package.json | 6 ++++- src/global.js | 1 + src/index.js | 25 ------------------ src/{routes => layouts}/app.js | 2 +- src/{routes => layouts}/app.less | 0 src/layouts/index.js | 14 ++++++++++ src/{routes/error/index.js => pages/404.js} | 2 +- .../error/index.less => pages/404.less} | 0 .../UIElement/dataTable/index.js | 0 .../UIElement/dropOption/index.js | 0 .../UIElement/editor/index.js | 0 .../UIElement/iconfont/emoji.js | 0 .../UIElement/iconfont/index.js | 0 .../UIElement/iconfont/index.less | 0 .../UIElement/layer/index.js | 0 .../UIElement/search/index.js | 0 src/{routes => pages}/chart/Container.js | 0 src/{routes => pages}/chart/Container.less | 0 .../chart/ECharts/AirportCoordComponent.js | 0 .../chart/ECharts/BubbleGradientComponent.js | 0 .../chart/ECharts/CalendarComponent.js | 0 .../chart/ECharts/ChartAPIComponent.js | 0 .../ECharts/ChartShowLoadingComponent.js | 0 .../chart/ECharts/ChartWithEventComponent.js | 0 .../chart/ECharts/DynamicChartComponent.js | 0 .../chart/ECharts/EchartsComponent.js | 0 .../chart/ECharts/GCalendarComponent.js | 0 .../chart/ECharts/GaugeComponent.js | 0 .../chart/ECharts/GraphComponent.js | 0 .../chart/ECharts/LiquidfillComponent.js | 0 .../chart/ECharts/LunarCalendarComponent.js | 0 .../chart/ECharts/MainPageComponent.js | 0 .../chart/ECharts/MapChartComponent.js | 0 .../chart/ECharts/ModuleLoadChartComponent.js | 0 .../chart/ECharts/MoonComponent.js | 0 .../chart/ECharts/SimpleChartComponent.js | 0 .../chart/ECharts/ThemeChartComponent.js | 0 .../ECharts/TransparentBar3DComPonent.js | 0 .../chart/ECharts/TreemapComponent.js | 0 src/{routes => pages}/chart/ECharts/index.js | 0 .../chart/ECharts/index.less | 0 .../chart/ECharts/theme/macarons.js | 0 .../chart/ECharts/theme/shine.js | 0 .../chart/Recharts/AreaChartComponent.js | 0 .../chart/Recharts/BarChartComponent.js | 0 .../chart/Recharts/Container.js | 0 .../chart/Recharts/Container.less | 0 .../chart/Recharts/LineChartComponent.js | 0 .../chart/Recharts/ReChartsComponent.js | 0 src/{routes => pages}/chart/Recharts/index.js | 0 .../chart/Recharts/index.less | 0 .../chart/highCharts/HighChartsComponent.js | 0 .../chart/highCharts/HighMoreComponent.js | 0 .../chart/highCharts/HighmapsComponent.js | 0 .../chart/highCharts/HighstockComponent.js | 0 .../chart/highCharts/index.js | 0 .../chart/highCharts/index.less | 0 .../chart/highCharts/mapdata/europe.js | 0 .../dashboard/components/browser.js | 0 .../dashboard/components/browser.less | 0 .../dashboard/components/comments.js | 0 .../dashboard/components/comments.less | 0 .../dashboard/components/completed.js | 0 .../dashboard/components/completed.less | 0 .../dashboard/components/cpu.js | 0 .../dashboard/components/cpu.less | 0 .../dashboard/components/index.js | 0 .../dashboard/components/numberCard.js | 0 .../dashboard/components/numberCard.less | 0 .../dashboard/components/quote.js | 0 .../dashboard/components/quote.less | 0 .../dashboard/components/recentSales.js | 0 .../dashboard/components/recentSales.less | 0 .../dashboard/components/sales.js | 0 .../dashboard/components/sales.less | 0 .../dashboard/components/user-background.png | Bin .../dashboard/components/user.js | 0 .../dashboard/components/user.less | 0 .../dashboard/components/weather.js | 0 .../dashboard/components/weather.less | 0 src/{routes => pages}/dashboard/index.js | 0 src/{routes => pages}/dashboard/index.less | 0 src/{ => pages/dashboard}/models/dashboard.js | 6 ++--- .../dashboard}/services/dashboard.js | 0 src/{ => pages/dashboard}/services/weather.js | 0 src/{ => pages}/document.ejs | 0 src/pages/index.js | 3 +++ src/{routes => pages}/login/index.js | 0 src/{routes => pages}/login/index.less | 0 src/{ => pages/login}/models/login.js | 2 +- src/{ => pages/login}/services/login.js | 0 .../post => pages/post/components}/List.js | 0 .../post => pages/post/components}/List.less | 0 src/{routes => pages}/post/index.js | 2 +- src/{ => pages/post}/models/post.js | 4 +-- src/{ => pages/post}/services/posts.js | 0 src/{routes => pages}/request/index.js | 0 src/{routes => pages}/request/index.less | 0 .../user/detail => pages/user/$id}/index.js | 0 .../user/detail => pages/user/$id}/index.less | 0 .../user => pages/user/$id/models}/detail.js | 0 .../user => pages/user/components}/Filter.js | 0 .../user => pages/user/components}/List.js | 0 .../user => pages/user/components}/List.less | 0 .../user => pages/user/components}/Modal.js | 0 src/{routes => pages}/user/index.js | 6 ++--- src/{ => pages/user}/models/user.js | 6 ++--- src/{ => pages/user}/services/user.js | 0 src/{ => pages/user}/services/users.js | 0 src/plugins/onError.js | 8 ++++++ src/router.js | 12 --------- src/tests/models/example-test.js | 1 - src/{models/common.js => utils/model.js} | 0 114 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 .umirc.js create mode 100644 src/global.js delete mode 100644 src/index.js rename src/{routes => layouts}/app.js (99%) rename src/{routes => layouts}/app.less (100%) create mode 100644 src/layouts/index.js rename src/{routes/error/index.js => pages/404.js} (88%) rename src/{routes/error/index.less => pages/404.less} (100%) rename src/{routes => pages}/UIElement/dataTable/index.js (100%) rename src/{routes => pages}/UIElement/dropOption/index.js (100%) rename src/{routes => pages}/UIElement/editor/index.js (100%) rename src/{routes => pages}/UIElement/iconfont/emoji.js (100%) rename src/{routes => pages}/UIElement/iconfont/index.js (100%) rename src/{routes => pages}/UIElement/iconfont/index.less (100%) rename src/{routes => pages}/UIElement/layer/index.js (100%) rename src/{routes => pages}/UIElement/search/index.js (100%) rename src/{routes => pages}/chart/Container.js (100%) rename src/{routes => pages}/chart/Container.less (100%) rename src/{routes => pages}/chart/ECharts/AirportCoordComponent.js (100%) rename src/{routes => pages}/chart/ECharts/BubbleGradientComponent.js (100%) rename src/{routes => pages}/chart/ECharts/CalendarComponent.js (100%) rename src/{routes => pages}/chart/ECharts/ChartAPIComponent.js (100%) rename src/{routes => pages}/chart/ECharts/ChartShowLoadingComponent.js (100%) rename src/{routes => pages}/chart/ECharts/ChartWithEventComponent.js (100%) rename src/{routes => pages}/chart/ECharts/DynamicChartComponent.js (100%) rename src/{routes => pages}/chart/ECharts/EchartsComponent.js (100%) rename src/{routes => pages}/chart/ECharts/GCalendarComponent.js (100%) rename src/{routes => pages}/chart/ECharts/GaugeComponent.js (100%) rename src/{routes => pages}/chart/ECharts/GraphComponent.js (100%) rename src/{routes => pages}/chart/ECharts/LiquidfillComponent.js (100%) rename src/{routes => pages}/chart/ECharts/LunarCalendarComponent.js (100%) rename src/{routes => pages}/chart/ECharts/MainPageComponent.js (100%) rename src/{routes => pages}/chart/ECharts/MapChartComponent.js (100%) rename src/{routes => pages}/chart/ECharts/ModuleLoadChartComponent.js (100%) rename src/{routes => pages}/chart/ECharts/MoonComponent.js (100%) rename src/{routes => pages}/chart/ECharts/SimpleChartComponent.js (100%) rename src/{routes => pages}/chart/ECharts/ThemeChartComponent.js (100%) rename src/{routes => pages}/chart/ECharts/TransparentBar3DComPonent.js (100%) rename src/{routes => pages}/chart/ECharts/TreemapComponent.js (100%) rename src/{routes => pages}/chart/ECharts/index.js (100%) rename src/{routes => pages}/chart/ECharts/index.less (100%) rename src/{routes => pages}/chart/ECharts/theme/macarons.js (100%) rename src/{routes => pages}/chart/ECharts/theme/shine.js (100%) rename src/{routes => pages}/chart/Recharts/AreaChartComponent.js (100%) rename src/{routes => pages}/chart/Recharts/BarChartComponent.js (100%) rename src/{routes => pages}/chart/Recharts/Container.js (100%) rename src/{routes => pages}/chart/Recharts/Container.less (100%) rename src/{routes => pages}/chart/Recharts/LineChartComponent.js (100%) rename src/{routes => pages}/chart/Recharts/ReChartsComponent.js (100%) rename src/{routes => pages}/chart/Recharts/index.js (100%) rename src/{routes => pages}/chart/Recharts/index.less (100%) rename src/{routes => pages}/chart/highCharts/HighChartsComponent.js (100%) rename src/{routes => pages}/chart/highCharts/HighMoreComponent.js (100%) rename src/{routes => pages}/chart/highCharts/HighmapsComponent.js (100%) rename src/{routes => pages}/chart/highCharts/HighstockComponent.js (100%) rename src/{routes => pages}/chart/highCharts/index.js (100%) rename src/{routes => pages}/chart/highCharts/index.less (100%) rename src/{routes => pages}/chart/highCharts/mapdata/europe.js (100%) rename src/{routes => pages}/dashboard/components/browser.js (100%) rename src/{routes => pages}/dashboard/components/browser.less (100%) rename src/{routes => pages}/dashboard/components/comments.js (100%) rename src/{routes => pages}/dashboard/components/comments.less (100%) rename src/{routes => pages}/dashboard/components/completed.js (100%) rename src/{routes => pages}/dashboard/components/completed.less (100%) rename src/{routes => pages}/dashboard/components/cpu.js (100%) rename src/{routes => pages}/dashboard/components/cpu.less (100%) rename src/{routes => pages}/dashboard/components/index.js (100%) rename src/{routes => pages}/dashboard/components/numberCard.js (100%) rename src/{routes => pages}/dashboard/components/numberCard.less (100%) rename src/{routes => pages}/dashboard/components/quote.js (100%) rename src/{routes => pages}/dashboard/components/quote.less (100%) rename src/{routes => pages}/dashboard/components/recentSales.js (100%) rename src/{routes => pages}/dashboard/components/recentSales.less (100%) rename src/{routes => pages}/dashboard/components/sales.js (100%) rename src/{routes => pages}/dashboard/components/sales.less (100%) rename src/{routes => pages}/dashboard/components/user-background.png (100%) rename src/{routes => pages}/dashboard/components/user.js (100%) rename src/{routes => pages}/dashboard/components/user.less (100%) rename src/{routes => pages}/dashboard/components/weather.js (100%) rename src/{routes => pages}/dashboard/components/weather.less (100%) rename src/{routes => pages}/dashboard/index.js (100%) rename src/{routes => pages}/dashboard/index.less (100%) rename src/{ => pages/dashboard}/models/dashboard.js (92%) rename src/{ => pages/dashboard}/services/dashboard.js (100%) rename src/{ => pages/dashboard}/services/weather.js (100%) rename src/{ => pages}/document.ejs (100%) create mode 100644 src/pages/index.js rename src/{routes => pages}/login/index.js (100%) rename src/{routes => pages}/login/index.less (100%) rename src/{ => pages/login}/models/login.js (93%) rename src/{ => pages/login}/services/login.js (100%) rename src/{routes/post => pages/post/components}/List.js (100%) rename src/{routes/post => pages/post/components}/List.less (100%) rename src/{routes => pages}/post/index.js (97%) rename src/{ => pages/post}/models/post.js (92%) rename src/{ => pages/post}/services/posts.js (100%) rename src/{routes => pages}/request/index.js (100%) rename src/{routes => pages}/request/index.less (100%) rename src/{routes/user/detail => pages/user/$id}/index.js (100%) rename src/{routes/user/detail => pages/user/$id}/index.less (100%) rename src/{models/user => pages/user/$id/models}/detail.js (100%) rename src/{routes/user => pages/user/components}/Filter.js (100%) rename src/{routes/user => pages/user/components}/List.js (100%) rename src/{routes/user => pages/user/components}/List.less (100%) rename src/{routes/user => pages/user/components}/Modal.js (100%) rename src/{routes => pages}/user/index.js (96%) rename src/{ => pages/user}/models/user.js (94%) rename src/{ => pages/user}/services/user.js (100%) rename src/{ => pages/user}/services/users.js (100%) create mode 100644 src/plugins/onError.js delete mode 100644 src/tests/models/example-test.js rename src/{models/common.js => utils/model.js} (100%) diff --git a/.umirc.js b/.umirc.js new file mode 100644 index 0000000..9ca6633 --- /dev/null +++ b/.umirc.js @@ -0,0 +1,19 @@ + +export default { + plugins: [ + 'umi-plugin-dva', + [ + 'umi-plugin-routes', + { + exclude: [ + /model\.(j|t)sx?$/, + /service\.(j|t)sx?$/, + /models\//, + /components\//, + /services\//, + /chart\/Container\.js$/, + ], + }, + ], + ], +} diff --git a/package.json b/package.json index 150a917..b9cc4af 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "name": "antd-admin", "version": "4.3.9", "dependencies": { + "@babel/polyfill": "^7.0.0-beta.42", "axios": "^0.17.1", "classnames": "^2.2.5", "d3-shape": "^1.2.0", @@ -28,7 +29,10 @@ "react-draft-wysiwyg": "^1.10.0", "react-helmet": "^5.1.3", "react-highcharts": "^15.0.0", - "recharts": "^1.0.0-beta.0" + "recharts": "^1.0.0-beta.0", + "umi": "^1.1.0", + "umi-plugin-dva": "^0.4.0", + "umi-plugin-routes": "^0.1.2" }, "devDependencies": { "babel-plugin-dev-expression": "^0.2.1", diff --git a/src/global.js b/src/global.js new file mode 100644 index 0000000..33b7c42 --- /dev/null +++ b/src/global.js @@ -0,0 +1 @@ +import '@babel/polyfill' diff --git a/src/index.js b/src/index.js deleted file mode 100644 index e880e17..0000000 --- a/src/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import { message } from 'antd' -import dva from 'dva' -import createLoading from 'dva-loading' -import createHistory from 'history/createBrowserHistory' -import 'babel-polyfill' - -// 1. Initialize -const app = dva({ - ...createLoading({ - effects: true, - }), - history: createHistory(), - onError (error) { - message.error(error.message) - }, -}) - -// 2. Model -app.model(require('./models/app')) - -// 3. Router -app.router(require('./router')) - -// 4. Start -app.start('#root') diff --git a/src/routes/app.js b/src/layouts/app.js similarity index 99% rename from src/routes/app.js rename to src/layouts/app.js index 91bd1a8..adef0b7 100644 --- a/src/routes/app.js +++ b/src/layouts/app.js @@ -10,7 +10,7 @@ import { BackTop, Layout } from 'antd' import { classnames, config } from 'utils' import { Helmet } from 'react-helmet' import { withRouter } from 'dva/router' -import Error from './error' +import Error from '../pages/404' import '../themes/index.less' import './app.less' diff --git a/src/routes/app.less b/src/layouts/app.less similarity index 100% rename from src/routes/app.less rename to src/layouts/app.less diff --git a/src/layouts/index.js b/src/layouts/index.js new file mode 100644 index 0000000..bcb7310 --- /dev/null +++ b/src/layouts/index.js @@ -0,0 +1,14 @@ +import { LocaleProvider } from 'antd' +import enUS from 'antd/lib/locale-provider/en_US' +import withRouter from 'umi/withRouter' +import App from './app' + +export default withRouter((props) => { + return ( + + + { props.children } + + + ) +}) diff --git a/src/routes/error/index.js b/src/pages/404.js similarity index 88% rename from src/routes/error/index.js rename to src/pages/404.js index caa83ee..8b8f870 100644 --- a/src/routes/error/index.js +++ b/src/pages/404.js @@ -1,7 +1,7 @@ import React from 'react' import { Icon } from 'antd' import { Page } from 'components' -import styles from './index.less' +import styles from './404.less' const Error = () => (
diff --git a/src/routes/error/index.less b/src/pages/404.less similarity index 100% rename from src/routes/error/index.less rename to src/pages/404.less diff --git a/src/routes/UIElement/dataTable/index.js b/src/pages/UIElement/dataTable/index.js similarity index 100% rename from src/routes/UIElement/dataTable/index.js rename to src/pages/UIElement/dataTable/index.js diff --git a/src/routes/UIElement/dropOption/index.js b/src/pages/UIElement/dropOption/index.js similarity index 100% rename from src/routes/UIElement/dropOption/index.js rename to src/pages/UIElement/dropOption/index.js diff --git a/src/routes/UIElement/editor/index.js b/src/pages/UIElement/editor/index.js similarity index 100% rename from src/routes/UIElement/editor/index.js rename to src/pages/UIElement/editor/index.js diff --git a/src/routes/UIElement/iconfont/emoji.js b/src/pages/UIElement/iconfont/emoji.js similarity index 100% rename from src/routes/UIElement/iconfont/emoji.js rename to src/pages/UIElement/iconfont/emoji.js diff --git a/src/routes/UIElement/iconfont/index.js b/src/pages/UIElement/iconfont/index.js similarity index 100% rename from src/routes/UIElement/iconfont/index.js rename to src/pages/UIElement/iconfont/index.js diff --git a/src/routes/UIElement/iconfont/index.less b/src/pages/UIElement/iconfont/index.less similarity index 100% rename from src/routes/UIElement/iconfont/index.less rename to src/pages/UIElement/iconfont/index.less diff --git a/src/routes/UIElement/layer/index.js b/src/pages/UIElement/layer/index.js similarity index 100% rename from src/routes/UIElement/layer/index.js rename to src/pages/UIElement/layer/index.js diff --git a/src/routes/UIElement/search/index.js b/src/pages/UIElement/search/index.js similarity index 100% rename from src/routes/UIElement/search/index.js rename to src/pages/UIElement/search/index.js diff --git a/src/routes/chart/Container.js b/src/pages/chart/Container.js similarity index 100% rename from src/routes/chart/Container.js rename to src/pages/chart/Container.js diff --git a/src/routes/chart/Container.less b/src/pages/chart/Container.less similarity index 100% rename from src/routes/chart/Container.less rename to src/pages/chart/Container.less diff --git a/src/routes/chart/ECharts/AirportCoordComponent.js b/src/pages/chart/ECharts/AirportCoordComponent.js similarity index 100% rename from src/routes/chart/ECharts/AirportCoordComponent.js rename to src/pages/chart/ECharts/AirportCoordComponent.js diff --git a/src/routes/chart/ECharts/BubbleGradientComponent.js b/src/pages/chart/ECharts/BubbleGradientComponent.js similarity index 100% rename from src/routes/chart/ECharts/BubbleGradientComponent.js rename to src/pages/chart/ECharts/BubbleGradientComponent.js diff --git a/src/routes/chart/ECharts/CalendarComponent.js b/src/pages/chart/ECharts/CalendarComponent.js similarity index 100% rename from src/routes/chart/ECharts/CalendarComponent.js rename to src/pages/chart/ECharts/CalendarComponent.js diff --git a/src/routes/chart/ECharts/ChartAPIComponent.js b/src/pages/chart/ECharts/ChartAPIComponent.js similarity index 100% rename from src/routes/chart/ECharts/ChartAPIComponent.js rename to src/pages/chart/ECharts/ChartAPIComponent.js diff --git a/src/routes/chart/ECharts/ChartShowLoadingComponent.js b/src/pages/chart/ECharts/ChartShowLoadingComponent.js similarity index 100% rename from src/routes/chart/ECharts/ChartShowLoadingComponent.js rename to src/pages/chart/ECharts/ChartShowLoadingComponent.js diff --git a/src/routes/chart/ECharts/ChartWithEventComponent.js b/src/pages/chart/ECharts/ChartWithEventComponent.js similarity index 100% rename from src/routes/chart/ECharts/ChartWithEventComponent.js rename to src/pages/chart/ECharts/ChartWithEventComponent.js diff --git a/src/routes/chart/ECharts/DynamicChartComponent.js b/src/pages/chart/ECharts/DynamicChartComponent.js similarity index 100% rename from src/routes/chart/ECharts/DynamicChartComponent.js rename to src/pages/chart/ECharts/DynamicChartComponent.js diff --git a/src/routes/chart/ECharts/EchartsComponent.js b/src/pages/chart/ECharts/EchartsComponent.js similarity index 100% rename from src/routes/chart/ECharts/EchartsComponent.js rename to src/pages/chart/ECharts/EchartsComponent.js diff --git a/src/routes/chart/ECharts/GCalendarComponent.js b/src/pages/chart/ECharts/GCalendarComponent.js similarity index 100% rename from src/routes/chart/ECharts/GCalendarComponent.js rename to src/pages/chart/ECharts/GCalendarComponent.js diff --git a/src/routes/chart/ECharts/GaugeComponent.js b/src/pages/chart/ECharts/GaugeComponent.js similarity index 100% rename from src/routes/chart/ECharts/GaugeComponent.js rename to src/pages/chart/ECharts/GaugeComponent.js diff --git a/src/routes/chart/ECharts/GraphComponent.js b/src/pages/chart/ECharts/GraphComponent.js similarity index 100% rename from src/routes/chart/ECharts/GraphComponent.js rename to src/pages/chart/ECharts/GraphComponent.js diff --git a/src/routes/chart/ECharts/LiquidfillComponent.js b/src/pages/chart/ECharts/LiquidfillComponent.js similarity index 100% rename from src/routes/chart/ECharts/LiquidfillComponent.js rename to src/pages/chart/ECharts/LiquidfillComponent.js diff --git a/src/routes/chart/ECharts/LunarCalendarComponent.js b/src/pages/chart/ECharts/LunarCalendarComponent.js similarity index 100% rename from src/routes/chart/ECharts/LunarCalendarComponent.js rename to src/pages/chart/ECharts/LunarCalendarComponent.js diff --git a/src/routes/chart/ECharts/MainPageComponent.js b/src/pages/chart/ECharts/MainPageComponent.js similarity index 100% rename from src/routes/chart/ECharts/MainPageComponent.js rename to src/pages/chart/ECharts/MainPageComponent.js diff --git a/src/routes/chart/ECharts/MapChartComponent.js b/src/pages/chart/ECharts/MapChartComponent.js similarity index 100% rename from src/routes/chart/ECharts/MapChartComponent.js rename to src/pages/chart/ECharts/MapChartComponent.js diff --git a/src/routes/chart/ECharts/ModuleLoadChartComponent.js b/src/pages/chart/ECharts/ModuleLoadChartComponent.js similarity index 100% rename from src/routes/chart/ECharts/ModuleLoadChartComponent.js rename to src/pages/chart/ECharts/ModuleLoadChartComponent.js diff --git a/src/routes/chart/ECharts/MoonComponent.js b/src/pages/chart/ECharts/MoonComponent.js similarity index 100% rename from src/routes/chart/ECharts/MoonComponent.js rename to src/pages/chart/ECharts/MoonComponent.js diff --git a/src/routes/chart/ECharts/SimpleChartComponent.js b/src/pages/chart/ECharts/SimpleChartComponent.js similarity index 100% rename from src/routes/chart/ECharts/SimpleChartComponent.js rename to src/pages/chart/ECharts/SimpleChartComponent.js diff --git a/src/routes/chart/ECharts/ThemeChartComponent.js b/src/pages/chart/ECharts/ThemeChartComponent.js similarity index 100% rename from src/routes/chart/ECharts/ThemeChartComponent.js rename to src/pages/chart/ECharts/ThemeChartComponent.js diff --git a/src/routes/chart/ECharts/TransparentBar3DComPonent.js b/src/pages/chart/ECharts/TransparentBar3DComPonent.js similarity index 100% rename from src/routes/chart/ECharts/TransparentBar3DComPonent.js rename to src/pages/chart/ECharts/TransparentBar3DComPonent.js diff --git a/src/routes/chart/ECharts/TreemapComponent.js b/src/pages/chart/ECharts/TreemapComponent.js similarity index 100% rename from src/routes/chart/ECharts/TreemapComponent.js rename to src/pages/chart/ECharts/TreemapComponent.js diff --git a/src/routes/chart/ECharts/index.js b/src/pages/chart/ECharts/index.js similarity index 100% rename from src/routes/chart/ECharts/index.js rename to src/pages/chart/ECharts/index.js diff --git a/src/routes/chart/ECharts/index.less b/src/pages/chart/ECharts/index.less similarity index 100% rename from src/routes/chart/ECharts/index.less rename to src/pages/chart/ECharts/index.less diff --git a/src/routes/chart/ECharts/theme/macarons.js b/src/pages/chart/ECharts/theme/macarons.js similarity index 100% rename from src/routes/chart/ECharts/theme/macarons.js rename to src/pages/chart/ECharts/theme/macarons.js diff --git a/src/routes/chart/ECharts/theme/shine.js b/src/pages/chart/ECharts/theme/shine.js similarity index 100% rename from src/routes/chart/ECharts/theme/shine.js rename to src/pages/chart/ECharts/theme/shine.js diff --git a/src/routes/chart/Recharts/AreaChartComponent.js b/src/pages/chart/Recharts/AreaChartComponent.js similarity index 100% rename from src/routes/chart/Recharts/AreaChartComponent.js rename to src/pages/chart/Recharts/AreaChartComponent.js diff --git a/src/routes/chart/Recharts/BarChartComponent.js b/src/pages/chart/Recharts/BarChartComponent.js similarity index 100% rename from src/routes/chart/Recharts/BarChartComponent.js rename to src/pages/chart/Recharts/BarChartComponent.js diff --git a/src/routes/chart/Recharts/Container.js b/src/pages/chart/Recharts/Container.js similarity index 100% rename from src/routes/chart/Recharts/Container.js rename to src/pages/chart/Recharts/Container.js diff --git a/src/routes/chart/Recharts/Container.less b/src/pages/chart/Recharts/Container.less similarity index 100% rename from src/routes/chart/Recharts/Container.less rename to src/pages/chart/Recharts/Container.less diff --git a/src/routes/chart/Recharts/LineChartComponent.js b/src/pages/chart/Recharts/LineChartComponent.js similarity index 100% rename from src/routes/chart/Recharts/LineChartComponent.js rename to src/pages/chart/Recharts/LineChartComponent.js diff --git a/src/routes/chart/Recharts/ReChartsComponent.js b/src/pages/chart/Recharts/ReChartsComponent.js similarity index 100% rename from src/routes/chart/Recharts/ReChartsComponent.js rename to src/pages/chart/Recharts/ReChartsComponent.js diff --git a/src/routes/chart/Recharts/index.js b/src/pages/chart/Recharts/index.js similarity index 100% rename from src/routes/chart/Recharts/index.js rename to src/pages/chart/Recharts/index.js diff --git a/src/routes/chart/Recharts/index.less b/src/pages/chart/Recharts/index.less similarity index 100% rename from src/routes/chart/Recharts/index.less rename to src/pages/chart/Recharts/index.less diff --git a/src/routes/chart/highCharts/HighChartsComponent.js b/src/pages/chart/highCharts/HighChartsComponent.js similarity index 100% rename from src/routes/chart/highCharts/HighChartsComponent.js rename to src/pages/chart/highCharts/HighChartsComponent.js diff --git a/src/routes/chart/highCharts/HighMoreComponent.js b/src/pages/chart/highCharts/HighMoreComponent.js similarity index 100% rename from src/routes/chart/highCharts/HighMoreComponent.js rename to src/pages/chart/highCharts/HighMoreComponent.js diff --git a/src/routes/chart/highCharts/HighmapsComponent.js b/src/pages/chart/highCharts/HighmapsComponent.js similarity index 100% rename from src/routes/chart/highCharts/HighmapsComponent.js rename to src/pages/chart/highCharts/HighmapsComponent.js diff --git a/src/routes/chart/highCharts/HighstockComponent.js b/src/pages/chart/highCharts/HighstockComponent.js similarity index 100% rename from src/routes/chart/highCharts/HighstockComponent.js rename to src/pages/chart/highCharts/HighstockComponent.js diff --git a/src/routes/chart/highCharts/index.js b/src/pages/chart/highCharts/index.js similarity index 100% rename from src/routes/chart/highCharts/index.js rename to src/pages/chart/highCharts/index.js diff --git a/src/routes/chart/highCharts/index.less b/src/pages/chart/highCharts/index.less similarity index 100% rename from src/routes/chart/highCharts/index.less rename to src/pages/chart/highCharts/index.less diff --git a/src/routes/chart/highCharts/mapdata/europe.js b/src/pages/chart/highCharts/mapdata/europe.js similarity index 100% rename from src/routes/chart/highCharts/mapdata/europe.js rename to src/pages/chart/highCharts/mapdata/europe.js diff --git a/src/routes/dashboard/components/browser.js b/src/pages/dashboard/components/browser.js similarity index 100% rename from src/routes/dashboard/components/browser.js rename to src/pages/dashboard/components/browser.js diff --git a/src/routes/dashboard/components/browser.less b/src/pages/dashboard/components/browser.less similarity index 100% rename from src/routes/dashboard/components/browser.less rename to src/pages/dashboard/components/browser.less diff --git a/src/routes/dashboard/components/comments.js b/src/pages/dashboard/components/comments.js similarity index 100% rename from src/routes/dashboard/components/comments.js rename to src/pages/dashboard/components/comments.js diff --git a/src/routes/dashboard/components/comments.less b/src/pages/dashboard/components/comments.less similarity index 100% rename from src/routes/dashboard/components/comments.less rename to src/pages/dashboard/components/comments.less diff --git a/src/routes/dashboard/components/completed.js b/src/pages/dashboard/components/completed.js similarity index 100% rename from src/routes/dashboard/components/completed.js rename to src/pages/dashboard/components/completed.js diff --git a/src/routes/dashboard/components/completed.less b/src/pages/dashboard/components/completed.less similarity index 100% rename from src/routes/dashboard/components/completed.less rename to src/pages/dashboard/components/completed.less diff --git a/src/routes/dashboard/components/cpu.js b/src/pages/dashboard/components/cpu.js similarity index 100% rename from src/routes/dashboard/components/cpu.js rename to src/pages/dashboard/components/cpu.js diff --git a/src/routes/dashboard/components/cpu.less b/src/pages/dashboard/components/cpu.less similarity index 100% rename from src/routes/dashboard/components/cpu.less rename to src/pages/dashboard/components/cpu.less diff --git a/src/routes/dashboard/components/index.js b/src/pages/dashboard/components/index.js similarity index 100% rename from src/routes/dashboard/components/index.js rename to src/pages/dashboard/components/index.js diff --git a/src/routes/dashboard/components/numberCard.js b/src/pages/dashboard/components/numberCard.js similarity index 100% rename from src/routes/dashboard/components/numberCard.js rename to src/pages/dashboard/components/numberCard.js diff --git a/src/routes/dashboard/components/numberCard.less b/src/pages/dashboard/components/numberCard.less similarity index 100% rename from src/routes/dashboard/components/numberCard.less rename to src/pages/dashboard/components/numberCard.less diff --git a/src/routes/dashboard/components/quote.js b/src/pages/dashboard/components/quote.js similarity index 100% rename from src/routes/dashboard/components/quote.js rename to src/pages/dashboard/components/quote.js diff --git a/src/routes/dashboard/components/quote.less b/src/pages/dashboard/components/quote.less similarity index 100% rename from src/routes/dashboard/components/quote.less rename to src/pages/dashboard/components/quote.less diff --git a/src/routes/dashboard/components/recentSales.js b/src/pages/dashboard/components/recentSales.js similarity index 100% rename from src/routes/dashboard/components/recentSales.js rename to src/pages/dashboard/components/recentSales.js diff --git a/src/routes/dashboard/components/recentSales.less b/src/pages/dashboard/components/recentSales.less similarity index 100% rename from src/routes/dashboard/components/recentSales.less rename to src/pages/dashboard/components/recentSales.less diff --git a/src/routes/dashboard/components/sales.js b/src/pages/dashboard/components/sales.js similarity index 100% rename from src/routes/dashboard/components/sales.js rename to src/pages/dashboard/components/sales.js diff --git a/src/routes/dashboard/components/sales.less b/src/pages/dashboard/components/sales.less similarity index 100% rename from src/routes/dashboard/components/sales.less rename to src/pages/dashboard/components/sales.less diff --git a/src/routes/dashboard/components/user-background.png b/src/pages/dashboard/components/user-background.png similarity index 100% rename from src/routes/dashboard/components/user-background.png rename to src/pages/dashboard/components/user-background.png diff --git a/src/routes/dashboard/components/user.js b/src/pages/dashboard/components/user.js similarity index 100% rename from src/routes/dashboard/components/user.js rename to src/pages/dashboard/components/user.js diff --git a/src/routes/dashboard/components/user.less b/src/pages/dashboard/components/user.less similarity index 100% rename from src/routes/dashboard/components/user.less rename to src/pages/dashboard/components/user.less diff --git a/src/routes/dashboard/components/weather.js b/src/pages/dashboard/components/weather.js similarity index 100% rename from src/routes/dashboard/components/weather.js rename to src/pages/dashboard/components/weather.js diff --git a/src/routes/dashboard/components/weather.less b/src/pages/dashboard/components/weather.less similarity index 100% rename from src/routes/dashboard/components/weather.less rename to src/pages/dashboard/components/weather.less diff --git a/src/routes/dashboard/index.js b/src/pages/dashboard/index.js similarity index 100% rename from src/routes/dashboard/index.js rename to src/pages/dashboard/index.js diff --git a/src/routes/dashboard/index.less b/src/pages/dashboard/index.less similarity index 100% rename from src/routes/dashboard/index.less rename to src/pages/dashboard/index.less diff --git a/src/models/dashboard.js b/src/pages/dashboard/models/dashboard.js similarity index 92% rename from src/models/dashboard.js rename to src/pages/dashboard/models/dashboard.js index 798377a..26ef4fe 100644 --- a/src/models/dashboard.js +++ b/src/pages/dashboard/models/dashboard.js @@ -1,8 +1,8 @@ import { parse } from 'qs' import modelExtend from 'dva-model-extend' -import { query } from 'services/dashboard' -import { model } from 'models/common' -import * as weatherService from 'services/weather' +import { query } from '../services/dashboard' +import { model } from 'utils/model' +import * as weatherService from '../services/weather' export default modelExtend(model, { namespace: 'dashboard', diff --git a/src/services/dashboard.js b/src/pages/dashboard/services/dashboard.js similarity index 100% rename from src/services/dashboard.js rename to src/pages/dashboard/services/dashboard.js diff --git a/src/services/weather.js b/src/pages/dashboard/services/weather.js similarity index 100% rename from src/services/weather.js rename to src/pages/dashboard/services/weather.js diff --git a/src/document.ejs b/src/pages/document.ejs similarity index 100% rename from src/document.ejs rename to src/pages/document.ejs diff --git a/src/pages/index.js b/src/pages/index.js new file mode 100644 index 0000000..30f08c2 --- /dev/null +++ b/src/pages/index.js @@ -0,0 +1,3 @@ +import Redirect from 'umi/redirect' + +export default () => diff --git a/src/routes/login/index.js b/src/pages/login/index.js similarity index 100% rename from src/routes/login/index.js rename to src/pages/login/index.js diff --git a/src/routes/login/index.less b/src/pages/login/index.less similarity index 100% rename from src/routes/login/index.less rename to src/pages/login/index.less diff --git a/src/models/login.js b/src/pages/login/models/login.js similarity index 93% rename from src/models/login.js rename to src/pages/login/models/login.js index a40576f..43ff59d 100644 --- a/src/models/login.js +++ b/src/pages/login/models/login.js @@ -1,5 +1,5 @@ import { routerRedux } from 'dva/router' -import { login } from 'services/login' +import { login } from '../services/login' export default { namespace: 'login', diff --git a/src/services/login.js b/src/pages/login/services/login.js similarity index 100% rename from src/services/login.js rename to src/pages/login/services/login.js diff --git a/src/routes/post/List.js b/src/pages/post/components/List.js similarity index 100% rename from src/routes/post/List.js rename to src/pages/post/components/List.js diff --git a/src/routes/post/List.less b/src/pages/post/components/List.less similarity index 100% rename from src/routes/post/List.less rename to src/pages/post/components/List.less diff --git a/src/routes/post/index.js b/src/pages/post/index.js similarity index 97% rename from src/routes/post/index.js rename to src/pages/post/index.js index 87e39ed..21e09c0 100644 --- a/src/routes/post/index.js +++ b/src/pages/post/index.js @@ -5,7 +5,7 @@ import { Tabs } from 'antd' import { routerRedux } from 'dva/router' import queryString from 'query-string' import { Page } from 'components' -import List from './List' +import List from './components/List' const { TabPane } = Tabs diff --git a/src/models/post.js b/src/pages/post/models/post.js similarity index 92% rename from src/models/post.js rename to src/pages/post/models/post.js index 797dcf5..c6929b9 100644 --- a/src/models/post.js +++ b/src/pages/post/models/post.js @@ -1,6 +1,6 @@ import modelExtend from 'dva-model-extend' -import { query } from 'services/posts' -import { pageModel } from 'models/common' +import { query } from '../services/posts' +import { pageModel } from 'utils/model' import queryString from 'query-string' export default modelExtend(pageModel, { diff --git a/src/services/posts.js b/src/pages/post/services/posts.js similarity index 100% rename from src/services/posts.js rename to src/pages/post/services/posts.js diff --git a/src/routes/request/index.js b/src/pages/request/index.js similarity index 100% rename from src/routes/request/index.js rename to src/pages/request/index.js diff --git a/src/routes/request/index.less b/src/pages/request/index.less similarity index 100% rename from src/routes/request/index.less rename to src/pages/request/index.less diff --git a/src/routes/user/detail/index.js b/src/pages/user/$id/index.js similarity index 100% rename from src/routes/user/detail/index.js rename to src/pages/user/$id/index.js diff --git a/src/routes/user/detail/index.less b/src/pages/user/$id/index.less similarity index 100% rename from src/routes/user/detail/index.less rename to src/pages/user/$id/index.less diff --git a/src/models/user/detail.js b/src/pages/user/$id/models/detail.js similarity index 100% rename from src/models/user/detail.js rename to src/pages/user/$id/models/detail.js diff --git a/src/routes/user/Filter.js b/src/pages/user/components/Filter.js similarity index 100% rename from src/routes/user/Filter.js rename to src/pages/user/components/Filter.js diff --git a/src/routes/user/List.js b/src/pages/user/components/List.js similarity index 100% rename from src/routes/user/List.js rename to src/pages/user/components/List.js diff --git a/src/routes/user/List.less b/src/pages/user/components/List.less similarity index 100% rename from src/routes/user/List.less rename to src/pages/user/components/List.less diff --git a/src/routes/user/Modal.js b/src/pages/user/components/Modal.js similarity index 100% rename from src/routes/user/Modal.js rename to src/pages/user/components/Modal.js diff --git a/src/routes/user/index.js b/src/pages/user/index.js similarity index 96% rename from src/routes/user/index.js rename to src/pages/user/index.js index 088c29d..814eea6 100644 --- a/src/routes/user/index.js +++ b/src/pages/user/index.js @@ -5,9 +5,9 @@ import { connect } from 'dva' import { Row, Col, Button, Popconfirm } from 'antd' import { Page } from 'components' import queryString from 'query-string' -import List from './List' -import Filter from './Filter' -import Modal from './Modal' +import List from './components/List' +import Filter from './components/Filter' +import Modal from './components/Modal' const User = ({ diff --git a/src/models/user.js b/src/pages/user/models/user.js similarity index 94% rename from src/models/user.js rename to src/pages/user/models/user.js index bcf8468..206752f 100644 --- a/src/models/user.js +++ b/src/pages/user/models/user.js @@ -2,9 +2,9 @@ import modelExtend from 'dva-model-extend' import queryString from 'query-string' import { config } from 'utils' -import { create, remove, update } from 'services/user' -import * as usersService from 'services/users' -import { pageModel } from './common' +import { create, remove, update } from '../services/user' +import * as usersService from '../services/users' +import { pageModel } from 'utils/model' const { query } = usersService const { prefix } = config diff --git a/src/services/user.js b/src/pages/user/services/user.js similarity index 100% rename from src/services/user.js rename to src/pages/user/services/user.js diff --git a/src/services/users.js b/src/pages/user/services/users.js similarity index 100% rename from src/services/users.js rename to src/pages/user/services/users.js diff --git a/src/plugins/onError.js b/src/plugins/onError.js new file mode 100644 index 0000000..9b76985 --- /dev/null +++ b/src/plugins/onError.js @@ -0,0 +1,8 @@ +import { message } from 'antd' + +export default { + onError(e) { + e.preventDefault() + message.error(error.message) + } +} diff --git a/src/router.js b/src/router.js index 1a8b920..143de89 100644 --- a/src/router.js +++ b/src/router.js @@ -2,17 +2,10 @@ import React from 'react' import PropTypes from 'prop-types' import { Switch, Route, Redirect, routerRedux } from 'dva/router' import dynamic from 'dva/dynamic' -import App from 'routes/app' -import { LocaleProvider } from 'antd' -import enUS from 'antd/lib/locale-provider/en_US' const { ConnectedRouter } = routerRedux const Routers = function ({ history, app }) { - const error = dynamic({ - app, - component: () => import('./routes/error'), - }) const routes = [ { path: '/dashboard', @@ -69,8 +62,6 @@ const Routers = function ({ history, app }) { return ( - - ()} /> { @@ -85,10 +76,7 @@ const Routers = function ({ history, app }) { /> )) } - - - ) } diff --git a/src/tests/models/example-test.js b/src/tests/models/example-test.js deleted file mode 100644 index 8b13789..0000000 --- a/src/tests/models/example-test.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/models/common.js b/src/utils/model.js similarity index 100% rename from src/models/common.js rename to src/utils/model.js