luyanan 6 years ago
parent
commit
7341fe0785
4 changed files with 79 additions and 25 deletions
  1. 1 1
      src/permission.js
  2. 76 22
      src/router/index.js
  3. 1 1
      src/views/dashboard/admin/index.vue
  4. 1 1
      src/views/dashboard/other/index.vue

+ 1 - 1
src/permission.js

@ -20,7 +20,7 @@ router.beforeEach((to, from, next) => {
20 20
        NProgress.done()
21 21
        console.log(1111)
22 22
      } else {
23
        if (store.getters.roles.indexOf('1') >= 0) {
23
        if (store.getters.roles.length === 0) {
24 24
          console.log(2222)
25 25
          store.dispatch('GetUserInfo').then(res => { // 拉取用户信息
26 26
            const dataS = res.data

+ 76 - 22
src/router/index.js

@ -51,9 +51,8 @@ export const constantRouterMap = [
51 51
  },
52 52
53 53
  {
54
    path: '/bridgesConsole',
54
    path: '',
55 55
    component: LayoutC,
56
    redirect: '/bridgesConsole/bridgeDetail',
57 56
    name: 'bridgesConsole',
58 57
    meta: {
59 58
      noCache: true
@ -66,25 +65,10 @@ export const constantRouterMap = [
66 65
        meta: { noCache: true }
67 66
      }
68 67
    ]
69
  }
70
]
71
72
// 实例化vue的时候只挂载constantRouter
73
74
export default new Router({
75
  // mode: 'history', //后端支持可开
76
  scrollBehavior: () => ({ y: 0 }),
77
  routes: constantRouterMap
78
})
79
80
// 异步挂载的路由
81
// 动态需要根据权限加载的路由表
82
83
export const asyncRouterMap = [
68
  },
84 69
  {
85
    path: '/peoplesManage',
70
    path: '',
86 71
    component: Layout,
87
    redirect: '/peoplesManage/infoManage',
88 72
    name: 'peoplesManage',
89 73
    meta: {
90 74
      title: '用户系统管理',
@ -103,9 +87,8 @@ export const asyncRouterMap = [
103 87
    ]
104 88
  },
105 89
  {
106
    path: '/baseInfoManage',
90
    path: '',
107 91
    component: Layout,
108
    redirect: '/baseInfoManage/bridgesInfo',
109 92
    name: 'BaseInfoManage',
110 93
    meta: {
111 94
      title: '基础信息管理',
@ -139,7 +122,78 @@ export const asyncRouterMap = [
139 122
        meta: { title: '传感器配置', noCache: true }
140 123
      }
141 124
    ]
142
  },
125
  }
126
]
127
128
// 实例化vue的时候只挂载constantRouter
129
130
export default new Router({
131
  // mode: 'history', //后端支持可开
132
  scrollBehavior: () => ({ y: 0 }),
133
  routes: constantRouterMap
134
})
135
136
// 异步挂载的路由
137
// 动态需要根据权限加载的路由表
138
139
export const asyncRouterMap = [
140
  // {
141
  //   path: '',
142
  //   component: Layout,
143
  //   name: 'peoplesManage',
144
  //   meta: {
145
  //     title: '用户系统管理',
146
  //     icon: 'peoples',
147
  //     roles: ['1'],
148
  //     noCache: true
149
  //   },
150
  //   alwaysShow: true,
151
  //   children: [
152
  //     {
153
  //       path: 'infoManage',
154
  //       name: 'infoManage',
155
  //       component: () => import('@/views/peoplesManage/infoManage/index'),
156
  //       meta: { title: '用户信息管理', noCache: true }
157
  //     }
158
  //   ]
159
  // },
160
  // {
161
  //   path: '',
162
  //   component: Layout,
163
  //   name: 'BaseInfoManage',
164
  //   meta: {
165
  //     title: '基础信息管理',
166
  //     icon: 'list',
167
  //     roles: ['1'],
168
  //     noCache: true
169
  //   },
170
  //   children: [
171
  //     {
172
  //       path: 'bridgesInfo',
173
  //       name: 'BridgesInfo',
174
  //       component: () => import('@/views/baseInfoManage/bridgesInfo/index'),
175
  //       meta: { title: '桥梁信息管理', noCache: true }
176
  //     },
177
  //     {
178
  //       path: 'serversConfig',
179
  //       name: 'ServersConfig',
180
  //       component: () => import('@/views/baseInfoManage/serversConfig/index'),
181
  //       meta: { title: '采集服务器配置', noCache: true }
182
  //     },
183
  //     {
184
  //       path: 'boxesConfig',
185
  //       name: 'BoxesConfig',
186
  //       component: () => import('@/views/baseInfoManage/boxesConfig/index'),
187
  //       meta: { title: '采集盒配置', noCache: true }
188
  //     },
189
  //     {
190
  //       path: 'sensorsConfig',
191
  //       name: 'SensorsConfig',
192
  //       component: () => import('@/views/baseInfoManage/sensorsConfig/index'),
193
  //       meta: { title: '传感器配置', noCache: true }
194
  //     }
195
  //   ]
196
  // },
143 197
144 198
  { path: '*', redirect: '/404', hidden: true }
145 199
]

+ 1 - 1
src/views/dashboard/admin/index.vue

@ -13,7 +13,7 @@ export default {
13 13
  },
14 14
  methods: {
15 15
    toPath() {
16
      this.$router.push({ path: '/peoplesManage/infoManage' })
16
      this.$router.push({ path: '/infoManage' })
17 17
    }
18 18
  }
19 19
}

+ 1 - 1
src/views/dashboard/other/index.vue

@ -65,7 +65,7 @@ export default {
65 65
    },
66 66
    goToDashboardC(id) {
67 67
      this.$router.push({
68
        path: '/bridgesConsole/bridgeDetail',
68
        path: '/bridgesConsole',
69 69
        query: { bridgeId: id }
70 70
      })
71 71
    },