菜单接口
菜单管理相关接口。
菜单列表
获取菜单列表(树形结构)。
请求
GET /api/v1/menus1
响应
json
{
"code": "00000",
"msg": "成功",
"data": [
{
"id": 1,
"parentId": 0,
"name": "系统管理",
"path": "/system",
"component": "Layout",
"redirect": "/system/user",
"icon": "setting",
"sort": 1,
"status": 1,
"visible": 1,
"type": 0,
"children": [
{
"id": 2,
"parentId": 1,
"name": "用户管理",
"path": "user",
"component": "system/user/index",
"icon": "user",
"sort": 1,
"status": 1,
"visible": 1,
"type": 1,
"perm": "sys:user:list"
}
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
菜单详情
请求
GET /api/v1/menus/{id}1
响应
json
{
"code": "00000",
"msg": "成功",
"data": {
"id": 2,
"parentId": 1,
"name": "用户管理",
"path": "user",
"component": "system/user/index",
"redirect": null,
"icon": "user",
"sort": 1,
"status": 1,
"visible": 1,
"type": 1,
"perm": "sys:user:list"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
新增菜单
请求
POST /api/v1/menus1
请求参数
json
{
"parentId": 1,
"name": "测试菜单",
"path": "test",
"component": "system/test/index",
"icon": "test",
"sort": 10,
"status": 1,
"visible": 1,
"type": 1,
"perm": "sys:test:list"
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
| 字段 | 类型 | 说明 |
|---|---|---|
| type | int | 类型:0-目录 1-菜单 2-按钮 |
| visible | int | 显示状态:0-隐藏 1-显示 |
| status | int | 状态:0-禁用 1-启用 |
响应
json
{
"code": "00000",
"msg": "成功",
"data": 100
}1
2
3
4
5
2
3
4
5
修改菜单
请求
PUT /api/v1/menus/{id}1
响应
json
{
"code": "00000",
"msg": "成功"
}1
2
3
4
2
3
4
删除菜单
请求
DELETE /api/v1/menus/{id}1
响应
json
{
"code": "00000",
"msg": "成功"
}1
2
3
4
2
3
4
用户路由
获取当前用户的路由数据(动态路由)。
请求
GET /api/v1/menus/routes1
响应
json
{
"code": "00000",
"msg": "成功",
"data": [
{
"path": "/system",
"component": "Layout",
"redirect": "/system/user",
"name": "System",
"meta": {
"title": "系统管理",
"icon": "setting"
},
"children": [
{
"path": "user",
"component": "system/user/index",
"name": "User",
"meta": {
"title": "用户管理",
"icon": "user"
}
}
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
菜单下拉树
获取菜单树形下拉选项。
请求
GET /api/v1/menus/tree1
响应
json
{
"code": "00000",
"msg": "成功",
"data": [
{
"value": 1,
"label": "系统管理",
"children": [
{ "value": 2, "label": "用户管理" },
{ "value": 3, "label": "角色管理" }
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
