|
@@ -1,6 +1,9 @@
|
|
import { httpApp } from "@/plugins/axiosApp";
|
|
import { httpApp } from "@/plugins/axiosApp";
|
|
import { store } from "@/store/store";
|
|
import { store } from "@/store/store";
|
|
import { AudioPlayTime } from "@/types/student-client";
|
|
import { AudioPlayTime } from "@/types/student-client";
|
|
|
|
+import { doEnc } from "@/utils/encDec";
|
|
|
|
+import { MD5 } from "@/utils/md5";
|
|
|
|
+import { getKey } from "@/utils/utils";
|
|
|
|
|
|
function resetExamQuestionDirty() {
|
|
function resetExamQuestionDirty() {
|
|
store.exam.examQuestionList = store.exam.examQuestionList.map((eq) => {
|
|
store.exam.examQuestionList = store.exam.examQuestionList.map((eq) => {
|
|
@@ -34,10 +37,22 @@ export async function answerAllQuestions(
|
|
) as Answer;
|
|
) as Answer;
|
|
});
|
|
});
|
|
if (answers.length > 0) {
|
|
if (answers.length > 0) {
|
|
|
|
+ const timestamp = Date.now();
|
|
|
|
+ const rawStr = MD5(JSON.stringify(answers));
|
|
|
|
+
|
|
|
|
+ const key = getKey(timestamp);
|
|
|
|
+
|
|
|
|
+ const sign = doEnc(rawStr, key);
|
|
|
|
+
|
|
try {
|
|
try {
|
|
await httpApp.post(
|
|
await httpApp.post(
|
|
- "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
|
|
|
|
- answers
|
|
|
|
|
|
+ "/api/ecs_oe_student/examControl/submitQuestionAnswer",
|
|
|
|
+ { answers: JSON.stringify(answers), sign },
|
|
|
|
+ {
|
|
|
|
+ "axios-retry": { retries: 4 },
|
|
|
|
+ noErrorMessage: true,
|
|
|
|
+ headers: { timestamp },
|
|
|
|
+ }
|
|
);
|
|
);
|
|
resetExamQuestionDirty();
|
|
resetExamQuestionDirty();
|
|
} catch (error) {
|
|
} catch (error) {
|