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. // @Summary 获取验证码
  14. // @Produce application/json
  15. // @Param data body {username:"string",password:"string"}
  16. // @Router /base/captcha [post]
  17. export const captcha = () => {
  18. return service({
  19. url: '/base/captcha',
  20. method: 'post'
  21. })
  22. }
  23. // @Summary 用户注册
  24. // @Produce application/json
  25. // @Param data body {username:"string",password:"string"}
  26. // @Router /base/resige [post]
  27. export const register = (data) => {
  28. return service({
  29. url: '/user/admin_register',
  30. method: 'post',
  31. data: data
  32. })
  33. }
  34. // @Summary 修改密码
  35. // @Produce application/json
  36. // @Param data body {username:"string",password:"string",newPassword:"string"}
  37. // @Router /user/changePassword [post]
  38. export const changePassword = (data) => {
  39. return service({
  40. url: '/user/changePassword',
  41. method: 'post',
  42. data: data
  43. })
  44. }
  45. // @Tags User
  46. // @Summary 分页获取用户列表
  47. // @Security ApiKeyAuth
  48. // @accept application/json
  49. // @Produce application/json
  50. // @Param data body modelInterface.PageInfo true "分页获取用户列表"
  51. // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
  52. // @Router /user/getUserList [post]
  53. export const getUserList = (data) => {
  54. return service({
  55. url: '/user/getUserList',
  56. method: 'post',
  57. data: data
  58. })
  59. }
  60. // @Tags User
  61. // @Summary 设置用户权限
  62. // @Security ApiKeyAuth
  63. // @accept application/json
  64. // @Produce application/json
  65. // @Param data body api.SetUserAuth true "设置用户权限"
  66. // @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}"
  67. // @Router /user/setUserAuthority [post]
  68. export const setUserAuthority = (data) => {
  69. return service({
  70. url: '/user/setUserAuthority',
  71. method: 'post',
  72. data: data
  73. })
  74. }
  75. // @Tags SysUser
  76. // @Summary 删除用户
  77. // @Security ApiKeyAuth
  78. // @accept application/json
  79. // @Produce application/json
  80. // @Param data body request.SetUserAuth true "删除用户"
  81. // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
  82. // @Router /user/deleteUser [delete]
  83. export const deleteUser = (data) => {
  84. return service({
  85. url: '/user/deleteUser',
  86. method: 'delete',
  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 model.SysUser true "设置用户信息"
  96. // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
  97. // @Router /user/setUserInfo [put]
  98. export const setUserInfo = (data) => {
  99. return service({
  100. url: '/user/setUserInfo',
  101. method: 'put',
  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/setSelfInfo [put]
  113. export const setSelfInfo = (data) => {
  114. return service({
  115. url: '/user/setSelfInfo',
  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. }
  148. export const resetPassword = (data) => {
  149. return service({
  150. url: '/user/resetPassword',
  151. method: 'post',
  152. data: data
  153. })
  154. }
  155. //返回公钥
  156. export const routerPublicKey = () => {
  157. return service({
  158. url: '/base/routerPublicKey',
  159. method: 'get'
  160. })
  161. }