Browse Source

feat: 归档数据异常兼容

zhangjie 2 months ago
parent
commit
665349e73d
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/views/base/track-export/useDraw.ts

+ 6 - 5
src/views/base/track-export/useDraw.ts

@@ -236,7 +236,8 @@ export default function useDraw(drawConfig: DrawConfig) {
   async function getTaskData(studentId: string) {
     const res = await getStudentTrack(studentId);
     if (!res?.studentId) return;
-
+    const subjectiveQuestions = res.subjectiveQuestions || [];
+    const objectiveQuestions = res.objectiveQuestions || [];
     rawTask = {
       examId: res.examId,
       studentId: res.studentId,
@@ -250,14 +251,14 @@ export default function useDraw(drawConfig: DrawConfig) {
       objectiveScore: res.objectiveScore || 0,
       markerScore: (res.objectiveScore || 0) + (res.subjectiveScore || 0),
       sheetUrls: res.sheetUrls ? res.sheetUrls.map((item) => item.url) : [],
-      questionList: res.subjectiveQuestions,
+      questionList: subjectiveQuestions,
       sliceConfig: [],
       jsonUrl: '',
       markerTime: 0,
     };
     recogDatas = (res.sheetUrls || []).map((item) => item.recogData);
 
-    markAreas = res.subjectiveQuestions.map((item) => {
+    markAreas = subjectiveQuestions.map((item) => {
       return {
         mainNumber: item.mainNumber,
         subNumber: item.subNumber,
@@ -266,12 +267,12 @@ export default function useDraw(drawConfig: DrawConfig) {
       };
     });
 
-    hasMarkArea = res.subjectiveQuestions.some((item) => {
+    hasMarkArea = subjectiveQuestions.some((item) => {
       return item.picList?.length;
     });
 
     // 获取客观题选项信息
-    res.objectiveQuestions.forEach((item) => {
+    objectiveQuestions.forEach((item) => {
       answerMap[`${item.mainNumber}_${item.subNumber}`] = {
         answer: item.answer,
         totalScore: item.totalScore,