profile.ts 1.5 KB

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