Skip to content

Commit

Permalink
add: update user permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrettluo committed Jul 27, 2024
1 parent 02402ff commit 0df58bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/api/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const USER_LOGIN_URL = '/user/login'; // 用户登录
const ALL_USER_URL = '/user/allUsers'; // 全部用户信息
const USER_INFO_URL = '/user/getById'; // 根据用户id进行查询
const USER_UPDATE_URL = '/user/updateUser'; // 根据用户id进行更新
const ADMIN_UPDATE_USER_URL = '/auth/updateUserInfo'; // 管理员对用户进行更新,支持对权限进行更新
const USER_ADD_AVATAR_URL = '/user/auth/uploadUserAvatar'; // 用户增加头像
const USER_CHANGE_ROLE_URL = '/user/changeUserRole'; // 改变用户角色
const BLOCK_USER_URL = '/user/blockUser'; // 屏蔽/解除屏蔽用户
Expand Down Expand Up @@ -116,6 +117,7 @@ module.exports = {
ALL_USER_URL,
USER_INFO_URL,
USER_UPDATE_URL,
ADMIN_UPDATE_USER_URL,
USER_ADD_AVATAR_URL,
USER_CHANGE_ROLE_URL,
BLOCK_USER_URL,
Expand Down
5 changes: 5 additions & 0 deletions src/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ALL_USER_URL,
USER_INFO_URL,
USER_UPDATE_URL,
ADMIN_UPDATE_USER_URL,
USER_ADD_AVATAR_URL,
USER_CHANGE_ROLE_URL,
BLOCK_USER_URL,
Expand Down Expand Up @@ -46,6 +47,10 @@ export default {
return Put(USER_UPDATE_URL, params);
},

updateUserByAdmin: (params) => {
return Put(ADMIN_UPDATE_USER_URL, params);
},

addUserAvatar: (params) => {
return Post(USER_ADD_AVATAR_URL, params)
},
Expand Down
5 changes: 3 additions & 2 deletions src/views/users/EditUserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ export default {
mail: this.userInfo.mail,
male: this.userInfo.gender === 'male',
description: this.userInfo.desc,
birthtime: this.userInfo.date
birthtime: this.userInfo.date,
role: this.userInfo.permissionEnum
}
await UserRequest.updateUser(param).then(res => {
await UserRequest.updateUserByAdmin(param).then(res => {
if (res.code === 200) {
this.$Message.success("更新成功")
} else {
Expand Down

0 comments on commit 0df58bc

Please sign in to comment.