|
@@ -21,6 +21,11 @@ watch(
|
|
async () => {
|
|
async () => {
|
|
const res = await updateStudentAnswerJSON();
|
|
const res = await updateStudentAnswerJSON();
|
|
const questions = res.data; // TODO: add type
|
|
const questions = res.data; // TODO: add type
|
|
|
|
+ for (const q of questions) {
|
|
|
|
+ if (q.answer && !Array.isArray(q.answer)) {
|
|
|
|
+ q.answer = [q.answer];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// TODO: 最好变成有结构的v-for渲染
|
|
// TODO: 最好变成有结构的v-for渲染
|
|
for (const q of questions) {
|
|
for (const q of questions) {
|
|
const questionBody = store.setting.subject.questions.find(
|
|
const questionBody = store.setting.subject.questions.find(
|
|
@@ -44,9 +49,14 @@ watch(
|
|
questionBody?.body && appendRichText(questionBody?.body);
|
|
questionBody?.body && appendRichText(questionBody?.body);
|
|
|
|
|
|
const studentAnswerNode = document.createElement("div");
|
|
const studentAnswerNode = document.createElement("div");
|
|
|
|
+ let tempNode = document.createElement("div");
|
|
|
|
+ for (const an of q.answer) {
|
|
|
|
+ // allAnswer += renderRichText(an);
|
|
|
|
+ tempNode.appendChild(renderRichText(an));
|
|
|
|
+ }
|
|
studentAnswerNode.innerHTML = `考生答案:(字数统计:${
|
|
studentAnswerNode.innerHTML = `考生答案:(字数统计:${
|
|
- renderRichText(q.answer)?.innerHTML?.length ?? 0
|
|
|
|
- })`;
|
|
|
|
|
|
+ tempNode?.innerText?.length ?? 0
|
|
|
|
+ })${tempNode?.innerHTML}`;
|
|
rendered.value.appendChild(studentAnswerNode);
|
|
rendered.value.appendChild(studentAnswerNode);
|
|
|
|
|
|
q.answer && appendRichText(q.answer);
|
|
q.answer && appendRichText(q.answer);
|
|
@@ -55,7 +65,15 @@ watch(
|
|
standardAnswerNode.innerHTML = `标准答案:`;
|
|
standardAnswerNode.innerHTML = `标准答案:`;
|
|
rendered.value.appendChild(standardAnswerNode);
|
|
rendered.value.appendChild(standardAnswerNode);
|
|
|
|
|
|
- questionBody?.answer && appendRichText(questionBody.answer);
|
|
|
|
|
|
+ // questionBody?.answer && appendRichText(questionBody.answer);
|
|
|
|
+ // console.log(questionBody.answer, renderRichText(questionBody.answer));
|
|
|
|
+ if (questionBody?.answer) {
|
|
|
|
+ // let allAnswer = "";
|
|
|
|
+ for (const an of questionBody?.answer) {
|
|
|
|
+ // allAnswer += renderRichText(an);
|
|
|
|
+ rendered.value.appendChild(renderRichText(an));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
const questionSeperatorNode = document.createElement("hr");
|
|
const questionSeperatorNode = document.createElement("hr");
|
|
questionSeperatorNode.style.margin = "20px";
|
|
questionSeperatorNode.style.margin = "20px";
|
|
@@ -75,3 +93,9 @@ hr {
|
|
margin: 20px;
|
|
margin: 20px;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|
|
|
|
+
|
|
|
|
+<style>
|
|
|
|
+.rich-text-question-container img.inline {
|
|
|
|
+ display: inline;
|
|
|
|
+}
|
|
|
|
+</style>
|