|
@@ -467,7 +467,7 @@ yzPage.prototype = {
|
|
|
let bid = $(lastCentent).attr('data-id');
|
|
|
if (prevBid === bid) {
|
|
|
let $prevBorder = $border.clone(false);
|
|
|
- this._prevQuestions($prevParagraph, diff, $border, $(lastCentent));
|
|
|
+ this._prevQuestions($prevBorder, diff, $border, $(lastCentent));
|
|
|
} else {
|
|
|
let borderSize= $border.getSizeData();
|
|
|
if (borderSize.height < diff) {
|
|
@@ -485,14 +485,88 @@ yzPage.prototype = {
|
|
|
},
|
|
|
/**
|
|
|
* function 前移问题
|
|
|
- * @param {DomElement} $prevParagraph 前移段落暂存
|
|
|
+ * @param {DomElement} $prevBorder 前移框暂存
|
|
|
* @param {number} diff 前移段落暂存
|
|
|
* @param {DomElement} $border 前移段落暂存
|
|
|
- * @param {DomElement} $lastQuestion 前移段落暂存
|
|
|
+ * @param {DomElement} $lastBorder 前段落最后一个框
|
|
|
*
|
|
|
*/
|
|
|
- _prevQuestions: function ($prevParagraph, diff, $border, $lastQuestion) {
|
|
|
-
|
|
|
+ _prevQuestions: function ($prevBorder, diff, $border, $lastBorder) {
|
|
|
+ let lastQuestion = $lastBorder[0].firstChild.lastChild;
|
|
|
+ let $borderContent = $($border[0].firstChild);
|
|
|
+ $borderContent.childNodes().forEach(item => {
|
|
|
+ if (item.className) {
|
|
|
+ if (item.className.indexOf('js-lsiten-question') > -1) {
|
|
|
+ let qustionType = parseInt(item.getAttribute('data-type'));
|
|
|
+ let questionId = item.getAttribute('data-id');
|
|
|
+ if (lastQuestion.className && lastQuestion.className.indexOf('js-lsiten-question') > -1) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (qustionType === 3) {
|
|
|
+ let $prevSubject = $(item).clone(false);
|
|
|
+ this._prevSubjectQuestion($prevSubject, diff, $(item));
|
|
|
+ if (!isEmptyElement($prevSubject)) {
|
|
|
+ $prevBorder[0].firstChild.appendChild($prevSubject[0]);
|
|
|
+ }
|
|
|
+ } else if (qustionType === 4) {
|
|
|
+ let $prevWritting = $(item).clone(false);
|
|
|
+ this._prevWrittingQuestion($prevWritting, diff, $(item));
|
|
|
+ if (!isEmptyElement($prevWritting)) {
|
|
|
+ $prevBorder[0].firstChild.appendChild($prevWritting[0]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let height = $(item).getSizeData();
|
|
|
+ if (height < diff) {
|
|
|
+ $prevBorder[0].firstChild.appendChild(item);
|
|
|
+ diff -= height;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (item.className.indexOf('js-lsiten-line') > -1) {
|
|
|
+ let height = $(item).getSizeData();
|
|
|
+ if (height < diff) {
|
|
|
+ $prevBorder[0].firstChild.appendChild(item);
|
|
|
+ diff -= height;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $(item).remove();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item && item.parentNode.removeChild(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * function 前移主观题框
|
|
|
+ * @param {DomElement} $prevSubject 前移框暂存
|
|
|
+ * @param {number} diff 可移动空间
|
|
|
+ * @param {DomElement} $subject 需要前移客观题处理
|
|
|
+ */
|
|
|
+ _prevSubjectQuestion: function ($prevSubject, diff, $subject) {
|
|
|
+ $subject.childNodes().forEach(item => {
|
|
|
+ let height = $(item).getSizeData();
|
|
|
+ if (height < diff) {
|
|
|
+ $prevSubject[0].appendChild(item);
|
|
|
+ diff -= height;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * function 前移主观题框
|
|
|
+ * @param {DomElement} $prevSubject 前移框暂存
|
|
|
+ * @param {number} diff 可移动空间
|
|
|
+ * @param {DomElement} $subject 需要前移客观题处理
|
|
|
+ */
|
|
|
+ _prevWrittingQuestion: function ($prevWritting, diff, $Writting) {
|
|
|
+ $Writting.childNodes().forEach(item => {
|
|
|
+ if (item.className) {
|
|
|
+ if (item.className.indexOf('lsiten-title') > -1) {
|
|
|
+
|
|
|
+ } else if (item.className.indexOf('lsiten-border-box') > -1) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
/**
|
|
|
* function 检测内容是否超出
|