@@ -3,9 +3,15 @@ import { Router, Route, IndexRoute, hashHistory/* , Redirect */ } from 'react-ro
33import { isLogin } from '@configs/common'
44import { set } from '@config'
55
6- import * as base from '@pages/base' // 基础
7- import * as sysSet from '@pages/setCenter' // 设置中心-系统设置
6+ // import * as base from '@pages/base' // 基础
7+ // import * as sysSet from '@pages/setCenter' // 设置中心-系统设置
88// import * as menu from '@pages/menu' // 菜单
9+ // 图表
10+ const wrap = ( location , cb ) => {
11+ require . ensure ( [ ] , ( require ) => {
12+ cb ( null , require ( '../pages/base/app' ) . default )
13+ } , 'wrap' )
14+ }
915
1016// 图表
1117const echarts = ( location , cb ) => {
@@ -28,23 +34,72 @@ const editor = (location, cb) => {
2834 } , 'editor' )
2935}
3036
37+ // 示例页面
38+ const example = ( location , cb ) => {
39+ require . ensure ( [ ] , ( require ) => {
40+ cb ( null , require ( '../pages/base/example' ) . default )
41+ } , 'example' )
42+ }
43+
44+ // 用户管理
45+ const login = ( location , cb ) => {
46+ require . ensure ( [ ] , ( require ) => {
47+ cb ( null , require ( '../pages/base/login' ) . default )
48+ } , 'login' )
49+ }
50+
51+ // welcome
52+ const welcome = ( location , cb ) => {
53+ require . ensure ( [ ] , ( require ) => {
54+ cb ( null , require ( '../pages/base/welcome' ) . default )
55+ } , 'welcome' )
56+ }
57+
58+ // 用户管理
59+ const userManage = ( location , cb ) => {
60+ require . ensure ( [ ] , ( require ) => {
61+ cb ( null , require ( '../pages/setCenter/sys/userManage' ) . default )
62+ } , 'userManage' )
63+ }
64+
65+ // 角色管理
66+ const roleManage = ( location , cb ) => {
67+ require . ensure ( [ ] , ( require ) => {
68+ cb ( null , require ( '../pages/setCenter/sys/roleManage' ) . default )
69+ } , 'roleManage' )
70+ }
71+
72+ // 模块管理
73+ const moduleManage = ( location , cb ) => {
74+ require . ensure ( [ ] , ( require ) => {
75+ cb ( null , require ( '../pages/setCenter/sys/moduleManage' ) . default )
76+ } , 'moduleManage' )
77+ }
78+
79+ // 404
80+ const notfound = ( location , cb ) => {
81+ require . ensure ( [ ] , ( require ) => {
82+ cb ( null , require ( '../pages/base/notfound' ) . default )
83+ } , 'notfound' )
84+ }
85+
3186export default ( ) => (
3287 < Router history = { hashHistory } >
33- < Route path = "/" component = { base . app } onEnter = { isLogin } >
34- < IndexRoute component = { base . welcome } />
35- < Route path = "/desk$/index" component = { base . example } />
88+ < Route path = "/" getComponent = { wrap } onEnter = { isLogin } >
89+ < IndexRoute getComponent = { welcome } />
90+ < Route path = "/desk$/index" getComponent = { example } />
3691 { /** *菜单 开始 */ }
3792 < Route path = "/echarts" getComponent = { echarts } />
3893 < Route path = "/editor" getComponent = { editor } />
3994 < Route path = "/chat" getComponent = { chat } />
4095 { /** *菜单 结束 */ }
4196 { /** *系统设置 开始 */ }
42- < Route path = { `/${ set } /userManage` } component = { sysSet . userManage } />
43- < Route path = { `/${ set } /roleManage` } component = { sysSet . roleManage } />
44- < Route path = { `/${ set } /moduleManage` } component = { sysSet . moduleManage } />
97+ < Route path = { `/${ set } /userManage` } getComponent = { userManage } />
98+ < Route path = { `/${ set } /roleManage` } getComponent = { roleManage } />
99+ < Route path = { `/${ set } /moduleManage` } getComponent = { moduleManage } />
45100 { /** *系统设置 结束 */ }
46101 </ Route >
47- < Route path = "/login" component = { base . login } />
48- < Route path = "*" component = { base . notfound } />
102+ < Route path = "/login" getComponent = { login } />
103+ < Route path = "*" getComponent = { notfound } />
49104 </ Router >
50105)
0 commit comments