Browse Source

api change

Michael Wang 3 years ago
parent
commit
97b4e1c593
1 changed files with 8 additions and 7 deletions
  1. 8 7
      src/features/OnlineExam/Examing/setups/useInitExamData.ts

+ 8 - 7
src/features/OnlineExam/Examing/setups/useInitExamData.ts

@@ -7,6 +7,12 @@ type PRACTICE_TYPE = "IN_PRACTICE" | "NO_ANSWER";
 
 export async function initExamData(examId: number, examRecordDataId: number) {
   logger({ cnl: ["server", "local"], pgn: "答题页面", act: "before initData" });
+  const { courseName, courseCode } = (
+    await httpApp.post<{ courseName: string; courseCode: string }>(
+      "/api/ecs_oe_student/examControl/getCourseInfo/" + examRecordDataId,
+      { "axios-retry": { retries: 4 }, noErrorMessage: true }
+    )
+  ).data;
   const [
     { data: weixinAnswerEnabled },
     { data: faceCheckEnabled },
@@ -15,10 +21,9 @@ export async function initExamData(examId: number, examRecordDataId: number) {
     { data: exam },
     { data: paperStruct },
     { data: examQuestionListOrig },
-    { data: _courseName },
   ] = await Promise.all([
     httpApp.get<boolean>(
-      "/api/ecs_exam_work/exam/weixinAnswerEnabled/" + examId,
+      `/api/ecs_exam_work/exam/weixinAnswerEnabled/${examId}?courseCode=${courseCode}`,
       {
         "axios-retry": { retries: 4 },
         noErrorMessage: true,
@@ -56,12 +61,8 @@ export async function initExamData(examId: number, examRecordDataId: number) {
       "/api/ecs_oe_student/examQuestion/findExamQuestionList",
       { "axios-retry": { retries: 4 }, noErrorMessage: true }
     ),
-    httpApp.get<string>(
-      "/api/ecs_oe_student/examControl/courseName/" + examRecordDataId,
-      { "axios-retry": { retries: 4 }, noErrorMessage: true }
-    ),
   ]);
-  store.exam.courseName = _courseName;
+  store.exam.courseName = courseName;
 
   let examQuestionList = examQuestionListOrig;