import type { QuestionBankOption } from '#/views/x/tms/question/types';
|
import type { SelfTestPaper, SelfTestStartPayload } from '#/views/x/tms/selfTest/types';
|
|
import { defHttp } from '#/api/request';
|
import { getQuestionBanks } from '#/api/x/tms/question';
|
import { mockStartSelfTest } from '#/views/x/tms/selfTest/mock';
|
|
/** 后端未就绪前走 mock;联调后改为 false */
|
const USE_MOCK = true;
|
const prefix = '/api/tms/self-test';
|
|
export function getSelfTestBanks() {
|
return getQuestionBanks() as Promise<QuestionBankOption[]>;
|
}
|
|
export function startSelfTest(data: SelfTestStartPayload) {
|
if (USE_MOCK) return mockStartSelfTest(data);
|
return defHttp.post<SelfTestPaper>({ url: `${prefix}/start`, data });
|
}
|