|
@@ -64,7 +64,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { getJSON } from "@/api/jsonMark";
|
|
|
+import { getStudentAnswerJSON } from "@/api/jsonMark";
|
|
|
import { store } from "@/store/store";
|
|
|
import { onUpdated, watch } from "vue";
|
|
|
import { renderRichText } from "@/utils/renderJSON";
|
|
@@ -78,13 +78,6 @@ const isSeePaper = route.name === "StudentTrack";
|
|
|
const showScore = (question: QuestionForRender) =>
|
|
|
route.name !== "Mark" && question.totalScore;
|
|
|
|
|
|
-interface StudentAnswer {
|
|
|
- mainNumber: number;
|
|
|
- subNumber: string;
|
|
|
- subIndex: string;
|
|
|
- answer: Array<RichTextJSON> | null;
|
|
|
-}
|
|
|
-
|
|
|
interface QuestionForRender {
|
|
|
unionOrder: string;
|
|
|
parentBody: RichTextJSON | null;
|
|
@@ -99,7 +92,7 @@ interface QuestionForRender {
|
|
|
|
|
|
let questions: QuestionForRender[] = $ref([]);
|
|
|
async function updateStudentAnswerJSON() {
|
|
|
- return getJSON(store.currentTask?.jsonUrl as string);
|
|
|
+ return getStudentAnswerJSON(store.currentTask?.jsonUrl as string);
|
|
|
}
|
|
|
|
|
|
function getDomByRichTextJSON(rt: Array<RichTextJSON> | RichTextJSON | null) {
|
|
@@ -122,7 +115,7 @@ watch(
|
|
|
if (!store.currentTask?.jsonUrl) return;
|
|
|
const res = await updateStudentAnswerJSON();
|
|
|
|
|
|
- const stuAnswers: StudentAnswer[] = res.data;
|
|
|
+ const stuAnswers = res.data;
|
|
|
for (const ans of stuAnswers) {
|
|
|
if (ans.answer && !Array.isArray(ans.answer)) {
|
|
|
ans.answer = [ans.answer];
|
|
@@ -134,8 +127,8 @@ watch(
|
|
|
const questionForRender = {} as QuestionForRender;
|
|
|
|
|
|
const [mainNumber, subNumber] = questionBody.unionOrder.split("-");
|
|
|
- const stuAns: StudentAnswer = stuAnswers.find(
|
|
|
- (v: StudentAnswer) =>
|
|
|
+ const stuAns = stuAnswers.find(
|
|
|
+ (v) =>
|
|
|
questionBody.unionOrder ===
|
|
|
[v.mainNumber, v.subNumber, v.subIndex]
|
|
|
.filter((v) => typeof v !== "undefined")
|
|
@@ -172,8 +165,8 @@ watch(
|
|
|
);
|
|
|
if (!questionBody) continue;
|
|
|
|
|
|
- const stuAns: StudentAnswer = stuAnswers.find(
|
|
|
- (v: StudentAnswer) =>
|
|
|
+ const stuAns = stuAnswers.find(
|
|
|
+ (v) =>
|
|
|
questionBody.unionOrder ===
|
|
|
[v.mainNumber, v.subNumber, v.subIndex]
|
|
|
.filter((v) => typeof v !== "undefined")
|