user.js 4.3 KB

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