-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrouter.js
More file actions
99 lines (94 loc) · 3.16 KB
/
Copy pathrouter.js
File metadata and controls
99 lines (94 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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'
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: '/campaign',
models: () => [import('./models/campaign')],
component: () => import('./routes/campaign/'),
}, {
path: '/campaign-report',
models: () => [import('./models/campaign-report')],
component: () => import('./routes/campaign-report/'),
}, {
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/lineChart',
component: () => import('./routes/chart/lineChart/'),
}, {
path: '/chart/barChart',
component: () => import('./routes/chart/barChart/'),
}, {
path: '/chart/areaChart',
component: () => import('./routes/chart/areaChart/'),
}]
return (
<ConnectedRouter history={history}>
<App>
<Switch>
<Route exact path="/" render={() => (<Redirect to="/campaign" />)} />
{
routes.map(({ path, ...dynamics }, key) => (
<Route key={key}
exact
path={path}
component={dynamic({
app,
...dynamics,
})}
/>
))
}
<Route component={error} />
</Switch>
</App>
</ConnectedRouter>
)
}
Routers.propTypes = {
history: PropTypes.object,
app: PropTypes.object,
}
export default Routers