|
@ -39,84 +39,90 @@ import Layout1 from '@/layout/layout' |
|
|
* a base page that does not have permission requirements |
|
|
* a base page that does not have permission requirements |
|
|
* all roles can be accessed |
|
|
* all roles can be accessed |
|
|
*/ |
|
|
*/ |
|
|
export const constantRoutes = [ |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/redirect', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
hidden: true, |
|
|
|
|
|
children: [ |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/redirect/:path*', |
|
|
|
|
|
component: () => import('@/views/redirect/index') |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/login', |
|
|
|
|
|
component: () => import('@/views/login/index'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/auth-redirect', |
|
|
|
|
|
component: () => import('@/views/login/auth-redirect'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/404', |
|
|
|
|
|
component: () => import('@/views/error-page/404'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/401', |
|
|
|
|
|
component: () => import('@/views/error-page/401'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
redirect: '/dashboard', |
|
|
|
|
|
children: [ |
|
|
|
|
|
{ |
|
|
|
|
|
path: 'dashboard', |
|
|
|
|
|
component: () => import('@/views/dashboard/index'), |
|
|
|
|
|
name: '首页', |
|
|
|
|
|
meta: { title: '首页', icon: 'home', affix: true } |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}, |
|
|
|
|
|
// {
|
|
|
|
|
|
// path: '/screwdown',
|
|
|
|
|
|
// component: () => import('/plant/eods/index'),
|
|
|
|
|
|
// hidden: true
|
|
|
|
|
|
// },
|
|
|
|
|
|
{ |
|
|
|
|
|
path: '/profile', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
redirect: '/profile/index', |
|
|
|
|
|
hidden: true, |
|
|
|
|
|
children: [ |
|
|
|
|
|
{ |
|
|
|
|
|
path: 'index', |
|
|
|
|
|
component: () => import('@/views/profile/index'), |
|
|
|
|
|
name: '个人中心', |
|
|
|
|
|
meta: { title: '个人中心', icon: 'user', noCache: true } |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}, |
|
|
|
|
|
// {
|
|
|
|
|
|
// path: '/supplier',
|
|
|
|
|
|
// component: Layout1,
|
|
|
|
|
|
// redirect: '/supplier/login',
|
|
|
|
|
|
// hidden: true,
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: 'login',
|
|
|
|
|
|
// component: () => import('@/views/supplier/login'),
|
|
|
|
|
|
// name: '供应商登录',
|
|
|
|
|
|
// meta: { title: '供应商登录', icon: 'user', noCache: true }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
export const constantRoutes = [{ |
|
|
|
|
|
path: '/redirect', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
hidden: true, |
|
|
|
|
|
children: [{ |
|
|
|
|
|
path: '/redirect/:path*', |
|
|
|
|
|
component: () => import('@/views/redirect/index') |
|
|
|
|
|
}] |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/login', |
|
|
|
|
|
component: () => import('@/views/login/index'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/auth-redirect', |
|
|
|
|
|
component: () => import('@/views/login/auth-redirect'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/404', |
|
|
|
|
|
component: () => import('@/views/error-page/404'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/401', |
|
|
|
|
|
component: () => import('@/views/error-page/401'), |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/dataL', |
|
|
|
|
|
component: () => import('@/views/DataV/index'), |
|
|
|
|
|
hidden: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
path: '/', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
redirect: '/dashboard', |
|
|
|
|
|
children: [{ |
|
|
|
|
|
path: 'dashboard', |
|
|
|
|
|
component: () => import('@/views/dashboard/index'), |
|
|
|
|
|
name: '首页', |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: '首页', |
|
|
|
|
|
icon: 'home', |
|
|
|
|
|
affix: true |
|
|
|
|
|
} |
|
|
|
|
|
}] |
|
|
|
|
|
}, |
|
|
|
|
|
// {
|
|
|
|
|
|
// path: '/screwdown',
|
|
|
|
|
|
// component: () => import('/plant/eods/index'),
|
|
|
|
|
|
// hidden: true
|
|
|
|
|
|
// },
|
|
|
|
|
|
{ |
|
|
|
|
|
path: '/profile', |
|
|
|
|
|
component: Layout, |
|
|
|
|
|
redirect: '/profile/index', |
|
|
|
|
|
hidden: true, |
|
|
|
|
|
children: [{ |
|
|
|
|
|
path: 'index', |
|
|
|
|
|
component: () => import('@/views/profile/index'), |
|
|
|
|
|
name: '个人中心', |
|
|
|
|
|
meta: { |
|
|
|
|
|
title: '个人中心', |
|
|
|
|
|
icon: 'user', |
|
|
|
|
|
noCache: true |
|
|
|
|
|
} |
|
|
|
|
|
}] |
|
|
|
|
|
} |
|
|
|
|
|
// {
|
|
|
|
|
|
// path: '/supplier',
|
|
|
|
|
|
// component: Layout1,
|
|
|
|
|
|
// redirect: '/supplier/login',
|
|
|
|
|
|
// hidden: true,
|
|
|
|
|
|
// children: [
|
|
|
|
|
|
// {
|
|
|
|
|
|
// path: 'login',
|
|
|
|
|
|
// component: () => import('@/views/supplier/login'),
|
|
|
|
|
|
// name: '供应商登录',
|
|
|
|
|
|
// meta: { title: '供应商登录', icon: 'user', noCache: true }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ]
|
|
|
|
|
|
// }
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -126,20 +132,22 @@ export const constantRoutes = [ |
|
|
export var asyncRoutes = [] |
|
|
export var asyncRoutes = [] |
|
|
|
|
|
|
|
|
const createRouter = () => new Router({ |
|
|
const createRouter = () => new Router({ |
|
|
mode: 'history', // require service support
|
|
|
|
|
|
scrollBehavior: () => ({ y: 0 }), |
|
|
|
|
|
routes: constantRoutes |
|
|
|
|
|
|
|
|
mode: 'history', // require service support
|
|
|
|
|
|
scrollBehavior: () => ({ |
|
|
|
|
|
y: 0 |
|
|
|
|
|
}), |
|
|
|
|
|
routes: constantRoutes |
|
|
}) |
|
|
}) |
|
|
const router = createRouter() |
|
|
const router = createRouter() |
|
|
// prevent add routes repeatedly
|
|
|
// prevent add routes repeatedly
|
|
|
router.selfaddRoutes = function (params) { |
|
|
|
|
|
router.matcher = createRouter().matcher |
|
|
|
|
|
router.addRoutes(params) |
|
|
|
|
|
|
|
|
router.selfaddRoutes = function(params) { |
|
|
|
|
|
router.matcher = createRouter().matcher |
|
|
|
|
|
router.addRoutes(params) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export function resetRouter () { |
|
|
|
|
|
const newRouter = createRouter() |
|
|
|
|
|
router.matcher = newRouter.matcher // reset router
|
|
|
|
|
|
|
|
|
export function resetRouter() { |
|
|
|
|
|
const newRouter = createRouter() |
|
|
|
|
|
router.matcher = newRouter.matcher // reset router
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default router |
|
|
export default router |