profile.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. userNumber: string
  32. grade: string
  33. major: string
  34. supervisor: string
  35. masterType: string
  36. userType: string
  37. photoUrl: string
  38. }
  39. export interface UserProfileUpdateReqVO {
  40. nickname: string
  41. email: string
  42. mobile: string
  43. sex: number
  44. }
  45. // 查询用户个人信息
  46. export const getUserProfile = () => {
  47. return request.get({ url: '/system/user/profile/get' })
  48. }
  49. // const a = getUserProfile()
  50. // console.log('a',a);
  51. // 修改用户个人信息
  52. export const updateUserProfile = (data: UserProfileUpdateReqVO) => {
  53. return request.put({ url: '/system/user/profile/update', data })
  54. }
  55. // 用户密码重置
  56. export const updateUserPassword = (oldPassword: string, newPassword: string) => {
  57. return request.put({
  58. url: '/system/user/profile/update-password',
  59. data: {
  60. oldPassword: oldPassword,
  61. newPassword: newPassword
  62. }
  63. })
  64. }
  65. // 用户头像上传
  66. export const uploadAvatar = (data) => {
  67. return request.upload({ url: '/system/user/profile/update-avatar', data: data })
  68. }