feat: enriched certificate with template name, dimension scores, question details + Modal UI
- generateCertificate: return templateName, questionDetails, dimensionScores - Frontend: replace alert() with certificate Modal showing level, scores, dimensions, questions - Status label: change from '已验证' to '合格'
This commit is contained in:
@@ -1500,6 +1500,13 @@ const initialState: Partial<EvaluationState> = {
|
||||
const level = this.determineLevel(session.finalScore || 0);
|
||||
const qrCode = `cert://${sessionId}-${Date.now()}`;
|
||||
|
||||
const questionDetails = (session.questions_json || []).map((q: any, i: number) => ({
|
||||
index: i + 1,
|
||||
questionText: q.questionText?.substring(0, 100) || '',
|
||||
questionType: q.questionType || 'SHORT_ANSWER',
|
||||
dimension: q.dimension || '',
|
||||
}));
|
||||
|
||||
const certificate = this.certificateRepository.create({
|
||||
userId,
|
||||
sessionId,
|
||||
@@ -1512,7 +1519,13 @@ const initialState: Partial<EvaluationState> = {
|
||||
passed: (session as any).passed || false,
|
||||
});
|
||||
|
||||
return this.certificateRepository.save(certificate);
|
||||
const saved = await this.certificateRepository.save(certificate);
|
||||
return {
|
||||
...saved,
|
||||
templateName: session.template?.name || session.templateJson?.name || '-',
|
||||
userName: session.user?.displayName || session.user?.username || '',
|
||||
questionDetails,
|
||||
} as any;
|
||||
}
|
||||
|
||||
private determineLevel(score: number): string {
|
||||
|
||||
Reference in New Issue
Block a user