2017-08-22 07:43:34 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
import Router from 'vue-router'
|
2017-04-18 07:09:13 +00:00
|
|
|
|
2017-08-22 07:43:34 +00:00
|
|
|
Vue.use(Router)
|
2017-04-18 07:09:13 +00:00
|
|
|
|
2017-11-17 06:57:39 +00:00
|
|
|
/* Layout */
|
2018-05-31 08:53:08 +00:00
|
|
|
import Layout from '@/views/layout/Layout'
|
2017-05-17 08:26:33 +00:00
|
|
|
|
2019-09-14 22:17:24 +00:00
|
|
|
const disabledFeatures = process.env.DISABLED_FEATURES || []
|
|
|
|
const settingsDisabled = disabledFeatures.includes('settings')
|
|
|
|
const settings = {
|
|
|
|
path: '/settings',
|
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/settings/index'),
|
|
|
|
name: 'Settings',
|
|
|
|
meta: { title: 'settings', icon: 'settings', noCache: true }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
const reportsDisabled = disabledFeatures.includes('reports')
|
|
|
|
const reports = {
|
|
|
|
path: '/reports',
|
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/reports/index'),
|
|
|
|
name: 'Reports',
|
|
|
|
meta: { title: 'reports', icon: 'documentation', noCache: true }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
export const constantRouterMap = [
|
2018-08-29 07:24:47 +00:00
|
|
|
{
|
|
|
|
path: '/redirect',
|
|
|
|
component: Layout,
|
|
|
|
hidden: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: '/redirect/:path*',
|
|
|
|
component: () => import('@/views/redirect/index')
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-09-13 20:50:21 +00:00
|
|
|
{
|
|
|
|
path: '/login-pleroma',
|
|
|
|
component: () => import('@/views/login/pleroma'),
|
|
|
|
hidden: true
|
|
|
|
},
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: '/login',
|
|
|
|
component: () => import('@/views/login/index'),
|
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
2018-09-03 07:03:00 +00:00
|
|
|
path: '/auth-redirect',
|
2018-08-15 09:29:15 +00:00
|
|
|
component: () => import('@/views/login/authredirect'),
|
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/404',
|
|
|
|
component: () => import('@/views/errorPage/404'),
|
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/401',
|
|
|
|
component: () => import('@/views/errorPage/401'),
|
|
|
|
hidden: true
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
2017-11-02 09:58:35 +00:00
|
|
|
path: '',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
2019-02-23 21:40:26 +00:00
|
|
|
redirect: '/users/index'
|
2017-05-17 08:26:33 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
export default new Router({
|
2018-01-05 03:38:34 +00:00
|
|
|
// mode: 'history', // require service support
|
2017-05-17 08:26:33 +00:00
|
|
|
scrollBehavior: () => ({ y: 0 }),
|
|
|
|
routes: constantRouterMap
|
2017-08-22 07:43:34 +00:00
|
|
|
})
|
2017-05-17 08:26:33 +00:00
|
|
|
|
|
|
|
export const asyncRouterMap = [
|
2019-02-22 19:38:56 +00:00
|
|
|
{
|
|
|
|
path: '/users',
|
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/users/index'),
|
|
|
|
name: 'Users',
|
|
|
|
meta: { title: 'users', icon: 'peoples', noCache: true }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-09-14 22:17:24 +00:00
|
|
|
...(settingsDisabled ? [] : [settings]),
|
|
|
|
...(reportsDisabled ? [] : [reports]),
|
2019-07-24 20:50:45 +00:00
|
|
|
{
|
|
|
|
path: '/users/:id',
|
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: '',
|
|
|
|
name: 'UsersShow',
|
|
|
|
component: () => import('@/views/users/show')
|
|
|
|
}
|
|
|
|
],
|
|
|
|
hidden: true
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
{ path: '*', redirect: '/404', hidden: true }
|
2017-08-22 07:43:34 +00:00
|
|
|
]
|