1
0

api.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import { request } from 'umi';
  4. /** 获取当前的用户信息 */
  5. export async function currentUser(param: any) {
  6. return request<{
  7. user_name: any;
  8. data: API.CurrentUser;
  9. }>('/web/v1/users/current', {
  10. method: 'GET',
  11. headers: { Authorization: param },
  12. });
  13. }
  14. /** 退出登录接口 POST */
  15. export async function outLogin(options?: { [key: string]: any }) {
  16. return request<Record<string, any>>('/web/v1/login/exit', {
  17. method: 'POST',
  18. ...(options || {}),
  19. });
  20. }
  21. /** 登录接口 POST */
  22. export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  23. return request<API.LoginResult>('/web/v1/login', {
  24. method: 'POST',
  25. headers: {
  26. 'Content-Type': 'application/json',
  27. },
  28. data: body,
  29. ...(options || {}),
  30. });
  31. }
  32. /**
  33. * 修改密码
  34. * @param params
  35. */
  36. export async function updatePwd(params: any) {
  37. return request('/web/v1/login/password', {
  38. method: 'PUT',
  39. data: params,
  40. });
  41. }
  42. /** 此处后端没有提供注释 GET /api/notices */
  43. export async function getNotices(options?: { [key: string]: any }) {
  44. return request<API.NoticeIconList>('/api/notices', {
  45. method: 'GET',
  46. ...(options || {}),
  47. });
  48. }
  49. /** 获取规则列表 GET /api/rule */
  50. export async function rule(
  51. params: {
  52. // query
  53. /** 当前的页码 */
  54. current?: number;
  55. /** 页面的容量 */
  56. pageSize?: number;
  57. },
  58. options?: { [key: string]: any },
  59. ) {
  60. return request<API.RuleList>('/api/rule', {
  61. method: 'GET',
  62. params: {
  63. ...params,
  64. },
  65. ...(options || {}),
  66. });
  67. }
  68. /** 新建规则 PUT /api/rule */
  69. export async function updateRule(options?: { [key: string]: any }) {
  70. return request<API.RuleListItem>('/api/rule', {
  71. method: 'PUT',
  72. ...(options || {}),
  73. });
  74. }
  75. /** 新建规则 POST /api/rule */
  76. export async function addRule(options?: { [key: string]: any }) {
  77. return request<API.RuleListItem>('/api/rule', {
  78. method: 'POST',
  79. ...(options || {}),
  80. });
  81. }
  82. /** 删除规则 DELETE /api/rule */
  83. export async function removeRule(options?: { [key: string]: any }) {
  84. return request<Record<string, any>>('/api/rule', {
  85. method: 'DELETE',
  86. ...(options || {}),
  87. });
  88. }