index.js
3.15 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import Vue from 'vue'
import Router from 'vue-router'
import Login from './../pages/Login.vue'
import NotFound from './../pages/404.vue'
import Home from './../pages/Home.vue'
import Main from './../pages/Main.vue'
import Table from './../pages/nav1/Table.vue'
import Form from './../pages/nav1/Form.vue'
import user from './../pages/nav1/user.vue'
// import Page4 from './../pages/nav2/Page4.vue'
// import Page5 from './../pages/nav2/Page5.vue'
// import Page6 from './../pages/nav3/Page6.vue'
// import Echart from './../pages/nav3/Page6.vue'
import echarts from './../pages/charts/echarts.vue'
import Apps from './../pages/apps/Apps.vue'
import Report from './../pages/report/Report.vue'
import CheckCode from './../pages/checkcode/CheckCode.vue'
import {
COOKIES_EX
} from "./../global/const-data";
Vue.use(Router)
const router = new Router({
routes: [{
path: '/login',
component: Login,
name: '',
hidden: true
},
{
path: '/404',
component: NotFound,
name: '',
hidden: true
},
{
path: '/',
component: Home,
name: '',
iconCls: 'fa fa-address-card',
leaf: true, //只有一个节点
children: [{
path: '/apps',
component: Apps,
name: '应用中心'
}]
},
{
path: '/',
component: Home,
name: '',
iconCls: 'fa fa-address-card',
leaf: true, //只有一个节点
hidden: true,
children: [{
path: '/report',
component: Report,
name: '报表'
}]
},
{
path: '/',
component: Home,
name: '',
iconCls: 'fa fa-address-card',
leaf: true, //只有一个节点
hidden: true,
children: [{
path: '/checkcode',
component: CheckCode,
name: '查码'
}]
},
//{ path: '/main', component: Main },
// {
// path: '/',
// component: Home,
// name: '导航一',
// hidden: true,
// iconCls: 'el-icon-message', //图标样式class
// children: [{
// path: '/main',
// component: Main,
// name: '主页',
// hidden: true
// },
// {
// path: '/table',
// component: Table,
// name: 'Table'
// },
// {
// path: '/form',
// component: Form,
// name: 'Form'
// },
// {
// path: '/user',
// component: user,
// name: '列表'
// },
// ]
// },
{
path: '/',
component: Home,
name: 'Charts',
iconCls: 'fa fa-bar-chart',
hidden: true,
children: [{
path: '/echarts',
component: echarts,
name: 'echarts'
}]
},
{
path: '*',
hidden: true,
redirect: {
path: '/404'
}
}
]
})
router.beforeEach((to, from, next) => {
//NProgress.start();
if (to.path == '/login') {
sessionStorage.removeItem(COOKIES_EX + 'sid');
}
let user = sessionStorage.getItem(COOKIES_EX + 'sid');
if (!user && to.path != '/login') {
next({
path: '/login'
})
} else {
next()
}
})
export default router;