section.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { CRequest } from "./request"
  2. import Global from "@/common/global"
  3. const proxyApi = Global.getIsDev ? '/api' : 'https://open.luojigou.vip/'
  4. /**
  5. * @description 列表查询学段-不包含禁用状态
  6. * @url /gamecontest/admin/semester/list
  7. *
  8. */
  9. export async function getSectionExcludState () {
  10. return CRequest<API.ResponseFormat>(`/gamecontest/admin/semester/list`, {
  11. method: "GET"
  12. })
  13. }
  14. /**
  15. * @description 创建学段
  16. * @url /gamecontest/admin/semester/save
  17. * @method post
  18. *
  19. */
  20. export async function addSection (
  21. params: {
  22. semesterName: string,
  23. semesterDescription: string
  24. },
  25. options?: any
  26. ) {
  27. return CRequest<API.ResponseFormat>(`/gamecontest/admin/semester/save`, {
  28. method: "POST",
  29. data: params,
  30. ...options
  31. })
  32. }
  33. /**
  34. * @description 更新学段
  35. * @url /gamecontest/admin/semester/update
  36. * @method put
  37. *
  38. */
  39. export async function updateSection (
  40. params: Partial<Pick<API.Section, "semesterName" | "semesterDescription" | "id">>,
  41. options?: any
  42. ) {
  43. return CRequest<API.ResponseFormat>(`/gamecontest/admin/semester/update`, {
  44. method: "PUT",
  45. data: params,
  46. ...options
  47. })
  48. }
  49. /**
  50. * @description 操作学段
  51. * @param status -1 删除 0 禁用 1 正常
  52. */
  53. export async function opSection (
  54. params: {
  55. id: string,
  56. status: API.SectionState
  57. },
  58. ) {
  59. return CRequest<API.ResponseFormat>(`/gamecontest/admin/semester/status`, {
  60. method: "PUT",
  61. params: params,
  62. })
  63. }