Vue + Element UI 实现权限管理系统 前端篇(九):接口格式定义
接口请求格式定义
前台显示需要后台数据,我们这里先把前后端交互接口定义好,没有后台的时候,也方便用mock模拟。
接口定义遵循几个规范:
1. 接口按功能模块划分。
系统登录:登录相关接口
用户管理:用户管理相关接口
机构管理:机构管理相关接口
角色管理 : 角色管理相关接口
菜单管理 : 菜单管理相关接口
字典管理 : 字典管理相关接口
日志管理 : 日志管理相关接口
2. 通用增删改查接口采用统一命名规范。
save : 保存操作
update: 更新操作
delete: 删除操作
findAll: 查询全部
findPage : 分页查询
findTree : 返回对象树
findByXX:根据XX查询
2. 统一请求响应结果。
格式如下:
{
"code": 200, // 状态吗,200:请求成功,其他:请求出错
"msg": null, // 错误消息,成功返回 null, 否则返回出错信息
"data": { // 返回请求数据,JSON 数据格式
...
}
}
系统登录
登录接口
请求URL: /sys/login
请求类型: post
请求参数:
{
"captcha": "3323",
"password": "admin",
"username": "admin"
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"id": null,
"userId": 1,
"token": "77ae89be36504adfb5c09ef71409ea0e",
"expireTime": "2018-09-01T16:24:50.473+0000",
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": "2018-09-01T04:24:50.473+0000"
}
}
用户管理
保存
请求URL: /user/save
请求类型: post
请求参数:
{
"createBy": 0,
"createTime": "2018-09-01T05:40:23.342Z",
"delFlag": 0,
"deptId": 110,
"deptName": "",
"email": "test@qq.com",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:40:23.342Z",
"mobile": "18999878998",
"password": "123456",
"salt": "1312321321",
"status": 0,
"userId": 110,
"username": "test"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
修改
请求URL: /user/update
请求类型: post
请求参数:
{
"mobile": "test2@qq.com",
"userId": 110,
"username": "test"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
删除
请求URL: /user/delete
请求类型: post
请求参数:
{
"userId": 110
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
分页查询
请求URL: /user/findPage
请求类型: post
请求参数:
{
"pageNum": 1,
"pageSize": 5
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"pageNum": 1,
"pageSize": 5,
"totalSize": 5,
"totalPages": 1,
"content": [
{
"userId": 1,
"username": "admin",
"password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
"salt": "YzcmCZNvbXocrsz9dm8e",
"email": "admin@qq.com",
"mobile": "13612345678",
"status": 1,
"deptId": null,
"deptName": null,
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"userId": 2,
"username": "Louis",
"password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
"salt": "YzcmCZNvbXocrsz9dm8e",
"email": "louis@qq.com",
"mobile": "18200932238",
"status": 1,
"deptId": null,
"deptName": null,
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"userId": 3,
"username": "Kobe",
"password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
"salt": "YzcmCZNvbXocrsz9dm8e",
"email": "kobe@qq.com",
"mobile": "18200932238",
"status": 1,
"deptId": null,
"deptName": null,
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"userId": 4,
"username": "Iverson",
"password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
"salt": "YzcmCZNvbXocrsz9dm8e",
"email": "iverson@qq.com",
"mobile": "18200932238",
"status": 1,
"deptId": null,
"deptName": null,
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"userId": 110,
"username": "test",
"password": "123456",
"salt": "1312321321",
"email": "test@qq.com",
"mobile": "test2@qq.com",
"status": 0,
"deptId": 110,
"deptName": null,
"createBy": 0,
"createTime": "2018-09-01T05:40:23.000+0000",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:40:23.000+0000",
"delFlag": 0
}
]
}
}
根据用户查询
请求URL: /user/findByUserName
请求类型: get
请求参数:
{
"userName": "admin"
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"userId": 1,
"username": "admin",
"password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
"salt": "YzcmCZNvbXocrsz9dm8e",
"email": "admin@qq.com",
"mobile": "13612345678",
"status": 1,
"deptId": null,
"deptName": null,
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
}
}
更新密码
请求URL: /user/updatePassword
请求类型: get
请求参数:
{
"password ": "password ",
"newPassword ": "newPassword "
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
机构管理
保存
请求URL: /dept/save
请求类型: post
请求参数:
{
"children": [
null
],
"createBy": 0,
"createTime": "2018-09-01T05:34:44.618Z",
"delFlag": 0,
"deptId": 110,
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:34:44.618Z",
"name": "110",
"orderNum": 0,
"parentId": 0
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
修改
请求URL: /dept/update
请求类型: post
请求参数:
{
"deptId": 110,
"name": "upate"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
删除
请求URL: /dept/delete
请求类型: post
请求参数:
{
"deptId": 110
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
查询机构树
请求URL: /dept/findTree
请求类型: get
请求参数:
{
}
请求结果:
{
"code": 200,
"msg": null,
"data": [
{
"deptId": 1,
"parentId": 0,
"name": "轻尘集团",
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"deptId": 2,
"parentId": 1,
"name": "北京分公司",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 3,
"parentId": 1,
"name": "上海分公司",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"deptId": 4,
"parentId": 3,
"name": "技术部",
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 6,
"parentId": 3,
"name": "宣传部",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 7,
"parentId": 3,
"name": "销售部",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 8,
"parentId": 3,
"name": "市场部",
"orderNum": 3,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
}
]
},
{
"deptId": 9,
"parentId": 0,
"name": "牧尘集团",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"deptId": 10,
"parentId": 9,
"name": "北京分公司",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"deptId": 12,
"parentId": 10,
"name": "技术部",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 13,
"parentId": 10,
"name": "宣传部",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"deptId": 11,
"parentId": 9,
"name": "上海分公司",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"deptId": 14,
"parentId": 11,
"name": "销售部",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"deptId": 15,
"parentId": 11,
"name": "市场部",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
}
]
}
]
}
角色管理
保存
请求URL: /role/save
请求类型: post
请求参数:
{
"createBy": 0,
"createTime": "2018-09-01T05:54:31.748Z",
"delFlag": 0,
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:54:31.748Z",
"remark": "string",
"roleId": 110,
"roleName": "110"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
修改
请求URL: /role/update
请求类型: post
请求参数:
{
"remark": "1101111",
"roleId": 110,
"roleName": "1101"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
删除
请求URL: /role/delete
请求类型: post
请求参数:
{
"roleId": 110
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
分页查询
请求URL: /role/findPage
请求类型: post
请求参数:
{
"pageNum": 1,
"pageSize": 5
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"pageNum": 1,
"pageSize": 5,
"totalSize": 4,
"totalPages": 1,
"content": [
{
"roleId": 1,
"roleName": "admin",
"remark": "超级管理员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 2,
"roleName": "dev",
"remark": "开发人员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 3,
"roleName": "test",
"remark": "测试人员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 110,
"roleName": "1101",
"remark": "1101111",
"createBy": 0,
"createTime": "2018-09-01T05:54:32.000+0000",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:54:32.000+0000",
"delFlag": 0
}
]
}
}
查询全部
请求URL: /role/findAll
请求类型: get
请求参数:
{ }
请求结果:
{
"code": 200,
"msg": null,
"data": [
{
"roleId": 1,
"roleName": "admin",
"remark": "超级管理员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 2,
"roleName": "dev",
"remark": "开发人员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 3,
"roleName": "test",
"remark": "测试人员",
"createBy": null,
"createTime": "2018-08-14T03:11:11.000+0000",
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0
},
{
"roleId": 110,
"roleName": "1101",
"remark": "1101111",
"createBy": 0,
"createTime": "2018-09-01T05:54:32.000+0000",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T05:54:32.000+0000",
"delFlag": 0
}
]
}
菜单管理
保存
请求URL: /menu/save
请求类型: post
请求参数:
{
"createBy": 0,
"createTime": "2018-09-01T06:01:47.825Z",
"delFlag": 0,
"icon": "string",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T06:01:47.825Z",
"menuId": 110,
"name": "110",
"orderNum": 0,
"parentId": 0,
"perms": "sys:menu:list",
"type": 0,
"url": "/sys/menu"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
修改
请求URL: /menu/update
请求类型: post
请求参数:
{
"menuId": 110,
"name": "1101"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
删除
请求URL: /menu/delete
请求类型: post
请求参数:
{
"menuId": 110
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
查询菜单树
请求URL: /menu/findTree
请求类型: get
请求参数:
{
}
请求结果:
{
"code": 200,
"msg": null,
"data": [
{
"menuId": 1,
"parentId": 0,
"name": "系统管理",
"url": null,
"perms": null,
"type": 0,
"icon": "fa el-icon-setting",
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 2,
"parentId": 1,
"name": "用户管理",
"url": "/sys/user",
"perms": null,
"type": 1,
"icon": "el-icon-service",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 9,
"parentId": 2,
"name": "查看",
"url": null,
"perms": "sys:user:view",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 10,
"parentId": 2,
"name": "新增",
"url": null,
"perms": "sys:user:save",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 11,
"parentId": 2,
"name": "修改",
"url": null,
"perms": "sys:user:update",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 12,
"parentId": 2,
"name": "删除",
"url": null,
"perms": "sys:user:delete",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 3,
"parentId": 1,
"name": "机构管理",
"url": "/sys/dept",
"perms": null,
"type": 1,
"icon": "el-icon-news",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 13,
"parentId": 3,
"name": "查看",
"url": null,
"perms": "sys:dept:view",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 14,
"parentId": 3,
"name": "新增",
"url": null,
"perms": "sys:dept:save",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 15,
"parentId": 3,
"name": "修改",
"url": null,
"perms": "sys:dept:update",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 16,
"parentId": 3,
"name": "删除",
"url": null,
"perms": "sys:dept:delete",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 4,
"parentId": 1,
"name": "角色管理",
"url": "/sys/role",
"perms": null,
"type": 1,
"icon": "el-icon-view",
"orderNum": 4,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 17,
"parentId": 4,
"name": "查看",
"url": null,
"perms": "sys:role:view",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 18,
"parentId": 4,
"name": "新增",
"url": null,
"perms": "sys:role:save",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 19,
"parentId": 4,
"name": "修改",
"url": null,
"perms": "sys:role:update",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 20,
"parentId": 4,
"name": "删除",
"url": null,
"perms": "sys:role:delete",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 5,
"parentId": 1,
"name": "菜单管理",
"url": "/sys/menu",
"perms": null,
"type": 1,
"icon": "el-icon-menu",
"orderNum": 5,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 21,
"parentId": 5,
"name": "查看",
"url": null,
"perms": "sys:menu:view",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 22,
"parentId": 5,
"name": "新增",
"url": null,
"perms": "sys:menu:save",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 23,
"parentId": 5,
"name": "修改",
"url": null,
"perms": "sys:menu:update",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 24,
"parentId": 5,
"name": "删除",
"url": null,
"perms": "sys:menu:delete",
"type": 2,
"icon": null,
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 6,
"parentId": 1,
"name": "SQL监控",
"url": "/druid/sql",
"perms": null,
"type": 1,
"icon": "el-icon-info",
"orderNum": 6,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 8,
"parentId": 1,
"name": "系统日志",
"url": "/sys/log",
"perms": "sys:log:list",
"type": 1,
"icon": "el-icon-info",
"orderNum": 7,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 25,
"parentId": 0,
"name": "内容管理",
"url": null,
"perms": null,
"type": 0,
"icon": "el-icon-document",
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 26,
"parentId": 25,
"name": "栏目管理",
"url": "/content/category",
"perms": null,
"type": 1,
"icon": "el-icon-tickets",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 27,
"parentId": 25,
"name": "文章管理",
"url": "/content/artical",
"perms": null,
"type": 1,
"icon": "el-icon-tickets",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
},
{
"menuId": 28,
"parentId": 0,
"name": "使用案例",
"url": null,
"perms": null,
"type": 0,
"icon": "el-icon-picture-outline",
"orderNum": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": [
{
"menuId": 29,
"parentId": 28,
"name": "国际化",
"url": "/demo/i18n",
"perms": null,
"type": 1,
"icon": "el-icon-edit",
"orderNum": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
},
{
"menuId": 30,
"parentId": 28,
"name": "换皮肤",
"url": "/demo/theme",
"perms": null,
"type": 1,
"icon": "el-icon-picture",
"orderNum": 2,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"delFlag": 0,
"children": []
}
]
}
]
}
字典管理
保存
请求URL: /dict/save
请求类型: post
请求参数:
{
"createBy": 0,
"createTime": "2018-09-01T06:05:44.794Z",
"delFlag": 0,
"description": "aaaa",
"id": 110,
"label": "aa",
"lastUpdateBy": 0,
"lastUpdateTime": "2018-09-01T06:05:44.794Z",
"remarks": "aaaaaa",
"sort": 0,
"type": "a",
"value": "aaaaa"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
修改
请求URL: /dict/update
请求类型: post
请求参数:
{
"description": "bbbb",
"id": 110,
"label": "bbbb"
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
删除
请求URL: /dict/delete
请求类型: post
请求参数:
{
"id": 110
}
请求结果:
{
"code": 200,
"msg": null,
"data": 1
}
分页查询
请求URL: /dict/findPage
请求类型: get
请求参数:
{
"pageNum": 1,
"pageSize": 5
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"pageNum": 1,
"pageSize": 5,
"totalSize": 2,
"totalPages": 1,
"content": [
{
"id": 1,
"value": "male",
"label": "男",
"type": "sex",
"description": "男性",
"sort": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"remarks": null,
"delFlag": 0
},
{
"id": 2,
"value": "female",
"label": "女",
"type": "sex",
"description": "女性",
"sort": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"remarks": null,
"delFlag": 0
}
]
}
}
日志管理
分页查询
请求URL: /log/findPage
请求类型: get
请求参数:
{
"pageNum": 1,
"pageSize": 5
}
请求结果:
{
"code": 200,
"msg": null,
"data": {
"pageNum": 1,
"pageSize": 5,
"totalSize": 2,
"totalPages": 1,
"content": [
{
"id": 1,
"value": "male",
"label": "男",
"type": "sex",
"description": "男性",
"sort": 0,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"remarks": null,
"delFlag": 0
},
{
"id": 2,
"value": "female",
"label": "女",
"type": "sex",
"description": "女性",
"sort": 1,
"createBy": null,
"createTime": null,
"lastUpdateBy": null,
"lastUpdateTime": null,
"remarks": null,
"delFlag": 0
}
]
}
}
好了,后续前台页面需要调用相关接口的时候,就可以用上面的格式进行 mock 模拟了。
源码下载
后端:https://gitee.com/liuge1988/kitty
前端:https://gitee.com/liuge1988/kitty-ui.git
作者:朝雨忆轻尘
出处:https://www.cnblogs.com/xifengxiaoma/
版权所有,欢迎转载,转载请注明原文作者及出处。
Vue + Element UI 实现权限管理系统 前端篇(九):接口格式定义的更多相关文章
- Vue + Element UI 实现权限管理系统 前端篇(十三):页面权限控制
权限控制方案 既然是后台权限管理系统,当然少不了权限控制啦,至于权限控制,前端方面当然就是对页面资源的访问和操作控制啦. 前端资源权限主要又分为两个部分,即导航菜单的查看权限和页面增删改操作按钮的操作 ...
- Vue + Element UI 实现权限管理系统 前端篇(十一):第三方图标库
使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...
- Vue + Element UI 实现权限管理系统 前端篇(一):搭建开发环境
技术基础 开发之前,请先熟悉下面的4个文档 vue.js2.0中文, 优秀的JS框架 vue-router, vue.js 配套路由 vuex,vue.js 应用状态管理库 Element,饿了么提供 ...
- Vue + Element UI 实现权限管理系统 前端篇(十六):系统备份还原
系统备份还原 在很多时候,我们需要系统数据进行备份还原.我们这里就使用MySql的备份还原命令实现系统备份还原的功能. 后台接口准备 系统备份还原是对数据库的备份还原,所以必须有后台接口的支持,我们准 ...
- Vue + Element UI 实现权限管理系统 前端篇(十二):用户管理模块
用户管理模块 添加接口 在 http/moduls/user.js 中添加用户管理相关接口. import axios from '../axios' /* * 用户管理模块 */ // 保存 exp ...
- Vue + Element UI 实现权限管理系统 前端篇(十):动态加载菜单
动态加载菜单 之前我们的导航树都是写死在页面里的,而实际应用中是需要从后台服务器获取菜单数据之后动态生成的. 我们在这里就用上一篇准备好的数据格式Mock出模拟数据,然后动态生成我们的导航菜单. 接口 ...
- Vue + Element UI 实现权限管理系统 前端篇(八):管理应用状态
使用 Vuex 管理应用状态 1. 引入背景 像先前我们是有导航菜单栏收缩和展开功能的,但是因为组件封装的原因,隐藏按钮在头部组件,而导航菜单在导航菜单组件,这样就涉及到了组件收缩状态的共享问题.收缩 ...
- Vue + Element UI 实现权限管理系统 前端篇(四):优化登录流程
完善登录流程 1. 丰富登录界面 1.1 从 Element 指南中选择组件模板丰富登录界面,放置一个登录界面表单,包含账号密码输入框和登录重置按钮. <template> <el- ...
- Vue + Element UI 实现权限管理系统 前端篇(二):Vue + Element 案例
导入项目 打开 Visual Studio Code,File --> add Folder to Workspace,导入我们的项目. 安装 Element 安装依赖 Element 是国内饿 ...
随机推荐
- mysql查询 根据年月日的查询
select * from call_loan_info where DATE_FORMAT(create_time,'%Y-%m-%d') = '2017-06-16'
- 20169207《Linux内核原理与分析》第三周作业
这周主要对于以往的知识进行了复习,包括开始的Linux基础,以及对需要学习的新知识进行了复习,也对markdown的语法进行了初步的了解.开始学习markdown的一些基本语法和Linux的一些常用命 ...
- UIImageView的frame设置(4种方式)
查看图片宽高后,再去设置UIImageView的frame.(不推荐) 用代码自动获取图片的宽高来设置UIImageView的frame: 创建UIImageView的同时,直接设置UIImageVi ...
- Vue的配置
一.build:打包的配置文件的文件夹 1.build.js 生产版本的配置文件,一般这个文件我们是不改的 'use strict' //调用检查版本的文件,check-versions的导出直接是 ...
- Git 安装 windows && linux
一.安装: windows下安装Git: 1.下载Git:https://git-scm.com/download/win 2.安装Git:默认安装,一直回车 Linux下安装Git: yum安装: ...
- 微擎 人人商城 merchant.php源码
<?php define('IN_SYS', true); require '../framework/bootstrap.inc.php'; load()->web('common'); ...
- 分形之谢尔宾斯基(Sierpinski)三角形
谢尔宾斯基三角形(英语:Sierpinski triangle)是一种分形,由波兰数学家谢尔宾斯基在1915年提出,它是一种典型的自相似集.也有的资料将其称之为谢尔宾斯基坟垛. 其生成过程为: 取一个 ...
- python使用httplib2访问REST服务的例子
首先你需要安装httplib2,这个可以在github上找到: 然后你需要获得一个http连接的对象: con = httplib2.Http() 然后你需要发起连接: (6)resp, (5)c ...
- 为什么在UDP包中不能获取发包方的地址
首先,我们要先了解一下UDP包的结构. 图1 UDP报文格式 从图1,我们可以看出,从UDP包中,我们可以获取的信息只有源端口和目的地端口.我们不能获取到源IP因为报文中没有源IP.真正包含IP地址的 ...
- 你所不知道的ASP.NET Core MVC/WebApi基础系列 (二)
转自博客:https://www.cnblogs.com/CreateMyself/p/10604293.html 前言 本节内容,我们来讲讲.NET Core当中的模型绑定系统.模型绑定原理.自定义 ...