|
@@ -67,6 +67,7 @@ import MarkPaperMarker from "./MarkPaperMarker.vue";
|
|
|
import MarkPaperStructure from "./MarkPaperStructure.vue";
|
|
|
// import paramData from "./paramData";
|
|
|
import { examStructureSubmit } from "../../api";
|
|
|
+import { cardDetail } from "../../../card/api";
|
|
|
import { calcSum } from "@/plugins/utils";
|
|
|
|
|
|
const STEPS_LIST = [
|
|
@@ -124,7 +125,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- visibleChange() {
|
|
|
+ async visibleChange() {
|
|
|
this.current = 0;
|
|
|
this.loading = false;
|
|
|
|
|
@@ -143,16 +144,140 @@ export default {
|
|
|
this.infos.paperStat = this.statPaperStructure(
|
|
|
this.infos.paperStructureInfo
|
|
|
);
|
|
|
- } else {
|
|
|
- this.infos = {
|
|
|
- paperStructureInfo: [],
|
|
|
- groupInfo: [],
|
|
|
- basicPaperInfo: { ...this.instance },
|
|
|
- paperStat: this.statPaperStructure([]),
|
|
|
- };
|
|
|
+ this.dataReady = true;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- this.dataReady = true;
|
|
|
+ const detData = await cardDetail(this.instance.cardId);
|
|
|
+ const cardContent = JSON.parse(detData.content);
|
|
|
+ this.infos = {
|
|
|
+ paperStructureInfo: this.parsePaperStructureFromCard(cardContent.pages),
|
|
|
+ groupInfo: [],
|
|
|
+ basicPaperInfo: { ...this.instance },
|
|
|
+ paperStat: this.statPaperStructure([]),
|
|
|
+ };
|
|
|
+ },
|
|
|
+ parsePaperStructureFromCard(pages) {
|
|
|
+ let structData = [];
|
|
|
+ let curTopicId = 0;
|
|
|
+ pages.forEach((page) => {
|
|
|
+ page.columns.forEach((column) => {
|
|
|
+ column.elements.forEach((topic) => {
|
|
|
+ if (!topic.parent) return;
|
|
|
+ if (curTopicId === topic.parent.id) return;
|
|
|
+
|
|
|
+ curTopicId = topic.parent.id;
|
|
|
+ let questionsCount = 1,
|
|
|
+ startNumber = 1;
|
|
|
+ if (topic.type === "COMPOSITION") {
|
|
|
+ // 相同大题号的作文题合并处理
|
|
|
+ const compositionData = structData.find(
|
|
|
+ (struct) =>
|
|
|
+ struct.cardTopicType === "COMPOSITION" &&
|
|
|
+ struct.mainNumber === topic.parent.topicNo * 1
|
|
|
+ );
|
|
|
+ if (compositionData) return;
|
|
|
+ } else {
|
|
|
+ questionsCount = topic.parent.questionsCount;
|
|
|
+ startNumber = topic.parent.startNumber || 1;
|
|
|
+ }
|
|
|
+ const typeInfo = this.getQuestionType(topic);
|
|
|
+ if (!typeInfo) return;
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ mainNumber: topic.parent.topicNo * 1,
|
|
|
+ mainTitle: topic.parent.topicName,
|
|
|
+ questionsCount,
|
|
|
+ startNumber,
|
|
|
+ cardTopicType: topic.type,
|
|
|
+ ...typeInfo,
|
|
|
+ };
|
|
|
+ if (topic.type === "FILL_QUESTION") {
|
|
|
+ data.optionCount = topic.optionCount;
|
|
|
+ }
|
|
|
+ structData.push(data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ let structure = [];
|
|
|
+ let mainIds = {};
|
|
|
+ structData.forEach((struct) => {
|
|
|
+ const { startNumber, questionCount, qType, mainNumber, mainTitle } =
|
|
|
+ struct;
|
|
|
+ if (!mainIds[mainNumber]) {
|
|
|
+ mainIds[mainNumber] = this.$randomCode();
|
|
|
+ }
|
|
|
+ for (let i = 0; i < questionCount; i++) {
|
|
|
+ structure.push({
|
|
|
+ id: this.$randomCode(),
|
|
|
+ qType,
|
|
|
+ mainId: mainIds[mainNumber],
|
|
|
+ mainTitle,
|
|
|
+ mainNumber,
|
|
|
+ subNumber: startNumber + i,
|
|
|
+ type: struct.type,
|
|
|
+ typeName: struct.typeName,
|
|
|
+ optionCount: struct.optionCount || null,
|
|
|
+ totalScore: undefined,
|
|
|
+ mainFirstSub: false,
|
|
|
+ expandSub: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ structure.sort(
|
|
|
+ (a, b) => a.mainNumber - b.mainNumber || a.subNumber - b.subNumber
|
|
|
+ );
|
|
|
+ let curMainId = null;
|
|
|
+ structData.forEach((item) => {
|
|
|
+ if (curMainId !== item.mainId) {
|
|
|
+ curMainId = item.mainId;
|
|
|
+ item.mainFirstSub = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return structure;
|
|
|
+ },
|
|
|
+ getQuestionType(topic) {
|
|
|
+ // const questionType = {
|
|
|
+ // 1: "SINGLE_ANSWER_QUESTION",
|
|
|
+ // 2: "MULTIPLE_ANSWER_QUESTION",
|
|
|
+ // 3: "BOOL_ANSWER_QUESTION",
|
|
|
+ // 4: "FILL_BLANK_QUESTION",
|
|
|
+ // 5: "TEXT_ANSWER_QUESTION",
|
|
|
+ // };
|
|
|
+ if (topic.type === "COMPOSITION" || topic.type === "EXPLAIN") {
|
|
|
+ return {
|
|
|
+ type: 5,
|
|
|
+ typeName: "解答题",
|
|
|
+ qType: "subjective",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (topic.type === "FILL_LINE") {
|
|
|
+ return {
|
|
|
+ type: 4,
|
|
|
+ typeName: "填空题",
|
|
|
+ qType: "subjective",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (topic.type === "FILL_QUESTION") {
|
|
|
+ if (topic.isBoolean)
|
|
|
+ return {
|
|
|
+ type: 3,
|
|
|
+ typeName: "判断题",
|
|
|
+ qType: "objective",
|
|
|
+ };
|
|
|
+ if (topic.isMultiply)
|
|
|
+ return {
|
|
|
+ type: 2,
|
|
|
+ typeName: "多选题",
|
|
|
+ qType: "objective",
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ type: 1,
|
|
|
+ typeName: "单选题",
|
|
|
+ qType: "objective",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return;
|
|
|
},
|
|
|
statPaperStructure(paperStructureInfo) {
|
|
|
const questionCount = paperStructureInfo.length;
|