Browse Source

Merge branch 'master' of http://192.168.4.246:3000/zhangs/surveyMaker

zhangwf 5 years ago
parent
commit
dfcbf0ace1
1 changed files with 12 additions and 4 deletions
  1. 12 4
      src/views/h5editor/overview.vue

+ 12 - 4
src/views/h5editor/overview.vue

@@ -197,7 +197,7 @@ export default {
       if (checked) {
         questions.push(item.questionId);
         console.log("AAAAAAAAA", questions);
-        this.addQuestion(item, true);
+        this.addQuestion(item);
       } else {
         questions.splice(
           questions.findIndex(itemTemp => itemTemp === item.questionId),
@@ -219,10 +219,18 @@ export default {
       console.log("RRRRRRRRRR", selecteQuestionList);
       this.$store.dispatch("addQuestion", selecteQuestionList);
     },
-    addQuestion(item, isFirst) {
+    addQuestion(item) {
+      let questions = this.selectQuestions[this.currentPage - 1] || [];
+      var top = 170;
+      if (questions.length > 1) {
+        var question = this.questionList.filter(
+          item => item.questionId == questions[0]
+        );
+        top = question[0].optionList.length * 90 + 300;
+      }
       // 添加题目
       let param = {};
-      param.top = 170;
+      param.top = top;
       param.left = 100;
       param.questionId = item.questionId;
       param["type"] = "text";
@@ -238,7 +246,7 @@ export default {
       param["nodeId"] = "Id" + Math.random();
       this.$store.dispatch("addElement", param);
       // 添加选项
-      var itemTop = 250;
+      var itemTop = top + 50;
       for (var i = 0; i < item.optionList.length; i++) {
         console.log("选项", item.optionList[i].content);
         let obj = {};