voluntary.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {ApiResponse, ApiResponseList} from "@/types";
  2. import flyio from "../flyio";
  3. import {SelectedUniversityMajor} from "@/types/study";
  4. import {EnrollRule, VoluntaryRecord, VoluntaryResult} from "@/types/voluntary";
  5. export function getRenderRules(params: SelectedUniversityMajor) {
  6. // 普通高中,EnrollRuleItem.readonly=true 取学考成绩
  7. return flyio.post('/voluntary/getRenderRules', params) as Promise<ApiResponseList<EnrollRule>>
  8. }
  9. export function getSkillRules(params: SelectedUniversityMajor) {
  10. // EnrollRule 需要返回文化+职业,但职业EnrollRule.details = []不需要返回字段规则
  11. return flyio.post('/voluntary/getSkillRules', params) as Promise<ApiResponseList<EnrollRule>>
  12. }
  13. export function postRenderRules(target: SelectedCollegeMajor, model: Record<string, any>) {
  14. return flyio.post('/voluntary/postRenderRules', {target, model}) as Promise<ApiResponse<VoluntaryResult>>
  15. }
  16. export function postSkillRules(target: SelectedUniversityMajor, model: Record<string, any>) {
  17. // VoluntaryResult.histories 不需要返回
  18. return flyio.post('/voluntary/postSkillRules', {target, model}) as Promise<ApiResponse<VoluntaryResult>>
  19. }
  20. export function getVoluntaryList(params) {
  21. // 此接口不分页,全部返回
  22. return flyio.get('/voluntary/getVoluntaryList') as Promise<ApiResponseList<VoluntaryRecord>>
  23. }
  24. export function addVoluntary(data: SelectedUniversityMajor) {
  25. // 注意合并,数量限制(1个院校6个?确认一下),
  26. return flyio.post('/voluntary/addVoluntary', data)
  27. }
  28. export function removeVoluntaryByUniversity(universityId) {
  29. // 删除院校下的所有 // SelectedUniversityMajor.universityId
  30. return flyio.post('/voluntary/removeVoluntaryByUniversity/' + universityId)
  31. }
  32. export function removeVoluntaryByMajor(majorId) {
  33. // 删除指定专业,注意合并 // SelectedUniversityMajor.majorId
  34. return flyio.post('/voluntary/removeVoluntaryByMajor/' + majorId)
  35. }
  36. export function sortVoluntaryByMajor(universityId, majorIdList: []) {
  37. // 按传入专业id顺序,保存专业排序优先级
  38. return flyio.post('/voluntary/sortVoluntaryByMajor', {universityId, majorIdList})
  39. }
  40. export function sortVoluntaryByUniversity(universityIdList: []) {
  41. // 按传入院校id顺序,保存排序优先级
  42. return flyio.post('/voluntary/sortVoluntaryByUniversity', {universityIdList})
  43. }