base.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import axios from 'axios';
  2. import type {
  3. TeachingListPageParam,
  4. TeachingListPageRes,
  5. TeachingUpdateParams,
  6. AgentListPageParam,
  7. AgentListPageRes,
  8. AgentUpdateParams,
  9. RoomListPageParam,
  10. RoomListPageRes,
  11. RoomUpdateParams,
  12. } from './types/base';
  13. import { AbleParams } from './types/common';
  14. // 教学点管理
  15. // 教学点管理-查询
  16. export function teachingListPage(
  17. params: TeachingListPageParam
  18. ): Promise<TeachingListPageRes> {
  19. return axios.post('/api/admin/teaching/query', {}, { params });
  20. }
  21. // 教学点管理-新增编辑
  22. export function updateTeaching(
  23. datas: TeachingUpdateParams
  24. ): Promise<{ id: string }> {
  25. return axios.post('/api/admin/teaching/save', datas);
  26. }
  27. // 教学点管理-启用禁用
  28. export function ableTeaching(params: AbleParams): Promise<boolean> {
  29. return axios.post('/api/admin/teaching/enable', {}, { params });
  30. }
  31. // // 教学点管理-导入模板下载
  32. export function teachingTemplate(): Promise<Blob> {
  33. return axios.post(
  34. '/api/admin/teaching/template',
  35. {},
  36. {
  37. responseType: 'blob',
  38. }
  39. );
  40. }
  41. // 考点管理
  42. // 考点管理-查询
  43. export function agentListPage(
  44. params: AgentListPageParam
  45. ): Promise<AgentListPageRes> {
  46. return axios.post('/api/admin/agent/query', {}, { params });
  47. }
  48. // 考点管理-新增编辑
  49. export function updateAgent(datas: AgentUpdateParams): Promise<{ id: string }> {
  50. return axios.post('/api/admin/agent/save', datas);
  51. }
  52. // 考点管理-启用禁用
  53. export function ableAgent(params: AbleParams): Promise<boolean> {
  54. return axios.post('/api/admin/agent/enable', {}, { params });
  55. }
  56. // // 考点管理-导入模板下载
  57. export function agentTemplate(): Promise<Blob> {
  58. return axios.post(
  59. '/api/admin/agent/template',
  60. {},
  61. {
  62. responseType: 'blob',
  63. }
  64. );
  65. }
  66. // 考场管理
  67. // 考场管理-查询
  68. export function roomListPage(
  69. params: RoomListPageParam
  70. ): Promise<RoomListPageRes> {
  71. return axios.post('/api/admin/room/query', {}, { params });
  72. }
  73. // 考场管理-新增编辑
  74. export function updateRoom(datas: RoomUpdateParams): Promise<{ id: string }> {
  75. return axios.post('/api/admin/room/save', datas);
  76. }
  77. // 考场管理-启用禁用
  78. export function ableRoom(params: AbleParams): Promise<boolean> {
  79. return axios.post('/api/admin/room/enable', {}, { params });
  80. }
  81. // // 考场管理-导入模板下载
  82. export function roomTemplate(): Promise<Blob> {
  83. return axios.post(
  84. '/api/admin/room/template',
  85. {},
  86. {
  87. responseType: 'blob',
  88. }
  89. );
  90. }