login.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import { http } from '@/utils/http'
  2. const userGroupUrl = '/org/findAllOrgByPOrgNo'
  3. //注册方法
  4. const userRegisterUrl = '/system/registerUser'
  5. //登录方法
  6. const userLoginUrl = '/system/login'
  7. const loginTestUrl = '/system/getVersion'
  8. const homeUrl = ''
  9. const updatePasUrl = '/system/updatePassword'
  10. const getPositionUrl = '/param/findAllByType'
  11. const subLeaveUrl = '/leave/saveRecord'
  12. //请假列表
  13. const leaveRecordUrl = '/leave/findAllByCurrentUser'
  14. const updateLeaveUrl = '/leave/updateRecord'
  15. //首页API
  16. export const homeApi = (val: any) => {
  17. return http<any>(
  18. {
  19. method: 'post',
  20. url: homeUrl,
  21. data: { val }
  22. })
  23. }
  24. //getAPI
  25. export const userGroupApi = () => {
  26. return http<any>(
  27. {
  28. method: 'get',
  29. url: userGroupUrl
  30. })
  31. }
  32. //注册API
  33. export const userRegisterApi = (val: any) => {
  34. return http<any>(
  35. {
  36. method: 'post',
  37. url: userRegisterUrl,
  38. data: { ...val }
  39. })
  40. }
  41. //登录API
  42. export const userLoginApi = (val: any) => {
  43. return http<any>(
  44. {
  45. method: 'get',
  46. url: `${userLoginUrl}?userNo=${val.userNo}&password=${val.password}`,
  47. })
  48. }
  49. //修改密码
  50. export const updatePasApi = (val: any) => {
  51. return http<any>(
  52. {
  53. method: 'get',
  54. url: `${updatePasUrl}?oldPassword=${val.oldPassword}&password=${val.password}&userNo=${val.id}`,
  55. })
  56. }
  57. export const getPositionApi = () => {
  58. return http<any>(
  59. {
  60. method: 'get',
  61. url: `${getPositionUrl}?type=1`,
  62. })
  63. }
  64. //提交请假表单
  65. export const subLeaveApi = (val: any) => {
  66. return http<any>({
  67. method: 'post',
  68. url: subLeaveUrl,
  69. data: { ...val }
  70. })
  71. }
  72. //修改请假表单
  73. export const updateLeaveApi = (val: any) => {
  74. return http<any>({
  75. method: 'post',
  76. url: updateLeaveUrl,
  77. data: { ...val }
  78. })
  79. }
  80. //提交请假列表
  81. export const leaveRecordApi = (val: any) => {
  82. return http<any>({
  83. method: 'get',
  84. url: `${leaveRecordUrl}?pageNum=${val.pageNum}&pageSize=${val.pageSize}`,
  85. })
  86. }
  87. export const loginTestApi = () => {
  88. return http<any>({
  89. method: 'get',
  90. url: `${loginTestUrl}`,
  91. })
  92. }