刘光辉
119 分钟以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { defHttp } from '#/api/request';
 
/** 正式路径:/api/tms/trainer/** */
const prefix = '/api/tms/trainer';
 
export interface TrainerOption {
  /** 系统用户ID(任务 teacherId) */
  id: string;
  archiveId?: string;
  archiveNo?: string;
  fullName: string;
}
 
async function unwrapData<T>(promise: Promise<any>): Promise<T> {
  const res = await promise;
  if (res && typeof res === 'object' && 'data' in res && ('code' in res || 'msg' in res)) {
    return res.data as T;
  }
  return res as T;
}
 
/** 有效培训师(来自培训师管理 / tms_trainer) */
export function getTrainerOptions() {
  return unwrapData<TrainerOption[]>(defHttp.get({ url: `${prefix}/options` }));
}