|
|
@@ -286,12 +286,12 @@ const routes = [
|
|
|
name: 'goodsManage',
|
|
|
component: DEFAULT_LAYOUT,
|
|
|
meta: {
|
|
|
- title : '商品管理',
|
|
|
+ title: '商品管理',
|
|
|
icon: 'icon-apps',
|
|
|
permission: ['admin', 'product']
|
|
|
},
|
|
|
children: [
|
|
|
- {
|
|
|
+ {
|
|
|
path: 'goods/addGoods',
|
|
|
name: 'admin.goods.addGoods',
|
|
|
component: () => import('../pages/admin/goods/addGoods.vue'),
|
|
|
@@ -389,6 +389,11 @@ router.beforeEach(async (to, from, next) => {
|
|
|
// Message.error('请先登录')
|
|
|
return router.push(`/login?from=${to.path}`)
|
|
|
}
|
|
|
+
|
|
|
+ if (to.meta && to.meta.permission && to.meta.permission.length > 0) {
|
|
|
+ if (!to.meta.permission.some((perm) => user.roles.includes(perm)))
|
|
|
+ return next('/')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (to.meta && (to.meta.onlyWeb || to.meta.onlyElectron)) {
|