Browse Source

voluntary api - define

abpcoder 6 ngày trước cách đây
mục cha
commit
ffa4b92ffc

+ 6 - 1
src/api/modules/university.ts

@@ -1,12 +1,17 @@
 import {ApiResponse, ApiResponseList} from "@/types";
 import flyio from "../flyio";
-import {University} from "@/types/university";
+import {University, UniversityTier} from "@/types/university";
 
 // 院校库 01 院校列表
 export function universityList(params: Record<string, any>) {
   return flyio.get('/front/university/list', params) as Promise<ApiResponseList<University>>
 }
 
+// 院校库 - 院校梯队
+export function universityListByTier() {
+  return flyio.get('/front/university/listByTierNoToken') as Promise<ApiResponseList<UniversityTier>>
+}
+
 /**
  * 获取院校列表
  * @param params 

+ 53 - 0
src/api/modules/voluntary.ts

@@ -0,0 +1,53 @@
+import {ApiResponse, ApiResponseList} from "@/types";
+import flyio from "../flyio";
+import {SelectedUniversityMajor} from "@/types/study";
+import {EnrollRule, VoluntaryRecord, VoluntaryResult} from "@/types/voluntary";
+
+export function getRenderRules(params: SelectedUniversityMajor) {
+    // 普通高中,EnrollRuleItem.readonly=true 取学考成绩
+    return flyio.post('/voluntary/getRenderRules', params) as Promise<ApiResponseList<EnrollRule>>
+}
+
+export function getSkillRules(params: SelectedUniversityMajor) {
+    // EnrollRule 需要返回文化+职业,但职业EnrollRule.details = []不需要返回字段规则
+    return flyio.post('/voluntary/getSkillRules', params) as Promise<ApiResponseList<EnrollRule>>
+}
+
+export function postRenderRules(target: SelectedCollegeMajor, model: Record<string, any>) {
+    return flyio.post('/voluntary/postRenderRules', {target, model}) as Promise<ApiResponse<VoluntaryResult>>
+}
+
+export function postSkillRules(target: SelectedUniversityMajor, model: Record<string, any>) {
+    // VoluntaryResult.histories 不需要返回
+    return flyio.post('/voluntary/postSkillRules', {target, model}) as Promise<ApiResponse<VoluntaryResult>>
+}
+
+export function getVoluntaryList(params) {
+    // 此接口不分页,全部返回
+    return flyio.get('/voluntary/getVoluntaryList') as Promise<ApiResponseList<VoluntaryRecord>>
+}
+
+export function addVoluntary(data: SelectedUniversityMajor) {
+    // 注意合并,数量限制(1个院校6个?确认一下),
+    return flyio.post('/voluntary/addVoluntary', data)
+}
+
+export function removeVoluntaryByUniversity(universityId) {
+    // 删除院校下的所有 // SelectedUniversityMajor.universityId
+    return flyio.post('/voluntary/removeVoluntaryByUniversity/' + universityId)
+}
+
+export function removeVoluntaryByMajor(majorId) {
+    // 删除指定专业,注意合并 // SelectedUniversityMajor.majorId
+    return flyio.post('/voluntary/removeVoluntaryByMajor/' + majorId)
+}
+
+export function sortVoluntaryByMajor(universityId, majorIdList: []) {
+    // 按传入专业id顺序,保存专业排序优先级
+    return flyio.post('/voluntary/sortVoluntaryByMajor', {universityId, majorIdList})
+}
+
+export function sortVoluntaryByUniversity(universityIdList: []) {
+    // 按传入院校id顺序,保存排序优先级
+    return flyio.post('/voluntary/sortVoluntaryByUniversity', {universityIdList})
+}

+ 2 - 1
src/types/study.ts

@@ -348,9 +348,10 @@ export interface SelectedUniversityMajor {
   universityLogo: string;
   universityId: string;
   universityName: string;
-  majorId: string;
+  majorId: string; // 计划ID,可确保唯一性
   majorName: string;
   majorAncestors: string;
+  majorGroup: string;
 }
 
 export interface SimulationTestOptions {

+ 7 - 0
src/types/university.ts

@@ -28,4 +28,11 @@ export interface UniversityQueryDto {
     location: string[] | null;
     level: string[] | null;
     tier: string[] | null;
+}
+
+export interface UniversityTier {
+    typeName: string;
+    typeValue: string|number;
+    desc: string;
+    list: University[];
 }