|
@@ -29,242 +29,255 @@ import Layout from '@/layout'
|
|
|
*/
|
|
|
|
|
|
// 公共路由(可视化首页头部链接)
|
|
|
-export const constantRoutes = [
|
|
|
- {
|
|
|
- path: '/',
|
|
|
- redirect: 'forest',
|
|
|
- },
|
|
|
- {
|
|
|
- //林业中心
|
|
|
- path: '/forest',
|
|
|
- name: 'forest',
|
|
|
- component: () => import('@/views/forest'),
|
|
|
- meta: {
|
|
|
- title: '林业云图'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //数据中心
|
|
|
- path: '/datacenter',
|
|
|
- name: 'datacenter',
|
|
|
- component: () => import('@/views/datacenter'),
|
|
|
- meta: {
|
|
|
- title: '数据中心'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //事件中心
|
|
|
- path: '/event',
|
|
|
- name: 'event',
|
|
|
- component: () => import('@/views/event'),
|
|
|
- meta: {
|
|
|
- title: '事件中心'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //监控中心
|
|
|
- path: '/monitor',
|
|
|
- name: 'monitor',
|
|
|
- component: () => import('@/views/monitor'),
|
|
|
- meta: {
|
|
|
- title: '监控中心'
|
|
|
- }
|
|
|
- },{
|
|
|
- path: '/',
|
|
|
- name: '',
|
|
|
- component: () => import('@/views/monitor'),
|
|
|
- meta: {
|
|
|
- title: '灾后评估'
|
|
|
- }
|
|
|
- },{
|
|
|
- path: '/animal',
|
|
|
- name: 'animal',
|
|
|
- component: () => import('@/views/animal'),
|
|
|
- meta: {
|
|
|
- title: '动物保护'
|
|
|
- }
|
|
|
- },{
|
|
|
- path: '/leader',
|
|
|
- name: 'leader',
|
|
|
- component: () => import('@/views/leader'),
|
|
|
- meta: {
|
|
|
- title: '林长制'
|
|
|
- }
|
|
|
- },{
|
|
|
- path: '/',
|
|
|
- name: '',
|
|
|
- component: () => import('@/views/monitor'),
|
|
|
- meta: {
|
|
|
- title: '植树造林'
|
|
|
- }
|
|
|
- },
|
|
|
+export const constantRoutes = [{
|
|
|
+ path: '/',
|
|
|
+ redirect: 'forest',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //林业中心
|
|
|
+ path: '/forest',
|
|
|
+ name: 'forest',
|
|
|
+ component: () => import('@/views/forest'),
|
|
|
+ meta: {
|
|
|
+ title: '林业云图'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //数据中心
|
|
|
+ path: '/datacenter',
|
|
|
+ name: 'datacenter',
|
|
|
+ component: () => import('@/views/datacenter'),
|
|
|
+ meta: {
|
|
|
+ title: '数据中心'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //事件中心
|
|
|
+ path: '/event',
|
|
|
+ name: 'event',
|
|
|
+ component: () => import('@/views/event'),
|
|
|
+ meta: {
|
|
|
+ title: '事件中心'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //监控中心
|
|
|
+ path: '/monitor',
|
|
|
+ name: 'monitor',
|
|
|
+ component: () => import('@/views/monitor'),
|
|
|
+ meta: {
|
|
|
+ title: '监控中心'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ path: '/disaster',
|
|
|
+ name: 'disaster',
|
|
|
+ component: () => import('@/views/disaster'),
|
|
|
+ meta: {
|
|
|
+ title: '灾后评估'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ path: '/animal',
|
|
|
+ name: 'animal',
|
|
|
+ component: () => import('@/views/animal'),
|
|
|
+ meta: {
|
|
|
+ title: '动物保护'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ path: '/leader',
|
|
|
+ name: 'leader',
|
|
|
+ component: () => import('@/views/leader'),
|
|
|
+ meta: {
|
|
|
+ title: '林长制'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ path: '/',
|
|
|
+ name: '',
|
|
|
+ component: () => import('@/views/monitor'),
|
|
|
+ meta: {
|
|
|
+ title: '植树造林'
|
|
|
+ }
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
// 公共路由
|
|
|
-export const constantRoutesNew = [
|
|
|
- {
|
|
|
- path: '/',
|
|
|
- redirect: 'forest',
|
|
|
- },
|
|
|
- {
|
|
|
- //林业中心
|
|
|
- path: '/forest',
|
|
|
- name: 'forest',
|
|
|
- component: () => import('@/views/forest'),
|
|
|
- meta: {
|
|
|
- title: '数字林业'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //数据中心
|
|
|
- path: '/datacenter',
|
|
|
- name: 'datacenter',
|
|
|
- component: () => import('@/views/datacenter'),
|
|
|
- meta: {
|
|
|
- title: '数据中心'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //事件中心
|
|
|
- path: '/event',
|
|
|
- name: 'event',
|
|
|
- component: () => import('@/views/event'),
|
|
|
- meta: {
|
|
|
- title: '事件中心'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- //监控中心
|
|
|
- path: '/monitor',
|
|
|
- name: 'monitor',
|
|
|
- component: () => import('@/views/monitor'),
|
|
|
- meta: {
|
|
|
- title: '监控中心'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/animal',
|
|
|
- name: 'animal',
|
|
|
- component: () => import('@/views/animal'),
|
|
|
- meta: {
|
|
|
- title: '动物保护'
|
|
|
- }
|
|
|
- },
|
|
|
+export const constantRoutesNew = [{
|
|
|
+ path: '/',
|
|
|
+ redirect: 'forest',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //林业中心
|
|
|
+ path: '/forest',
|
|
|
+ name: 'forest',
|
|
|
+ component: () => import('@/views/forest'),
|
|
|
+ meta: {
|
|
|
+ title: '数字林业'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //数据中心
|
|
|
+ path: '/datacenter',
|
|
|
+ name: 'datacenter',
|
|
|
+ component: () => import('@/views/datacenter'),
|
|
|
+ meta: {
|
|
|
+ title: '数据中心'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //事件中心
|
|
|
+ path: '/event',
|
|
|
+ name: 'event',
|
|
|
+ component: () => import('@/views/event'),
|
|
|
+ meta: {
|
|
|
+ title: '事件中心'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ //监控中心
|
|
|
+ path: '/monitor',
|
|
|
+ name: 'monitor',
|
|
|
+ component: () => import('@/views/monitor'),
|
|
|
+ meta: {
|
|
|
+ title: '监控中心'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/disaster',
|
|
|
+ name: 'disaster',
|
|
|
+ component: () => import('@/views/disaster'),
|
|
|
+ meta: {
|
|
|
+ title: '灾后评估'
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
- path: '/leader',
|
|
|
- name: 'leader',
|
|
|
- component: () => import('@/views/leader'),
|
|
|
- meta: {
|
|
|
- title: '林长制'
|
|
|
- }
|
|
|
+ path: '/animal',
|
|
|
+ name: 'animal',
|
|
|
+ component: () => import('@/views/animal'),
|
|
|
+ meta: {
|
|
|
+ title: '动物保护'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/leader',
|
|
|
+ name: 'leader',
|
|
|
+ component: () => import('@/views/leader'),
|
|
|
+ meta: {
|
|
|
+ title: '林长制'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ component: () => import('@/views/system/login'),
|
|
|
+ hidden: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/register',
|
|
|
+ component: () => import('@/views/system/register'),
|
|
|
+ hidden: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/404',
|
|
|
+ component: () => import('@/views/error/404'),
|
|
|
+ hidden: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/401',
|
|
|
+ component: () => import('@/views/error/401'),
|
|
|
+ hidden: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '',
|
|
|
+ component: Layout,
|
|
|
+ redirect: 'index',
|
|
|
+ children: [{
|
|
|
+ path: 'forest',
|
|
|
+ component: () => import('@/views/forest'),
|
|
|
+ name: 'forest',
|
|
|
+ meta: {
|
|
|
+ title: '首页',
|
|
|
+ icon: 'dashboard',
|
|
|
+ affix: true
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/user',
|
|
|
+ component: Layout,
|
|
|
+ hidden: true,
|
|
|
+ redirect: 'noredirect',
|
|
|
+ children: [{
|
|
|
+ path: 'profile',
|
|
|
+ component: () => import('@/views/system/user/profile/index'),
|
|
|
+ name: 'Profile',
|
|
|
+ meta: {
|
|
|
+ title: '个人中心',
|
|
|
+ icon: 'user'
|
|
|
+ }
|
|
|
+ }]
|
|
|
},
|
|
|
- {
|
|
|
- path: '/login',
|
|
|
- component: () => import('@/views/system/login'),
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/register',
|
|
|
- component: () => import('@/views/system/register'),
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/404',
|
|
|
- component: () => import('@/views/error/404'),
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/401',
|
|
|
- component: () => import('@/views/error/401'),
|
|
|
- hidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- path: '',
|
|
|
- component: Layout,
|
|
|
- redirect: 'index',
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: 'forest',
|
|
|
- component: () => import('@/views/forest'),
|
|
|
- name: 'forest',
|
|
|
- meta: { title: '首页', icon: 'dashboard', affix: true }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/user',
|
|
|
- component: Layout,
|
|
|
- hidden: true,
|
|
|
- redirect: 'noredirect',
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: 'profile',
|
|
|
- component: () => import('@/views/system/user/profile/index'),
|
|
|
- name: 'Profile',
|
|
|
- meta: { title: '个人中心', icon: 'user' }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
// 动态路由,基于用户权限动态去加载
|
|
|
-export const dynamicRoutes = [
|
|
|
- {
|
|
|
- path: '/system/user-auth',
|
|
|
- component: Layout,
|
|
|
- hidden: true,
|
|
|
- permissions: ['system:user:edit'],
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: 'role/:userId(\\d+)',
|
|
|
- component: () => import('@/views/system/user/authRole'),
|
|
|
- name: 'AuthRole',
|
|
|
- meta: { title: '分配角色', activeMenu: '/system/user' }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/system/role-auth',
|
|
|
- component: Layout,
|
|
|
- hidden: true,
|
|
|
- permissions: ['system:role:edit'],
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: 'user/:roleId(\\d+)',
|
|
|
- component: () => import('@/views/system/role/authUser'),
|
|
|
- name: 'AuthUser',
|
|
|
- meta: { title: '分配用户', activeMenu: '/system/role' }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/system/dict-data',
|
|
|
- component: Layout,
|
|
|
- hidden: true,
|
|
|
- permissions: ['system:dict:list'],
|
|
|
- children: [
|
|
|
- {
|
|
|
- path: 'index/:dictId(\\d+)',
|
|
|
- component: () => import('@/views/system/dict/data'),
|
|
|
- name: 'Data',
|
|
|
- meta: { title: '字典数据', activeMenu: '/system/dict' }
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
+export const dynamicRoutes = [{
|
|
|
+ path: '/system/user-auth',
|
|
|
+ component: Layout,
|
|
|
+ hidden: true,
|
|
|
+ permissions: ['system:user:edit'],
|
|
|
+ children: [{
|
|
|
+ path: 'role/:userId(\\d+)',
|
|
|
+ component: () => import('@/views/system/user/authRole'),
|
|
|
+ name: 'AuthRole',
|
|
|
+ meta: {
|
|
|
+ title: '分配角色',
|
|
|
+ activeMenu: '/system/user'
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system/role-auth',
|
|
|
+ component: Layout,
|
|
|
+ hidden: true,
|
|
|
+ permissions: ['system:role:edit'],
|
|
|
+ children: [{
|
|
|
+ path: 'user/:roleId(\\d+)',
|
|
|
+ component: () => import('@/views/system/role/authUser'),
|
|
|
+ name: 'AuthUser',
|
|
|
+ meta: {
|
|
|
+ title: '分配用户',
|
|
|
+ activeMenu: '/system/role'
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/system/dict-data',
|
|
|
+ component: Layout,
|
|
|
+ hidden: true,
|
|
|
+ permissions: ['system:dict:list'],
|
|
|
+ children: [{
|
|
|
+ path: 'index/:dictId(\\d+)',
|
|
|
+ component: () => import('@/views/system/dict/data'),
|
|
|
+ name: 'Data',
|
|
|
+ meta: {
|
|
|
+ title: '字典数据',
|
|
|
+ activeMenu: '/system/dict'
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
// 防止连续点击多次路由报错
|
|
|
let routerPush = Router.prototype.push;
|
|
|
Router.prototype.push = function push(location) {
|
|
|
- return routerPush.call(this, location).catch(err => err)
|
|
|
+ return routerPush.call(this, location).catch(err => err)
|
|
|
}
|
|
|
|
|
|
export default new Router({
|
|
|
- mode: 'history', // 去掉url中的#
|
|
|
- scrollBehavior: () => ({ y: 0 }),
|
|
|
- routes: constantRoutesNew
|
|
|
+ mode: 'history', // 去掉url中的#
|
|
|
+ scrollBehavior: () => ({
|
|
|
+ y: 0
|
|
|
+ }),
|
|
|
+ routes: constantRoutesNew
|
|
|
})
|