user.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import service from '@/utils/request'
  2. // @Summary 用户登录
  3. // @Produce application/json
  4. // @Param data body {username:"string",password:"string"}
  5. // @Router /base/login [post]
  6. export const login = (data) => {
  7. return service({
  8. url: '/base/login',
  9. method: 'post',
  10. data: data
  11. })
  12. }
  13. // @Summary 获取验证码
  14. // @Produce application/json
  15. // @Param data body {username:"string",password:"string"}
  16. // @Router /base/captcha [post]
  17. export const captcha = (data) => {
  18. return service({
  19. url: '/base/captcha',
  20. method: 'post',
  21. data: data
  22. })
  23. }
  24. // @Summary 用户注册
  25. // @Produce application/json
  26. // @Param data body {username:"string",password:"string"}
  27. // @Router /base/resige [post]
  28. export const register = (data) => {
  29. return service({
  30. url: '/user/register',
  31. method: 'post',
  32. data: data
  33. })
  34. }
  35. // @Summary 修改密码
  36. // @Produce application/json
  37. // @Param data body {username:"string",password:"string",newPassword:"string"}
  38. // @Router /user/changePassword [post]
  39. export const changePassword = (data) => {
  40. return service({
  41. url: '/user/changePassword',
  42. method: 'post',
  43. data: data
  44. })
  45. }
  46. // @Tags User
  47. // @Summary 分页获取用户列表
  48. // @Security ApiKeyAuth
  49. // @accept application/json
  50. // @Produce application/json
  51. // @Param data body modelInterface.PageInfo true "分页获取用户列表"
  52. // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
  53. // @Router /user/getUserList [post]
  54. export const getUserList = (data) => {
  55. return service({
  56. url: '/user/getUserList',
  57. method: 'post',
  58. data: data
  59. })
  60. }
  61. export const getUserPList = (data) => {
  62. return service({
  63. url: '/user/getUserPList',
  64. method: 'post',
  65. data: data
  66. })
  67. }
  68. export const getUserInfoById = (params) => {
  69. return service({
  70. url: '/user/getUserInfoById',
  71. method: 'get',
  72. params
  73. })
  74. }
  75. // @Tags User
  76. // @Summary 设置用户权限
  77. // @Security ApiKeyAuth
  78. // @accept application/json
  79. // @Produce application/json
  80. // @Param data body api.SetUserAuth true "设置用户权限"
  81. // @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}"
  82. // @Router /user/setUserAuthority [post]
  83. export const setUserAuthority = (data) => {
  84. return service({
  85. url: '/user/setUserAuthority',
  86. method: 'post',
  87. data: data
  88. })
  89. }
  90. // @Tags SysUser
  91. // @Summary 删除用户
  92. // @Security ApiKeyAuth
  93. // @accept application/json
  94. // @Produce application/json
  95. // @Param data body request.SetUserAuth true "删除用户"
  96. // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
  97. // @Router /user/deleteUser [delete]
  98. export const deleteUser = (data) => {
  99. return service({
  100. url: '/user/deleteUser',
  101. method: 'delete',
  102. data: data
  103. })
  104. }
  105. // @Tags SysUser
  106. // @Summary 设置用户信息
  107. // @Security ApiKeyAuth
  108. // @accept application/json
  109. // @Produce application/json
  110. // @Param data body model.SysUser true "设置用户信息"
  111. // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
  112. // @Router /user/setUserInfo [put]
  113. export const setUserInfo = (data) => {
  114. return service({
  115. url: '/user/setUserInfo',
  116. method: 'put',
  117. data: data
  118. })
  119. }
  120. // @Tags User
  121. // @Summary 设置用户权限
  122. // @Security ApiKeyAuth
  123. // @accept application/json
  124. // @Produce application/json
  125. // @Param data body api.setUserAuthorities true "设置用户权限"
  126. // @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}"
  127. // @Router /user/setUserAuthorities [post]
  128. export const setUserAuthorities = (data) => {
  129. return service({
  130. url: '/user/setUserAuthorities',
  131. method: 'post',
  132. data: data
  133. })
  134. }
  135. // @Tags User
  136. // @Summary 获取用户信息
  137. // @Security ApiKeyAuth
  138. // @accept application/json
  139. // @Produce application/json
  140. // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
  141. // @Router /user/getUserInfo [get]
  142. export const getUserInfo = () => {
  143. return service({
  144. url: '/user/getUserInfo',
  145. method: 'get'
  146. })
  147. }