feat: 订单详情 & 问卷调查

This commit is contained in:
2025-09-10 16:56:24 +08:00
parent 8a1a2af1e9
commit d60445b850
31 changed files with 2054 additions and 723 deletions

View File

@@ -0,0 +1,73 @@
import httpService from "./httpService";
import type { ApiResponse } from "./httpService";
export interface AnswerResItem {
question_id: number;
answer_index: number;
question_title: string;
selected_option: string;
score: number;
}
export type AnswerItem = Pick<AnswerResItem, "question_id" | "answer_index">;
export interface Answers {
answers: AnswerItem[];
test_duration: number;
}
export interface QuestionItem {
id: number;
question_title: string;
question_content: string;
options: string[];
scores: number[];
}
export interface SubmitAnswerRes {
record_id: number;
total_score: number;
ntrp_level: string;
level_description: string;
answers: AnswerResItem[];
}
// 发布球局类
class EvaluateService {
async getEvaluateQuestions(): Promise<ApiResponse<QuestionItem[]>> {
return httpService.post("/ntrp/questions", {
showLoading: true,
});
}
async submitEvaluateAnswers({
answers,
}: Answers): Promise<ApiResponse<SubmitAnswerRes>> {
return httpService.post(
"/ntrp/submit",
{ answers },
{
showLoading: true,
},
);
}
async getHistoryNtrp(): Promise<ApiResponse<any>> {
return httpService.post("/ntrp/history", {
showLoading: true,
});
}
async getNtrpDetail(record_id: number): Promise<ApiResponse<any>> {
return httpService.post(
"/ntrp/detail",
{ record_id },
{
showLoading: true,
},
);
}
}
// 导出认证服务实例
export default new EvaluateService();