Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
7dba6ce5
Commit
7dba6ce5
authored
Feb 01, 2019
by
Junling Bu
Browse files
feat[litemall-admin]: 前端的权限支持页面权限
parent
70f50e24
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-admin/src/router/index.js
View file @
7dba6ce5
...
@@ -82,6 +82,7 @@ export const asyncRouterMap = [
...
@@ -82,6 +82,7 @@ export const asyncRouterMap = [
path
:
'
/user
'
,
path
:
'
/user
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
userManage
'
,
name
:
'
userManage
'
,
meta
:
{
meta
:
{
title
:
'
用户管理
'
,
title
:
'
用户管理
'
,
...
@@ -92,37 +93,61 @@ export const asyncRouterMap = [
...
@@ -92,37 +93,61 @@ export const asyncRouterMap = [
path
:
'
user
'
,
path
:
'
user
'
,
component
:
()
=>
import
(
'
@/views/user/user
'
),
component
:
()
=>
import
(
'
@/views/user/user
'
),
name
:
'
user
'
,
name
:
'
user
'
,
meta
:
{
title
:
'
会员管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/user/list
'
,
'
POST /admin/user/create
'
,
'
POST /admin/user/update
'
],
title
:
'
会员管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
address
'
,
path
:
'
address
'
,
component
:
()
=>
import
(
'
@/views/user/address
'
),
component
:
()
=>
import
(
'
@/views/user/address
'
),
name
:
'
address
'
,
name
:
'
address
'
,
meta
:
{
title
:
'
收货地址
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/address/list
'
],
title
:
'
收货地址
'
,
noCache
:
true
}
},
},
{
{
path
:
'
collect
'
,
path
:
'
collect
'
,
component
:
()
=>
import
(
'
@/views/user/collect
'
),
component
:
()
=>
import
(
'
@/views/user/collect
'
),
name
:
'
collect
'
,
name
:
'
collect
'
,
meta
:
{
title
:
'
会员收藏
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/collect/list
'
],
title
:
'
会员收藏
'
,
noCache
:
true
}
},
},
{
{
path
:
'
footprint
'
,
path
:
'
footprint
'
,
component
:
()
=>
import
(
'
@/views/user/footprint
'
),
component
:
()
=>
import
(
'
@/views/user/footprint
'
),
name
:
'
footprint
'
,
name
:
'
footprint
'
,
meta
:
{
title
:
'
会员足迹
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/footprint/list
'
],
title
:
'
会员足迹
'
,
noCache
:
true
}
},
},
{
{
path
:
'
history
'
,
path
:
'
history
'
,
component
:
()
=>
import
(
'
@/views/user/history
'
),
component
:
()
=>
import
(
'
@/views/user/history
'
),
name
:
'
history
'
,
name
:
'
history
'
,
meta
:
{
title
:
'
搜索历史
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/history/list
'
],
title
:
'
搜索历史
'
,
noCache
:
true
}
},
},
{
{
path
:
'
feedback
'
,
path
:
'
feedback
'
,
component
:
()
=>
import
(
'
@/views/user/feedback
'
),
component
:
()
=>
import
(
'
@/views/user/feedback
'
),
name
:
'
feedback
'
,
name
:
'
feedback
'
,
meta
:
{
title
:
'
意见反馈
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/feedback/list
'
],
title
:
'
意见反馈
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -131,6 +156,7 @@ export const asyncRouterMap = [
...
@@ -131,6 +156,7 @@ export const asyncRouterMap = [
path
:
'
/mall
'
,
path
:
'
/mall
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
mallManage
'
,
name
:
'
mallManage
'
,
meta
:
{
meta
:
{
title
:
'
商场管理
'
,
title
:
'
商场管理
'
,
...
@@ -141,37 +167,60 @@ export const asyncRouterMap = [
...
@@ -141,37 +167,60 @@ export const asyncRouterMap = [
path
:
'
region
'
,
path
:
'
region
'
,
component
:
()
=>
import
(
'
@/views/mall/region
'
),
component
:
()
=>
import
(
'
@/views/mall/region
'
),
name
:
'
region
'
,
name
:
'
region
'
,
meta
:
{
title
:
'
行政区域
'
,
noCache
:
true
}
meta
:
{
title
:
'
行政区域
'
,
noCache
:
true
}
},
},
{
{
path
:
'
brand
'
,
path
:
'
brand
'
,
component
:
()
=>
import
(
'
@/views/mall/brand
'
),
component
:
()
=>
import
(
'
@/views/mall/brand
'
),
name
:
'
brand
'
,
name
:
'
brand
'
,
meta
:
{
title
:
'
品牌制造商
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/brand/list
'
,
'
POST /admin/brand/create
'
,
'
GET /admin/brand/read
'
,
'
POST /admin/brand/update
'
,
'
POST /admin/brand/delete
'
],
title
:
'
品牌制造商
'
,
noCache
:
true
}
},
},
{
{
path
:
'
category
'
,
path
:
'
category
'
,
component
:
()
=>
import
(
'
@/views/mall/category
'
),
component
:
()
=>
import
(
'
@/views/mall/category
'
),
name
:
'
category
'
,
name
:
'
category
'
,
meta
:
{
title
:
'
商品类目
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/category/list
'
,
'
POST /admin/category/create
'
,
'
GET /admin/category/read
'
,
'
POST /admin/category/update
'
,
'
POST /admin/category/delete
'
],
title
:
'
商品类目
'
,
noCache
:
true
}
},
},
{
{
path
:
'
order
'
,
path
:
'
order
'
,
component
:
()
=>
import
(
'
@/views/mall/order
'
),
component
:
()
=>
import
(
'
@/views/mall/order
'
),
name
:
'
order
'
,
name
:
'
order
'
,
meta
:
{
title
:
'
订单管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/order/list
'
,
'
GET /admin/order/detail
'
,
'
POST /admin/order/ordership
'
,
'
POST /admin/order/orderrefund
'
,
'
POST /admin/order/orderreply
'
],
title
:
'
订单管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
issue
'
,
path
:
'
issue
'
,
component
:
()
=>
import
(
'
@/views/mall/issue
'
),
component
:
()
=>
import
(
'
@/views/mall/issue
'
),
name
:
'
issue
'
,
name
:
'
issue
'
,
meta
:
{
title
:
'
通用问题
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/issue/list
'
,
'
POST /admin/issue/create
'
,
'
GET /admin/issue/read
'
,
'
POST /admin/issue/update
'
,
'
POST /admin/issue/delete
'
],
title
:
'
通用问题
'
,
noCache
:
true
}
},
},
{
{
path
:
'
keyword
'
,
path
:
'
keyword
'
,
component
:
()
=>
import
(
'
@/views/mall/keyword
'
),
component
:
()
=>
import
(
'
@/views/mall/keyword
'
),
name
:
'
keyword
'
,
name
:
'
keyword
'
,
meta
:
{
title
:
'
关键词
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/keyword/list
'
,
'
POST /admin/keyword/create
'
,
'
GET /admin/keyword/read
'
,
'
POST /admin/keyword/update
'
,
'
POST /admin/keyword/delete
'
],
title
:
'
关键词
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -180,6 +229,7 @@ export const asyncRouterMap = [
...
@@ -180,6 +229,7 @@ export const asyncRouterMap = [
path
:
'
/goods
'
,
path
:
'
/goods
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
goodsManage
'
,
name
:
'
goodsManage
'
,
meta
:
{
meta
:
{
title
:
'
商品管理
'
,
title
:
'
商品管理
'
,
...
@@ -190,26 +240,42 @@ export const asyncRouterMap = [
...
@@ -190,26 +240,42 @@ export const asyncRouterMap = [
path
:
'
list
'
,
path
:
'
list
'
,
component
:
()
=>
import
(
'
@/views/goods/list
'
),
component
:
()
=>
import
(
'
@/views/goods/list
'
),
name
:
'
goodsList
'
,
name
:
'
goodsList
'
,
meta
:
{
title
:
'
商品列表
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/goods/list
'
,
'
POST /admin/goods/delete
'
],
title
:
'
商品列表
'
,
noCache
:
true
}
},
},
{
{
path
:
'
create
'
,
path
:
'
create
'
,
component
:
()
=>
import
(
'
@/views/goods/create
'
),
component
:
()
=>
import
(
'
@/views/goods/create
'
),
name
:
'
goodsCreate
'
,
name
:
'
goodsCreate
'
,
meta
:
{
title
:
'
商品上架
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
POST /admin/goods/create
'
],
title
:
'
商品上架
'
,
noCache
:
true
}
},
},
{
{
path
:
'
edit
'
,
path
:
'
edit
'
,
component
:
()
=>
import
(
'
@/views/goods/edit
'
),
component
:
()
=>
import
(
'
@/views/goods/edit
'
),
name
:
'
goodsEdit
'
,
name
:
'
goodsEdit
'
,
meta
:
{
title
:
'
商品编辑
'
,
noCache
:
true
},
meta
:
{
perms
:
[
'
GET /admin/goods/detail
'
,
'
POST /admin/goods/update
'
,
'
POST /admin/goods/catAndBrand
'
],
title
:
'
商品编辑
'
,
noCache
:
true
},
hidden
:
true
hidden
:
true
},
},
{
{
path
:
'
comment
'
,
path
:
'
comment
'
,
component
:
()
=>
import
(
'
@/views/goods/comment
'
),
component
:
()
=>
import
(
'
@/views/goods/comment
'
),
name
:
'
goodsComment
'
,
name
:
'
goodsComment
'
,
meta
:
{
title
:
'
商品评论
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/comment/list
'
,
'
POST /admin/comment/delete
'
],
title
:
'
商品评论
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -217,6 +283,7 @@ export const asyncRouterMap = [
...
@@ -217,6 +283,7 @@ export const asyncRouterMap = [
path
:
'
/promotion
'
,
path
:
'
/promotion
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
promotionManage
'
,
name
:
'
promotionManage
'
,
meta
:
{
meta
:
{
title
:
'
推广管理
'
,
title
:
'
推广管理
'
,
...
@@ -227,38 +294,62 @@ export const asyncRouterMap = [
...
@@ -227,38 +294,62 @@ export const asyncRouterMap = [
path
:
'
ad
'
,
path
:
'
ad
'
,
component
:
()
=>
import
(
'
@/views/promotion/ad
'
),
component
:
()
=>
import
(
'
@/views/promotion/ad
'
),
name
:
'
ad
'
,
name
:
'
ad
'
,
meta
:
{
title
:
'
广告管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/ad/list
'
,
'
POST /admin/ad/create
'
,
'
GET /admin/ad/read
'
,
'
POST /admin/ad/update
'
,
'
POST /admin/ad/delete
'
],
title
:
'
广告管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
coupon
'
,
path
:
'
coupon
'
,
component
:
()
=>
import
(
'
@/views/promotion/coupon
'
),
component
:
()
=>
import
(
'
@/views/promotion/coupon
'
),
name
:
'
coupon
'
,
name
:
'
coupon
'
,
meta
:
{
title
:
'
优惠券管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/coupon/list
'
,
'
POST /admin/coupon/create
'
,
'
POST /admin/coupon/update
'
,
'
POST /admin/coupon/delete
'
],
title
:
'
优惠券管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
couponDetail
'
,
path
:
'
couponDetail
'
,
component
:
()
=>
import
(
'
@/views/promotion/couponDetail
'
),
component
:
()
=>
import
(
'
@/views/promotion/couponDetail
'
),
name
:
'
couponDetail
'
,
name
:
'
couponDetail
'
,
meta
:
{
title
:
'
优惠券详情
'
,
noCache
:
true
},
meta
:
{
perms
:
[
'
GET /admin/coupon/list
'
,
'
GET /admin/coupon/listuser
'
],
title
:
'
优惠券详情
'
,
noCache
:
true
},
hidden
:
true
hidden
:
true
},
},
{
{
path
:
'
topic
'
,
path
:
'
topic
'
,
component
:
()
=>
import
(
'
@/views/promotion/topic
'
),
component
:
()
=>
import
(
'
@/views/promotion/topic
'
),
name
:
'
topic
'
,
name
:
'
topic
'
,
meta
:
{
title
:
'
专题管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/topic/list
'
,
'
POST /admin/topic/create
'
,
'
GET /admin/topic/read
'
,
'
POST /admin/topic/update
'
,
'
POST /admin/topic/delete
'
],
title
:
'
专题管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
groupon-rule
'
,
path
:
'
groupon-rule
'
,
component
:
()
=>
import
(
'
@/views/promotion/grouponRule
'
),
component
:
()
=>
import
(
'
@/views/promotion/grouponRule
'
),
name
:
'
grouponRule
'
,
name
:
'
grouponRule
'
,
meta
:
{
title
:
'
团购规则
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/groupon/list
'
,
'
POST /admin/groupon/create
'
,
'
POST /admin/groupon/update
'
,
'
POST /admin/groupon/delete
'
],
title
:
'
团购规则
'
,
noCache
:
true
}
},
},
{
{
path
:
'
groupon-activity
'
,
path
:
'
groupon-activity
'
,
component
:
()
=>
import
(
'
@/views/promotion/grouponActivity
'
),
component
:
()
=>
import
(
'
@/views/promotion/grouponActivity
'
),
name
:
'
grouponActivity
'
,
name
:
'
grouponActivity
'
,
meta
:
{
title
:
'
团购活动
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/groupon/listRecord
'
],
title
:
'
团购活动
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -267,6 +358,7 @@ export const asyncRouterMap = [
...
@@ -267,6 +358,7 @@ export const asyncRouterMap = [
path
:
'
/sys
'
,
path
:
'
/sys
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
sysManage
'
,
name
:
'
sysManage
'
,
meta
:
{
meta
:
{
title
:
'
系统管理
'
,
title
:
'
系统管理
'
,
...
@@ -277,19 +369,31 @@ export const asyncRouterMap = [
...
@@ -277,19 +369,31 @@ export const asyncRouterMap = [
path
:
'
admin
'
,
path
:
'
admin
'
,
component
:
()
=>
import
(
'
@/views/sys/admin
'
),
component
:
()
=>
import
(
'
@/views/sys/admin
'
),
name
:
'
admin
'
,
name
:
'
admin
'
,
meta
:
{
title
:
'
管理员
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/admin/list
'
,
'
POST /admin/admin/create
'
,
'
POST /admin/admin/update
'
,
'
POST /admin/admin/delete
'
],
title
:
'
管理员
'
,
noCache
:
true
}
},
},
{
{
path
:
'
role
'
,
path
:
'
role
'
,
component
:
()
=>
import
(
'
@/views/sys/role
'
),
component
:
()
=>
import
(
'
@/views/sys/role
'
),
name
:
'
role
'
,
name
:
'
role
'
,
meta
:
{
title
:
'
角色管理
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/role/list
'
,
'
POST /admin/role/create
'
,
'
POST /admin/role/update
'
,
'
POST /admin/role/delete
'
,
'
GET /admin/role/permissions
'
,
'
POST /admin/role/permissions
'
],
title
:
'
角色管理
'
,
noCache
:
true
}
},
},
{
{
path
:
'
os
'
,
path
:
'
os
'
,
component
:
()
=>
import
(
'
@/views/sys/os
'
),
component
:
()
=>
import
(
'
@/views/sys/os
'
),
name
:
'
os
'
,
name
:
'
os
'
,
meta
:
{
title
:
'
对象存储
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/os/list
'
,
'
POST /admin/os/create
'
,
'
POST /admin/os/update
'
,
'
POST /admin/os/delete
'
],
title
:
'
对象存储
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -298,6 +402,7 @@ export const asyncRouterMap = [
...
@@ -298,6 +402,7 @@ export const asyncRouterMap = [
path
:
'
/stat
'
,
path
:
'
/stat
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
statManage
'
,
name
:
'
statManage
'
,
meta
:
{
meta
:
{
title
:
'
统计
'
,
title
:
'
统计
'
,
...
@@ -308,19 +413,31 @@ export const asyncRouterMap = [
...
@@ -308,19 +413,31 @@ export const asyncRouterMap = [
path
:
'
user
'
,
path
:
'
user
'
,
component
:
()
=>
import
(
'
@/views/stat/user
'
),
component
:
()
=>
import
(
'
@/views/stat/user
'
),
name
:
'
statUser
'
,
name
:
'
statUser
'
,
meta
:
{
title
:
'
用户统计
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/stat/user
'
],
title
:
'
用户统计
'
,
noCache
:
true
}
},
},
{
{
path
:
'
order
'
,
path
:
'
order
'
,
component
:
()
=>
import
(
'
@/views/stat/order
'
),
component
:
()
=>
import
(
'
@/views/stat/order
'
),
name
:
'
statOrder
'
,
name
:
'
statOrder
'
,
meta
:
{
title
:
'
订单统计
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/stat/order
'
],
title
:
'
订单统计
'
,
noCache
:
true
}
},
},
{
{
path
:
'
goods
'
,
path
:
'
goods
'
,
component
:
()
=>
import
(
'
@/views/stat/goods
'
),
component
:
()
=>
import
(
'
@/views/stat/goods
'
),
name
:
'
statGoods
'
,
name
:
'
statGoods
'
,
meta
:
{
title
:
'
商品统计
'
,
noCache
:
true
}
meta
:
{
perms
:
[
'
GET /admin/stat/goods
'
],
title
:
'
商品统计
'
,
noCache
:
true
}
}
}
]
]
},
},
...
@@ -328,6 +445,7 @@ export const asyncRouterMap = [
...
@@ -328,6 +445,7 @@ export const asyncRouterMap = [
path
:
'
external-link
'
,
path
:
'
external-link
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
name
:
'
externalLink
'
,
name
:
'
externalLink
'
,
meta
:
{
meta
:
{
title
:
'
外链
'
,
title
:
'
外链
'
,
...
@@ -368,6 +486,7 @@ export const asyncRouterMap = [
...
@@ -368,6 +486,7 @@ export const asyncRouterMap = [
path
:
'
/profile
'
,
path
:
'
/profile
'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
noredirect
'
,
alwaysShow
:
true
,
children
:
[
children
:
[
{
{
path
:
'
password
'
,
path
:
'
password
'
,
...
...
litemall-admin/src/store/modules/permission.js
View file @
7dba6ce5
...
@@ -23,11 +23,15 @@ function filterAsyncRouter(routes, perms) {
...
@@ -23,11 +23,15 @@ function filterAsyncRouter(routes, perms) {
routes
.
forEach
(
route
=>
{
routes
.
forEach
(
route
=>
{
const
tmp
=
{
...
route
}
const
tmp
=
{
...
route
}
if
(
hasPermission
(
perms
,
tmp
))
{
if
(
tmp
.
children
)
{
if
(
tmp
.
children
)
{
tmp
.
children
=
filterAsyncRouter
(
tmp
.
children
,
perms
)
tmp
.
children
=
filterAsyncRouter
(
tmp
.
children
,
perms
)
if
(
tmp
.
children
&&
tmp
.
children
.
length
>
0
)
{
res
.
push
(
tmp
)
}
}
else
{
if
(
hasPermission
(
perms
,
tmp
))
{
res
.
push
(
tmp
)
}
}
res
.
push
(
tmp
)
}
}
})
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment