liuyu
2 小时以前 82a74ba0402ab546ba524d23ce62198c4d00d2f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 });
}