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` }));
|
}
|