|
@@ -23,7 +23,6 @@ export default {
|
|
|
"FILL_QUESTION",
|
|
|
"FILL_LINE",
|
|
|
"EXPLAIN",
|
|
|
- "COMPOSITION",
|
|
|
],
|
|
|
};
|
|
|
},
|
|
@@ -51,19 +50,15 @@ export default {
|
|
|
fill_area: [],
|
|
|
answer_area: [],
|
|
|
};
|
|
|
- const elements = [
|
|
|
- page.globals,
|
|
|
- ...page.columns.map((column) => column.elements),
|
|
|
- ];
|
|
|
|
|
|
- elements.forEach((elemGroup) => {
|
|
|
- elemGroup.forEach((element) => {
|
|
|
+ page.columns.forEach((column) => {
|
|
|
+ column.elements.forEach((element) => {
|
|
|
if (this.VALID_ELEMENTS_FOR_EXTERNAL.includes(element.type)) {
|
|
|
const funcName = this.getElementHumpName(element.type);
|
|
|
console.log(funcName);
|
|
|
const info = this[`get${funcName}Info`](element);
|
|
|
Object.entries(info).forEach(([key, vals]) => {
|
|
|
- exchange[key] = exchange[key].concat(vals);
|
|
|
+ exchange[key] = [...exchange[key], ...vals];
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -122,44 +117,10 @@ export default {
|
|
|
const headArea = this.getOffsetInfo(dom);
|
|
|
let fill_area = [];
|
|
|
let barcode = [];
|
|
|
- // 学生考号
|
|
|
- if (element.examNumberStyle === "FILL") {
|
|
|
- // fill_area
|
|
|
- let listInfos = [];
|
|
|
- dom
|
|
|
- .querySelectorAll(".stdno-fill-list")
|
|
|
- .forEach((questionItem, questionIndex) => {
|
|
|
- let options = [];
|
|
|
- questionItem.childNodes.forEach((optionItem, optionIndex) => {
|
|
|
- options[optionIndex] = this.getOffsetInfo(optionItem);
|
|
|
- });
|
|
|
- listInfos[questionIndex] = {
|
|
|
- main_number: null,
|
|
|
- sub_number: null,
|
|
|
- options,
|
|
|
- };
|
|
|
- });
|
|
|
|
|
|
- fill_area.push({
|
|
|
- field: "examNumber",
|
|
|
- index: this.getFillAreaIndex("examNumber"),
|
|
|
- single: true,
|
|
|
- horizontal: false,
|
|
|
- items: listInfos,
|
|
|
- });
|
|
|
- } else {
|
|
|
- // barcode
|
|
|
- const stdnoDom =
|
|
|
- element.columnNumber <= 2
|
|
|
- ? dom.querySelector(".head-stdno").parentNode
|
|
|
- : dom.querySelector(".head-stdno");
|
|
|
- barcode.push({
|
|
|
- field: "examNumber",
|
|
|
- area: this.getOffsetInfo(stdnoDom),
|
|
|
- });
|
|
|
- }
|
|
|
// 缺考涂填
|
|
|
- if (element.examAbsent && !element.isSimple) {
|
|
|
+ // 研究生题卡没有缺考填涂
|
|
|
+ if (element.examAbsent) {
|
|
|
fill_area.push({
|
|
|
field: "absent",
|
|
|
index: this.getFillAreaIndex("absent"),
|
|
@@ -178,40 +139,6 @@ export default {
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
- // A/B卷类型
|
|
|
- if (element.aOrB && !element.isSimple) {
|
|
|
- if (element.paperType === "PRINT") {
|
|
|
- // barcode
|
|
|
- barcode.push({
|
|
|
- field: "paperType",
|
|
|
- area: this.getOffsetInfo(
|
|
|
- document.getElementById("dynamic-aorb-barcode")
|
|
|
- ),
|
|
|
- });
|
|
|
- } else {
|
|
|
- // fill_area
|
|
|
- let options = [];
|
|
|
- document
|
|
|
- .getElementById("head-dynamic-aorb")
|
|
|
- .querySelectorAll(".head-dynamic-rect")
|
|
|
- .forEach((optionItem, optionIndex) => {
|
|
|
- options[optionIndex] = this.getOffsetInfo(optionItem);
|
|
|
- });
|
|
|
- fill_area.push({
|
|
|
- field: "paperType",
|
|
|
- index: this.getFillAreaIndex("paperType"),
|
|
|
- single: true,
|
|
|
- horizontal: true,
|
|
|
- items: [
|
|
|
- {
|
|
|
- main_number: null,
|
|
|
- sub_number: null,
|
|
|
- options,
|
|
|
- },
|
|
|
- ],
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
return {
|
|
|
info_area: [headArea],
|
|
@@ -222,7 +149,7 @@ export default {
|
|
|
getFillQuestionInfo(element) {
|
|
|
const dom = this.getPreviewElementById(element.id);
|
|
|
const single = !element.isMultiply;
|
|
|
- const horizontal = element.optionDirection === "horizontal";
|
|
|
+ const paperStruct = element.parent.paperStruct;
|
|
|
|
|
|
let fillAreas = [];
|
|
|
dom.querySelectorAll(".group-item").forEach((groupItem) => {
|
|
@@ -236,17 +163,25 @@ export default {
|
|
|
if (optionIndex)
|
|
|
options[optionIndex - 1] = this.getOffsetInfo(optionItem);
|
|
|
});
|
|
|
- listInfos[questionIndex] = {
|
|
|
- main_number: element.topicNo,
|
|
|
+
|
|
|
+ let info = {
|
|
|
+ main_number: paperStruct.detailNo,
|
|
|
sub_number: questionItem.firstChild.textContent * 1,
|
|
|
options,
|
|
|
};
|
|
|
+ if (!paperStruct.isCommon) {
|
|
|
+ info.sub_number = paperStruct.nestedQNo;
|
|
|
+ info.subsub_number = questionItem.firstChild.textContent * 1;
|
|
|
+ }
|
|
|
+ // TODO:结构有变动
|
|
|
+
|
|
|
+ listInfos[questionIndex] = info;
|
|
|
});
|
|
|
fillAreas.push({
|
|
|
field: "question",
|
|
|
index: this.getFillAreaIndex("question"),
|
|
|
single,
|
|
|
- horizontal,
|
|
|
+ horizontal: true,
|
|
|
items: listInfos,
|
|
|
});
|
|
|
});
|
|
@@ -257,21 +192,16 @@ export default {
|
|
|
},
|
|
|
getFillLineInfo(element) {
|
|
|
const dom = this.getPreviewElementById(element.id);
|
|
|
- let sub_numbers = [];
|
|
|
- for (
|
|
|
- let i = element.startNumber,
|
|
|
- len = element.startNumber + element.questionsCount;
|
|
|
- i < len;
|
|
|
- i++
|
|
|
- ) {
|
|
|
- sub_numbers.push(i);
|
|
|
- }
|
|
|
+ const paperStruct = element.parent.paperStruct;
|
|
|
+ // TODO:结构有变动
|
|
|
|
|
|
return {
|
|
|
answer_area: [
|
|
|
{
|
|
|
- main_number: element.topicNo,
|
|
|
- sub_numbers,
|
|
|
+ main_number: paperStruct.detailNo,
|
|
|
+ sub_numbers: paperStruct.isCommon
|
|
|
+ ? [element.questionNo]
|
|
|
+ : [`${paperStruct.nestedQNo}-${element.questionNo}`],
|
|
|
area: this.getOffsetInfo(dom),
|
|
|
},
|
|
|
],
|
|
@@ -279,25 +209,17 @@ export default {
|
|
|
},
|
|
|
getExplainInfo(element) {
|
|
|
const dom = this.getPreviewElementById(element.id);
|
|
|
+ const paperStruct = element.parent.paperStruct;
|
|
|
+ // 多个答题区,会有多个数据
|
|
|
+ // TODO:结构有变动
|
|
|
|
|
|
return {
|
|
|
answer_area: [
|
|
|
{
|
|
|
- main_number: element.topicNo,
|
|
|
- sub_numbers: [element.serialNumber],
|
|
|
- area: this.getOffsetInfo(dom),
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
- },
|
|
|
- getCompositionInfo(element) {
|
|
|
- const dom = this.getPreviewElementById(element.id);
|
|
|
-
|
|
|
- return {
|
|
|
- answer_area: [
|
|
|
- {
|
|
|
- main_number: element.topicNo,
|
|
|
- sub_numbers: [],
|
|
|
+ main_number: paperStruct.detailNo,
|
|
|
+ sub_numbers: paperStruct.isCommon
|
|
|
+ ? [element.serialNumber]
|
|
|
+ : [`${paperStruct.nestedQNo}-${element.serialNumber}`],
|
|
|
area: this.getOffsetInfo(dom),
|
|
|
},
|
|
|
],
|
|
@@ -323,7 +245,7 @@ export default {
|
|
|
|
|
|
return infos.map((num) => num.toFixed(10) * 1);
|
|
|
},
|
|
|
- getPageModel({ cardConfig, paperParams, pages }) {
|
|
|
+ getPageModel({ cardConfig, pages }) {
|
|
|
let npages = this.parsePageExchange(pages);
|
|
|
npages.forEach((page) => {
|
|
|
page.exchange.page_size = cardConfig.pageSize;
|
|
@@ -332,7 +254,6 @@ export default {
|
|
|
{
|
|
|
version: CARD_VERSION,
|
|
|
cardConfig,
|
|
|
- paperParams,
|
|
|
pages: npages,
|
|
|
},
|
|
|
(k, v) => (k.startsWith("_") ? undefined : v)
|