|
@@ -291,18 +291,9 @@ yzPage.prototype = {
|
|
|
* function 更新客观题栏高
|
|
|
*/
|
|
|
_updateObjectColumnHeight: function (checkColumn) {
|
|
|
- let cententHeight = 0;
|
|
|
- let contentIndex = 0;
|
|
|
let updateNextPara = this._cycleFindParagraph(checkColumn.firstChild);
|
|
|
if (updateNextPara) {
|
|
|
- $(updateNextPara).find('.js-option-column').forEach(column => {
|
|
|
- let contentSize = $(column.firstChild).getSizeData();
|
|
|
- if (contentIndex === 0) {
|
|
|
- cententHeight = contentSize.height;
|
|
|
- }
|
|
|
- $(column).css('min-height', cententHeight + 'px');
|
|
|
- contentIndex++;
|
|
|
- });
|
|
|
+ this._updateObjectColumnHeightByBorder(updateNextPara);
|
|
|
// 更新栏高 结束
|
|
|
this._updateObjectColumnBorder(updateNextPara);
|
|
|
}
|
|
@@ -310,6 +301,17 @@ yzPage.prototype = {
|
|
|
/**
|
|
|
* function 更新客观题栏行线
|
|
|
*/
|
|
|
+ _updateObjectColumnHeightByBorder: function (border) {
|
|
|
+ let cententHeight = 0;
|
|
|
+ $(border).find('.js-option-column').forEach(column => {
|
|
|
+ let contentSize = $(column.firstChild).getSizeData();
|
|
|
+ cententHeight = contentSize.height;
|
|
|
+ $(column).css('min-height', cententHeight + 'px');
|
|
|
+ });
|
|
|
+},
|
|
|
+ /**
|
|
|
+ * function 更新客观题栏行线
|
|
|
+ */
|
|
|
_updateObjectColumnBorder: function (border) {
|
|
|
let rowIndex = 0;
|
|
|
$(border).find('.js-options-row').forEach(row => {
|
|
@@ -628,10 +630,10 @@ yzPage.prototype = {
|
|
|
let currentBorderId = $item.attr('data-id');
|
|
|
|
|
|
if (currentBorderId === borderId) {
|
|
|
- let borderType = parseInt($item.attr('data-id'));
|
|
|
+ let borderType = parseInt($item.attr('data-type'));
|
|
|
if (borderType === 1) {
|
|
|
// 客观题处理
|
|
|
- $item.childNodes().forEach(objectRow => {
|
|
|
+ $item.childNodes().forEach(objectRow => {
|
|
|
if (!objectRow.previousSibling) {
|
|
|
let lastRow = lastBorderItem.lastChild;
|
|
|
let firstRowId = objectRow.getAttribute('data-id');
|
|
@@ -640,20 +642,19 @@ yzPage.prototype = {
|
|
|
let objectColumns = $(objectRow).find('.js-option-column');
|
|
|
// 以第一栏的为基准
|
|
|
let objectFirstColumn = objectColumns[0];
|
|
|
- let questionIndex = 0;
|
|
|
$(objectFirstColumn.firstChild).childNodes().forEach(objectQuestion => {
|
|
|
if (!objectQuestion.previousSibling) {
|
|
|
- this._mergeObjectRow(questionIndex, objectFirstColumn, lastRow);
|
|
|
+ this._mergeObjectRow(objectColumns, lastRow);
|
|
|
}
|
|
|
- questionIndex++;
|
|
|
})
|
|
|
} else {
|
|
|
- lastBorderItem.append(objectRow);
|
|
|
+ lastBorderItem.appendChild(objectRow);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
$item.remove();
|
|
|
this._updateObjectColumnBorder(lastBorderItem);
|
|
|
+ this._updateObjectColumnHeightByBorder(lastBorderItem);
|
|
|
} else if (borderType === 2) {
|
|
|
$($item[0].firstChild).childNodes().forEach(borderItem => {
|
|
|
if (borderItem.className) {
|
|
@@ -726,7 +727,7 @@ yzPage.prototype = {
|
|
|
$item.remove();
|
|
|
}
|
|
|
} else {
|
|
|
- $lastParagraph.append($item);
|
|
|
+ $lastParagraph.append($item);
|
|
|
}
|
|
|
} else {
|
|
|
$lastParagraph.append($item);
|
|
@@ -861,6 +862,10 @@ yzPage.prototype = {
|
|
|
$moves.push($prevParagraph);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (isEmptyElement($paragraph[0])) {
|
|
|
+ $paragraph.remove();
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* function 处理需要上移的框
|
|
@@ -880,9 +885,7 @@ yzPage.prototype = {
|
|
|
if (isMerge) {
|
|
|
$prevBorder = $($prevParagraph[0].lastChild);
|
|
|
}
|
|
|
-
|
|
|
$border.childNodes().forEach(row => {
|
|
|
- debugger;
|
|
|
if (!row.previousSibling) {
|
|
|
let lastRow = lastCentent.lastChild;
|
|
|
let firstRowId = row.getAttribute('data-id');
|
|
@@ -891,16 +894,14 @@ yzPage.prototype = {
|
|
|
let columns = $(row).find('.js-option-column');
|
|
|
// 以第一栏的为基准计算
|
|
|
let firstColumn = columns[0];
|
|
|
- let questionIndex = 0;
|
|
|
$(firstColumn.firstChild).childNodes().forEach(question => {
|
|
|
if (!question.previousSibling) {
|
|
|
- let height = $(question).getSizeData().height;
|
|
|
+ let height = $(question).getSizeData().height + 16;
|
|
|
if (height < size.diff) {
|
|
|
- this._mergeObjectRow(questionIndex, columns, lastRow);
|
|
|
+ this._mergeObjectRow(columns, lastRow);
|
|
|
size.diff -= height;
|
|
|
}
|
|
|
}
|
|
|
- questionIndex++;
|
|
|
})
|
|
|
if (isEmptyElement(firstColumn.firstChild)) {
|
|
|
$(row).remove();
|
|
@@ -912,17 +913,15 @@ yzPage.prototype = {
|
|
|
let columns = $(row).find('.js-option-column');
|
|
|
// 以第一栏的为基准计算
|
|
|
let firstColumn = columns[0];
|
|
|
- let questionIndex = 0;
|
|
|
let prevRow = row.cloneNode(false)
|
|
|
$(firstColumn.firstChild).childNodes().forEach(question => {
|
|
|
if (!question.previousSibling) {
|
|
|
- let height = $(question).getSizeData().height;
|
|
|
+ let height = $(question).getSizeData().height + 16;
|
|
|
if (height < size.diff) {
|
|
|
- this._mergeObjectRow(questionIndex, columns, prevRow);
|
|
|
+ this._mergeObjectRow(columns, prevRow);
|
|
|
size.diff -= height;
|
|
|
}
|
|
|
}
|
|
|
- questionIndex++;
|
|
|
})
|
|
|
|
|
|
if (!isEmptyElement(prevRow)) {
|
|
@@ -945,27 +944,27 @@ yzPage.prototype = {
|
|
|
$border.remove();
|
|
|
}
|
|
|
this._updateObjectColumnBorder(lastCentent);
|
|
|
+ this._updateObjectColumnHeightByBorder(lastCentent);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* function 合并主观题行
|
|
|
- * @param {number} questionIndex 第几个question的index
|
|
|
* @param {Array} columns 需要处理的栏
|
|
|
* @param {node} lastRow 上一段最后一框最后一行
|
|
|
*/
|
|
|
- _mergeObjectRow: function (questionIndex, columns, lastRow) {
|
|
|
+ _mergeObjectRow: function (columns, lastRow) {
|
|
|
let lastColumns = $(lastRow).find('.js-option-column');
|
|
|
let length = columns.length;
|
|
|
for (let i =0; i < length; i++) {
|
|
|
- if (columns[i].firstChild.childNodes[questionIndex]) {
|
|
|
+ if (columns[i].firstChild.childNodes[0]) {
|
|
|
if (lastColumns[i]) {
|
|
|
- lastColumns[i].firstChild.appendChild(columns[i].firstChild.childNodes[questionIndex]);
|
|
|
+ lastColumns[i].firstChild.appendChild(columns[i].firstChild.childNodes[0]);
|
|
|
} else {
|
|
|
let prevColumn = columns[i].cloneNode(false);
|
|
|
let prevColumnContent = columns[i].firstChild.cloneNode(false);
|
|
|
prevColumn.appendChild(prevColumnContent);
|
|
|
- prevColumnContent.appendChild(columns[i].firstChild.childNodes[questionIndex]);
|
|
|
+ prevColumnContent.appendChild(columns[i].firstChild.childNodes[0]);
|
|
|
lastRow.appendChild(prevColumn);
|
|
|
}
|
|
|
}
|