profile.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import request from '@/config/axios'
  2. export interface ProfileVO {
  3. id: number
  4. username: string
  5. nickname: string
  6. dept: {
  7. id: number
  8. name: string
  9. }
  10. roles: {
  11. id: number
  12. name: string
  13. }[]
  14. posts: {
  15. id: number
  16. name: string
  17. }[]
  18. socialUsers: {
  19. type: number
  20. openid: string
  21. }[]
  22. email: string
  23. mobile: string
  24. sex: number
  25. avatar: string
  26. status: number
  27. remark: string
  28. loginIp: string
  29. loginDate: Date
  30. createTime: Date
  31. }
  32. export interface UserProfileUpdateReqVO {
  33. nickname: string
  34. email: string
  35. mobile: string
  36. sex: number
  37. }
  38. // 查询用户个人信息
  39. export const getUserProfile = () => {
  40. return request.get({ url: '/system/user/profile/get' })
  41. }
  42. // 修改用户个人信息
  43. export const updateUserProfile = (data: UserProfileUpdateReqVO) => {
  44. return request.put({ url: '/system/user/profile/update', data })
  45. }
  46. // 用户密码重置
  47. export const updateUserPassword = (oldPassword: string, newPassword: string) => {
  48. return request.put({
  49. url: '/system/user/profile/update-password',
  50. data: {
  51. oldPassword: oldPassword,
  52. newPassword: newPassword
  53. }
  54. })
  55. }
  56. // 用户头像上传
  57. export const uploadAvatar = (data) => {
  58. return request.upload({ url: '/system/user/profile/update-avatar', data: data })
  59. }