1
0

2 Commits 303b6a34e6 ... 9a33baf204

Autor SHA1 Nachricht Datum
  lsiten 9a33baf204 Merge branch 'master' of https://git.proginn.com/u167298/page vor 6 Jahren
  lsiten ada6403265 fix data vor 6 Jahren
3 geänderte Dateien mit 20 neuen und 15 gelöschten Zeilen
  1. 17 13
      src/js/main2.js
  2. 0 1
      src/js/yzDom.js
  3. 3 1
      src/js/yzQuestion.js

+ 17 - 13
src/js/main2.js

@@ -146,8 +146,7 @@ pageManager.prototype._mergeData = function () {
     rectNo: -1,
     isSubject: true,
     cdelete: 0,
-    minHeight: -1,
-    content: null
+    minHeight: -1
   };
   for (let index in data) {
     item = data[index];
@@ -248,17 +247,19 @@ pageManager.prototype._itemToPage = function (item) {
         item.questions = questionsTemp;
         domOption.height = holdHeight;
         domOption.questions = cHoldQuestions;
-        if (domOption.questions.length > 0) {
-          item.height -= domOption.height;
-          item.height < nextBoxHeight && (item.height = nextBoxHeight);
-          this.currentPage.addDom(domOption);
-        }
-
+        
+        
         if (item.height > this.minHeight) {
           domOption.isDrag = false;
         } else {
           domOption.isDrag = true;
         }
+
+        if (domOption.questions.length > 0) {
+          item.height -= domOption.height;
+          item.height < nextBoxHeight && (item.height = nextBoxHeight);
+          this.currentPage.addDom(domOption);
+        }
         // 如果有最小高度,则说明是刷新状态
         if(item.minHeight) {
           item.minHeight -= domOption.height;
@@ -268,10 +269,14 @@ pageManager.prototype._itemToPage = function (item) {
         this.currentPage = null;
         if (item.height > this.minHeight) {
           // 如果有最小高度,则说明是刷新状态
-          if(item.minHeight) {
-            item.minHeight <= 0 && (item.cdelete = 1);
+          if (item.questions.length < 1) {
+            let lastQuestion = JSON.parse(JSON.stringify( domOption.questions[domOption.questions.length - 1] ));
+            lastQuestion.minHeight = item.height;
+            lastQuestion.isSubQuestion = true;
+            item.questions.push(lastQuestion);
           }
 
+          item.minHeight <= 0 ? item.cdelete = 1 : item.cdelete = 0;
           this._itemToPage(item);
         }
     } else {
@@ -334,11 +339,10 @@ pageManager.prototype._refreshPage = function () {
         questions: doms[j].questions,
         rectNo: doms[j].rectNo,
         minHeight: doms[j].minHeight,
-        content: doms[j].content
-
+        cdelete: 0
       };
       if(parseInt(item.rectNo) === nowRectNo) {
-        data[(length-1)].questions.push.apply(data[(length-1)].questions, item.questions);
+        !item.questions[0].isSubQuestion && data[(length-1)].questions.push.apply(data[(length-1)].questions, item.questions);
         data[(length-1)].height += item.height;
       } else {
         nowRectNo = parseInt(item.rectNo);

+ 0 - 1
src/js/yzDom.js

@@ -12,7 +12,6 @@ var yzDom = function(cfg) {
   this.isDrag = cfg.isDrag;
   this.rowDetail = cfg.rowDetail;
   this.isSubject = cfg.isSubject;
-  this.content = cfg.content || null;
   this.questionsDom = [];
 
  // 该dom第几个question 

+ 3 - 1
src/js/yzQuestion.js

@@ -16,6 +16,8 @@ let yzQuestion = function (cfg) {
   this.title = cfg.title || '';
   this.inDetail = cfg.inDetail;
   this.isSubject = cfg.isSubject;
+  // 是否是跨栏添加的小问
+  this.isSubQuestion = cfg.isSubQuestion || false;
   this.blockindex = parseInt(cfg.blockindex);
   this.blocknum = parseInt(cfg.blocknum);
 
@@ -104,7 +106,7 @@ yzQuestion.prototype.renderToDom = function () {
   this.vdom.css({
     minHeight: this.minHeight
   })
-  this._renderTitleDom();
+  !this.isSubQuestion && this._renderTitleDom();
   // 如果是客观题
   if (!this.isSubject) {
     let width = 100/this.allblock + '%';