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/page.js
similarity index 98%
rename from src/routes/chart/ECharts/index.js
rename to src/pages/chart/ECharts/page.js
index 120260c6..35f29865 100644
--- a/src/routes/chart/ECharts/index.js
+++ b/src/pages/chart/ECharts/page.js
@@ -2,7 +2,7 @@ import React from 'react'
import { Radio } from 'antd'
import { Page } from 'components'
import EchartsComponent from './EchartsComponent'
-import styles from './index.less'
+import styles from './page.less'
const RadioGroup = Radio.Group
diff --git a/src/routes/chart/ECharts/index.less b/src/pages/chart/ECharts/page.less
similarity index 100%
rename from src/routes/chart/ECharts/index.less
rename to src/pages/chart/ECharts/page.less
diff --git a/src/routes/chart/ECharts/theme/macarons.js b/src/pages/chart/ECharts/theme/macarons.js
similarity index 96%
rename from src/routes/chart/ECharts/theme/macarons.js
rename to src/pages/chart/ECharts/theme/macarons.js
index 73fc10d4..64da22d5 100644
--- a/src/routes/chart/ECharts/theme/macarons.js
+++ b/src/pages/chart/ECharts/theme/macarons.js
@@ -1,7 +1,7 @@
(function (root, factory) {
- if (typeof define === 'function' && define.amd) {
+ if (typeof define === 'function' && define.amd) { // eslint-disable-line
// AMD. Register as an anonymous module.
- define(['exports', 'echarts'], factory)
+ define(['exports', 'echarts'], factory) // eslint-disable-line
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
diff --git a/src/routes/chart/ECharts/theme/shine.js b/src/pages/chart/ECharts/theme/shine.js
similarity index 95%
rename from src/routes/chart/ECharts/theme/shine.js
rename to src/pages/chart/ECharts/theme/shine.js
index 027fb4eb..9d342ab4 100644
--- a/src/routes/chart/ECharts/theme/shine.js
+++ b/src/pages/chart/ECharts/theme/shine.js
@@ -1,7 +1,7 @@
(function (root, factory) {
- if (typeof define === 'function' && define.amd) {
+ if (typeof define === 'function' && define.amd) { // eslint-disable-line
// AMD. Register as an anonymous module.
- define(['exports', 'echarts'], factory)
+ define(['exports', 'echarts'], factory) // eslint-disable-line
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'))
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/page.js
similarity index 96%
rename from src/routes/chart/Recharts/index.js
rename to src/pages/chart/Recharts/page.js
index 32a0990f..0bd0f9fe 100644
--- a/src/routes/chart/Recharts/index.js
+++ b/src/pages/chart/Recharts/page.js
@@ -2,7 +2,7 @@ import React from 'react'
import { Radio } from 'antd'
import { Page } from 'components'
import ReChartsComponent from './ReChartsComponent'
-import styles from './index.less'
+import styles from './page.less'
const RadioGroup = Radio.Group
diff --git a/src/routes/chart/Recharts/index.less b/src/pages/chart/Recharts/page.less
similarity index 100%
rename from src/routes/chart/Recharts/index.less
rename to src/pages/chart/Recharts/page.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/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/chart/highCharts/index.js b/src/pages/chart/highCharts/page.js
similarity index 96%
rename from src/routes/chart/highCharts/index.js
rename to src/pages/chart/highCharts/page.js
index 7941c2f2..06ea85a4 100644
--- a/src/routes/chart/highCharts/index.js
+++ b/src/pages/chart/highCharts/page.js
@@ -2,7 +2,7 @@ import React from 'react'
import { Radio } from 'antd'
import { Page } from 'components'
import HighChartsComponent from './HighChartsComponent'
-import styles from './index.less'
+import styles from './page.less'
const RadioGroup = Radio.Group
diff --git a/src/routes/chart/highCharts/index.less b/src/pages/chart/highCharts/page.less
similarity index 100%
rename from src/routes/chart/highCharts/index.less
rename to src/pages/chart/highCharts/page.less
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 798377aa..26ef4fe7 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/entry.ejs b/src/pages/document.ejs
similarity index 71%
rename from src/entry.ejs
rename to src/pages/document.ejs
index 2e149a91..de5e2433 100644
--- a/src/entry.ejs
+++ b/src/pages/document.ejs
@@ -1,25 +1,19 @@
-<% htmlWebpackPlugin.options.headScripts = htmlWebpackPlugin.options.headScripts || [] %>
-
-
-
-
-
-
-
-
-
antd admin
-
- <% for (item of htmlWebpackPlugin.options.headScripts) { %>
-
- <% } %>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
antd admin
+
+
+
+
+
+
+
+
diff --git a/src/pages/index.js b/src/pages/index.js
new file mode 100644
index 00000000..30f08c20
--- /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 a40576f9..43ff59d9 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 87e39ed8..21e09c09 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 797dcf53..c6929b98 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 99%
rename from src/routes/user/Filter.js
rename to src/pages/user/components/Filter.js
index 3a02ff90..9b82badb 100644
--- a/src/routes/user/Filter.js
+++ b/src/pages/user/components/Filter.js
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import moment from 'moment'
import { FilterItem } from 'components'
import { Form, Button, Row, Col, DatePicker, Input, Cascader, Switch } from 'antd'
-import city from '../../utils/city'
+import city from 'utils/city'
const { Search } = Input
const { RangePicker } = DatePicker
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 99%
rename from src/routes/user/Modal.js
rename to src/pages/user/components/Modal.js
index 47141a6c..ab760a24 100644
--- a/src/routes/user/Modal.js
+++ b/src/pages/user/components/Modal.js
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Form, Input, InputNumber, Radio, Modal, Cascader } from 'antd'
-import city from '../../utils/city'
+import city from 'utils/city'
const FormItem = Form.Item
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 088c29d3..814eea65 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 bcf84686..206752f5 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 00000000..5661d64c
--- /dev/null
+++ b/src/plugins/onError.js
@@ -0,0 +1,8 @@
+import { message } from 'antd'
+
+export default {
+ onError (e) {
+ e.preventDefault()
+ message.error(e.message)
+ },
+}
diff --git a/src/router.js b/src/router.js
deleted file mode 100644
index 1a8b9206..00000000
--- a/src/router.js
+++ /dev/null
@@ -1,101 +0,0 @@
-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',
- models: () => [import('./models/dashboard')],
- component: () => import('./routes/dashboard/'),
- }, {
- path: '/user',
- models: () => [import('./models/user')],
- component: () => import('./routes/user/'),
- }, {
- path: '/user/:id',
- models: () => [import('./models/user/detail')],
- component: () => import('./routes/user/detail/'),
- }, {
- path: '/login',
- models: () => [import('./models/login')],
- component: () => import('./routes/login/'),
- }, {
- path: '/request',
- component: () => import('./routes/request/'),
- }, {
- path: '/UIElement/iconfont',
- component: () => import('./routes/UIElement/iconfont/'),
- }, {
- path: '/UIElement/search',
- component: () => import('./routes/UIElement/search/'),
- }, {
- path: '/UIElement/dropOption',
- component: () => import('./routes/UIElement/dropOption/'),
- }, {
- path: '/UIElement/layer',
- component: () => import('./routes/UIElement/layer/'),
- }, {
- path: '/UIElement/dataTable',
- component: () => import('./routes/UIElement/dataTable/'),
- }, {
- path: '/UIElement/editor',
- component: () => import('./routes/UIElement/editor/'),
- }, {
- path: '/chart/ECharts',
- component: () => import('./routes/chart/ECharts/'),
- }, {
- path: '/chart/highCharts',
- component: () => import('./routes/chart/highCharts/'),
- }, {
- path: '/chart/Recharts',
- component: () => import('./routes/chart/Recharts/'),
- }, {
- path: '/post',
- models: () => [import('./models/post')],
- component: () => import('./routes/post/'),
- },
- ]
-
- return (
-
-
-
-
- ()} />
- {
- routes.map(({ path, ...dynamics }, key) => (
-
- ))
- }
-
-
-
-
-
- )
-}
-
-Routers.propTypes = {
- history: PropTypes.object,
- app: PropTypes.object,
-}
-
-export default Routers
diff --git a/src/tests/models/example-test.js b/src/tests/models/example-test.js
deleted file mode 100644
index 8b137891..00000000
--- a/src/tests/models/example-test.js
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/themes/index.less b/src/themes/index.less
index 74582f7a..a6f29a42 100644
--- a/src/themes/index.less
+++ b/src/themes/index.less
@@ -1,135 +1,135 @@
-@import "~themes/vars";
-
-body {
- height: 100%;
- overflow-y: hidden;
- background-color: #f8f8f8;
-}
-
-::-webkit-scrollbar-thumb {
- background-color: #e6e6e6;
-}
-
-::-webkit-scrollbar {
- width: 8px;
- height: 8px;
-}
-
-:global {
- .ant-breadcrumb {
- & > span {
- &:last-child {
- color: #999;
- font-weight: normal;
- }
- }
- }
-
- .ant-breadcrumb-link {
- .anticon + span {
- margin-left: 4px;
- }
- }
-
- .ant-table {
- .ant-table-thead > tr > th {
- text-align: center;
- }
-
- .ant-table-tbody > tr > td {
- text-align: center;
- }
-
- &.ant-table-small {
- .ant-table-thead > tr > th {
- background: #f7f7f7;
- }
-
- .ant-table-body > table {
- padding: 0;
- }
- }
- }
-
- .ant-table-pagination {
- float: none!important;
- display: table;
- margin: 16px auto !important;
- }
-
- .ant-popover-inner {
- border: none;
- border-radius: 0;
- box-shadow: 0 0 20px rgba(100, 100, 100, 0.2);
- }
-
- .vertical-center-modal {
- display: flex;
- align-items: center;
- justify-content: center;
-
- .ant-modal {
- top: 0;
-
- .ant-modal-body {
- max-height: 80vh;
- overflow-y: auto;
- }
- }
- }
-
- .ant-form-item-control {
- vertical-align: middle;
- }
-
- .ant-modal-mask {
- background-color: rgba(55, 55, 55, 0.2);
- }
-
- .ant-modal-content {
- box-shadow: none;
- }
-
- .ant-select-dropdown-menu-item {
- padding: 12px 16px !important;
- }
-
- .margin-right {
- margin-right: 16px;
- }
-
- a:focus {
- text-decoration: none;
- }
-}
-@media (min-width: 1600px) {
- :global {
- .ant-col-xl-48 {
- width: 20%;
- }
-
- .ant-col-xl-96 {
- width: 40%;
- }
- }
-}
-@media (max-width: 767px) {
- :global {
- .ant-pagination-item,
- .ant-pagination-next,
- .ant-pagination-options,
- .ant-pagination-prev {
- margin-bottom: 8px;
- }
-
- .ant-card {
- .ant-card-head {
- padding: 0 12px;
- }
-
- .ant-card-body {
- padding: 12px;
- }
- }
- }
-}
+@import "~themes/vars.less";
+
+body {
+ height: 100%;
+ overflow-y: hidden;
+ background-color: #f8f8f8;
+}
+
+::-webkit-scrollbar-thumb {
+ background-color: #e6e6e6;
+}
+
+::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
+}
+
+:global {
+ .ant-breadcrumb {
+ & > span {
+ &:last-child {
+ color: #999;
+ font-weight: normal;
+ }
+ }
+ }
+
+ .ant-breadcrumb-link {
+ .anticon + span {
+ margin-left: 4px;
+ }
+ }
+
+ .ant-table {
+ .ant-table-thead > tr > th {
+ text-align: center;
+ }
+
+ .ant-table-tbody > tr > td {
+ text-align: center;
+ }
+
+ &.ant-table-small {
+ .ant-table-thead > tr > th {
+ background: #f7f7f7;
+ }
+
+ .ant-table-body > table {
+ padding: 0;
+ }
+ }
+ }
+
+ .ant-table-pagination {
+ float: none!important;
+ display: table;
+ margin: 16px auto !important;
+ }
+
+ .ant-popover-inner {
+ border: none;
+ border-radius: 0;
+ box-shadow: 0 0 20px rgba(100, 100, 100, 0.2);
+ }
+
+ .vertical-center-modal {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ .ant-modal {
+ top: 0;
+
+ .ant-modal-body {
+ max-height: 80vh;
+ overflow-y: auto;
+ }
+ }
+ }
+
+ .ant-form-item-control {
+ vertical-align: middle;
+ }
+
+ .ant-modal-mask {
+ background-color: rgba(55, 55, 55, 0.2);
+ }
+
+ .ant-modal-content {
+ box-shadow: none;
+ }
+
+ .ant-select-dropdown-menu-item {
+ padding: 12px 16px !important;
+ }
+
+ .margin-right {
+ margin-right: 16px;
+ }
+
+ a:focus {
+ text-decoration: none;
+ }
+}
+@media (min-width: 1600px) {
+ :global {
+ .ant-col-xl-48 {
+ width: 20%;
+ }
+
+ .ant-col-xl-96 {
+ width: 40%;
+ }
+ }
+}
+@media (max-width: 767px) {
+ :global {
+ .ant-pagination-item,
+ .ant-pagination-next,
+ .ant-pagination-options,
+ .ant-pagination-prev {
+ margin-bottom: 8px;
+ }
+
+ .ant-card {
+ .ant-card-head {
+ padding: 0 12px;
+ }
+
+ .ant-card-body {
+ padding: 12px;
+ }
+ }
+ }
+}
diff --git a/src/themes/vars.less b/src/themes/vars.less
index 69f340ed..8b052a40 100644
--- a/src/themes/vars.less
+++ b/src/themes/vars.less
@@ -1,2 +1,2 @@
-@import "~themes/default";
-@import "~themes/mixin";
+@import "~themes/default.less";
+@import "~themes/mixin.less";
diff --git a/src/utils/index.js b/src/utils/index.js
index dad7e5f5..ac4e4cde 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,9 +1,10 @@
/* global window */
-import classnames from 'classnames'
import lodash from 'lodash'
-import config from './config'
-import request from './request'
-import { color } from './theme'
+
+export classnames from 'classnames'
+export config from './config'
+export request from './request'
+export { color } from './theme'
// 连字符转驼峰
String.prototype.hyphenToHump = function () {
@@ -42,11 +43,10 @@ Date.prototype.format = function (format) {
/**
- * @param {String}
+ * @param name {String}
* @return {String}
*/
-
-const queryURL = (name) => {
+export function queryURL (name) {
let reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i')
let r = window.location.search.substr(1).match(reg)
if (r != null) return decodeURI(r[2])
@@ -60,7 +60,7 @@ const queryURL = (name) => {
* @param {String} keyAlias
* @return {Array}
*/
-const queryArray = (array, key, keyAlias = 'key') => {
+export function queryArray (array, key, keyAlias = 'key') {
if (!(array instanceof Array)) {
return null
}
@@ -79,7 +79,7 @@ const queryArray = (array, key, keyAlias = 'key') => {
* @param {String} children
* @return {Array}
*/
-const arrayToTree = (array, id = 'id', pid = 'pid', children = 'children') => {
+export function arrayToTree (array, id = 'id', pid = 'pid', children = 'children') {
let data = lodash.cloneDeep(array)
let result = []
let hash = {}
@@ -98,13 +98,3 @@ const arrayToTree = (array, id = 'id', pid = 'pid', children = 'children') => {
})
return result
}
-
-module.exports = {
- config,
- request,
- color,
- classnames,
- queryURL,
- queryArray,
- arrayToTree,
-}
diff --git a/src/models/common.js b/src/utils/model.js
similarity index 86%
rename from src/models/common.js
rename to src/utils/model.js
index bcd9e46d..79997277 100644
--- a/src/models/common.js
+++ b/src/utils/model.js
@@ -1,6 +1,6 @@
import modelExtend from 'dva-model-extend'
-const model = {
+export const model = {
reducers: {
updateState (state, { payload }) {
return {
@@ -11,7 +11,7 @@ const model = {
},
}
-const pageModel = modelExtend(model, {
+export const pageModel = modelExtend(model, {
state: {
list: [],
@@ -40,9 +40,3 @@ const pageModel = modelExtend(model, {
},
})
-
-
-module.exports = {
- model,
- pageModel,
-}
diff --git a/version.js b/version.js
deleted file mode 100644
index f4635755..00000000
--- a/version.js
+++ /dev/null
@@ -1,82 +0,0 @@
-const fs = require('fs')
-const path = require('path')
-const beautify = require('js-beautify').js_beautify
-const config = require('./package.json')
-
-const dist = path.join(`${__dirname}/dist`)
-const maxVersion = 5
-
-const writeVersion = () => new Promise((resolve, reject) => {
- const { version } = config
- const numbers = version.split('.')
- numbers[2] = Number(numbers[2]) + 1
- config.version = numbers.join('.')
-
- fs.writeFile(path.join(__dirname, 'package.json'), beautify(JSON.stringify(config), { indent_size: 2 }), (err) => {
- if (err) {
- reject()
- }
- resolve()
- console.log(`version: ${config.version}`)
- })
-})
-
-const removeFolder = (folderPath) => {
- let files = []
- if (fs.existsSync(folderPath)) {
- files = fs.readdirSync(folderPath)
- files.forEach((file) => {
- const curPath = `${folderPath}/${file}`
- if (fs.statSync(curPath).isDirectory()) {
- removeFolder(curPath)
- } else {
- fs.unlinkSync(curPath)
- }
- })
- fs.rmdirSync(folderPath)
- }
-}
-
-const start = async () => {
- const files = fs.readdirSync(dist)
- const promises = files.map(file => new Promise((resolve, reject) => {
- fs.stat(`${dist}/${file}`, (err, stats) => {
- if (err) {
- reject()
- } else {
- resolve(!stats.isFile()
- ? file
- : null)
- }
- })
- }))
-
- const result = await Promise.all(promises)
-
- const folders = result.filter((item) => {
- if (item) {
- return item.split('.').length === 3
- }
- return false
- }).sort((a, b) => {
- const an = a.split('.').map(_ => Number(_))
- const bn = b.split('.').map(_ => Number(_))
- if (an[0] === bn[0]) {
- if (an[1] === bn[1]) {
- return an[2] < bn[2]
- }
- return an[1] < bn[1]
- }
- return an[0] < bn[0]
- }).filter((item, index) => {
- return index > (maxVersion - 1)
- })
-
- for (const item of folders) {
- await removeFolder(`${dist}/${item}`)
- }
-
- await writeVersion()
-}
-
-start()
diff --git a/webpack.config.js b/webpack.config.js
index 2abc96f5..ac4f22db 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,59 +1,13 @@
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const CopyWebpackPlugin = require('copy-webpack-plugin')
-const webpack = require('webpack')
-module.exports = (webpackConfig, env) => {
- const production = env === 'production'
- // FilenameHash
- webpackConfig.output.chunkFilename = '[name].[chunkhash].js'
-
- if (production) {
- if (webpackConfig.module) {
- // ClassnameHash
- webpackConfig.module.rules.map((item) => {
- if (String(item.test) === '/\\.less$/' || String(item.test) === '/\\.css/') {
- item.use.filter(iitem => iitem.loader === 'css')[0].options.localIdentName = '[hash:base64:5]'
- }
- return item
- })
- }
- webpackConfig.plugins.push(
- new webpack.LoaderOptionsPlugin({
- minimize: true,
- debug: false,
- })
- )
- }
-
- webpackConfig.plugins = webpackConfig.plugins.concat([
- new CopyWebpackPlugin([
+export default function (webpackConfig) {
+ webpackConfig.module.rules.push({
+ test: /\.svg$/i,
+ use: [
{
- from: 'src/public',
- to: production ? '../' : webpackConfig.output.outputPath,
+ loader: require.resolve('svg-sprite-loader'),
},
- ]),
- new HtmlWebpackPlugin({
- template: `${__dirname}/src/entry.ejs`,
- filename: production ? '../index.html' : 'index.html',
- minify: production ? {
- collapseWhitespace: true,
- } : null,
- hash: true,
- headScripts: production ? null : ['/roadhog.dll.js'],
- }),
- ])
-
- // Alias
- webpackConfig.resolve.alias = {
- components: `${__dirname}/src/components`,
- utils: `${__dirname}/src/utils`,
- config: `${__dirname}/src/utils/config`,
- enums: `${__dirname}/src/utils/enums`,
- services: `${__dirname}/src/services`,
- models: `${__dirname}/src/models`,
- routes: `${__dirname}/src/routes`,
- themes: `${__dirname}/src/themes`,
- }
+ ],
+ })
return webpackConfig
-}
+};