Blame view

src/router/index.js 5.14 KB
赵千 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
/* Layout */
import Layout from '@/layout'

/* Router Modules */
// import componentsRouter from './modules/components'

export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
任超 committed
24 25 26 27
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
任超 committed
28 29 30 31 32 33 34 35
  { path: '*', redirect: '/404', hidden: true }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
任超 committed
36
  {
赵千 committed
37 38 39
    path: '/',
    component: Layout,
    redirect: '/home',
任超 committed
40
    meta: { title: '首页' },
赵千 committed
41 42 43 44 45
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index'),
        name: 'Dashboard',
任超 committed
46
        meta: { title: '工作台', icon: 'workbench', affix: true }
赵千 committed
47 48 49 50
      }
    ]
  },
  {
51
    path: '/ywbl',
赵千 committed
52 53 54
    id: '3',
    parentId: null,
    component: Layout,
任超 committed
55
    meta: { title: '业务办理', icon: 'ywbl' },
56
    redirect: '/ywbl/ywsq/ywsq',
赵千 committed
57
    alwaysShow: true,
58
    name: 'ywbl',
赵千 committed
59 60
    children: [
      {
61
        path: 'ywsq',
赵千 committed
62 63
        id: '4',
        parentId: '3',
64
        component: () => import('@/views/ywbl/ywsq/ywsq.vue'),
65
        name: 'ywsq',
任超 committed
66
        meta: { title: '业务申请' }
任超 committed
67 68
      },
      {
69
        path: 'dbx',
任超 committed
70 71
        id: '5',
        parentId: '3',
72
        component: () => import('@/views/ywbl/dbx/dbx.vue'),
73
        name: 'dbx',
任超 committed
74 75 76
        meta: { title: '待办箱' }
      },
      {
77
        path: 'ybx',
任超 committed
78 79
        id: '6',
        parentId: '3',
80
        component: () => import('@/views/ywbl/ybx/ybx.vue'),
81
        name: 'ybx',
任超 committed
82 83 84 85 86
        meta: { title: '已办箱' }
      }
    ]
  },
  {
87
    path: '/sqcx',
任超 committed
88 89 90
    id: '9',
    parentId: null,
    component: Layout,
任超 committed
91
    meta: { title: '申请查询', icon: 'sqcx' },
92
    redirect: '/sqcx/jtfc',
任超 committed
93
    alwaysShow: true,
94
    name: 'sqcx',
任超 committed
95 96
    children: [
      {
97
        path: 'jtfc',
任超 committed
98 99
        id: '10',
        parentId: '9',
100
        component: () => import('@/views/sqcx/jtfc/jtfc.vue'),
101
        name: 'jtfc',
任超 committed
102 103 104
        meta: { title: '家庭房产' }
      },
      {
105
        path: 'dydjb',
任超 committed
106 107
        id: '12',
        parentId: '9',
108
        component: () => import('@/views/sqcx/dydjb/dydjb.vue'),
109
        name: 'dydjb',
任超 committed
110 111 112
        meta: { title: '打印登记薄' }
      },
      {
113
        path: 'cxjl',
任超 committed
114 115
        id: '11',
        parentId: '9',
116
        component: () => import('@/views/sqcx/cxjl/cxjl.vue'),
117
        name: 'cxjl',
任超 committed
118 119 120 121 122
        meta: { title: '查询记录' }
      }
    ]
  },
  {
123
    path: '/zhcx',
任超 committed
124 125 126
    id: '13',
    parentId: null,
    component: Layout,
任超 committed
127
    meta: { title: '综合查询', icon: 'zhcx' },
128
    redirect: '/zhcx/jdcx',
任超 committed
129
    alwaysShow: true,
130
    name: 'zhcx',
任超 committed
131 132
    children: [
      {
133
        path: 'jdcx',
任超 committed
134 135
        id: '14',
        parentId: '13',
136
        component: () => import('@/views/zhcx/jdcx/jdcx.vue'),
137
        name: 'jdcx',
任超 committed
138 139 140
        meta: { title: '进度查询' }
      },
      {
141
        path: 'djbcx',
任超 committed
142 143
        id: '15',
        parentId: '13',
144
        component: () => import('@/views/zhcx/djbcx/djbcx.vue'),
145
        name: 'djbcx',
任超 committed
146 147 148
        meta: { title: '登记簿查询' }
      },
      {
149
        path: 'lpcx',
任超 committed
150 151
        id: '16',
        parentId: '13',
152
        component: () => import('@/views/zhcx/lpcx/lpcx.vue'),
153
        name: 'lpcx',
任超 committed
154 155 156 157 158
        meta: { title: '楼盘查询' }
      }
    ]
  },
  {
159
    path: '/zsgl',
任超 committed
160 161 162
    id: '17',
    parentId: null,
    component: Layout,
任超 committed
163
    meta: { title: '证书管理', icon: 'zsgl' },
164
    redirect: '/zsgl/zsrk',
任超 committed
165
    alwaysShow: true,
166
    name: 'zsgl',
任超 committed
167 168
    children: [
      {
169
        path: 'zsrk',
任超 committed
170 171
        id: '18',
        parentId: '17',
172
        component: () => import('@/views/zsgl/zsrk/zsrk.vue'),
173
        name: 'zsrk',
任超 committed
174 175 176
        meta: { title: '证书入库' }
      },
      {
177
        path: 'zsff',
任超 committed
178 179
        id: '19',
        parentId: '17',
180
        component: () => import('@/views/zsgl/zsff/zsff.vue'),
181
        name: 'zsff',
任超 committed
182 183 184
        meta: { title: '证书分发' }
      },
      {
185
        path: 'zssyjl',
任超 committed
186 187
        id: '20',
        parentId: '17',
188
        component: () => import('@/views/zsgl/zssyjl/zssyjl.vue'),
189
        name: 'zssyjl',
任超 committed
190 191 192 193 194 195 196 197 198
        meta: { title: '证书使用记录' }
      }
    ]
  },
  {
    path: '/system',
    id: '21',
    parentId: null,
    component: Layout,
任超 committed
199
    meta: { title: '系统管理', icon: 'system' },
任超 committed
200 201 202 203 204 205 206 207 208 209 210
    redirect: '/system/dictionaries',
    alwaysShow: true,
    name: 'system',
    children: [
      {
        path: 'dictionaries',
        id: '22',
        parentId: '21',
        component: () => import('@/views/system/dictionaries.vue'),
        name: 'dictionaries',
        meta: { title: '字典管理' }
赵千 committed
211 212 213 214 215 216 217 218
      }
    ]
  }
]

const createRouter = () =>
  new Router({
    scrollBehavior: () => ({ y: 0 }),
任超 committed
219
    routes: [...constantRoutes, ...asyncRoutes]
赵千 committed
220 221 222 223 224 225 226 227 228 229
  })

const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter () {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router