zhangjie 3 месяцев назад
Родитель
Сommit
8f477ce239

+ 10 - 0
card/components/CardDesign.vue

@@ -326,6 +326,7 @@ export default {
       "curElement",
       "curPage",
       "curPageNo",
+      "explainHeight",
     ]),
     cardHeadSampleData() {
       if (!this.cardConfig["pageSize"]) return;
@@ -352,6 +353,7 @@ export default {
       "setOpenElementEditDialog",
       "setCurDragElement",
       "setPages",
+      "setExplainHeight",
       "initState",
     ]),
     ...mapActions("card", [
@@ -379,6 +381,7 @@ export default {
       this.addWatch();
 
       this.$nextTick(() => {
+        this.updateExamplainHeight();
         this.registSrollEvent();
       });
     },
@@ -391,6 +394,11 @@ export default {
         this.setCurPage(0);
       });
     },
+    updateExamplainHeight() {
+      let columnHeight = document.getElementById("topic-column").offsetHeight;
+      if (this.cardConfig.subjectiveAttention) columnHeight -= 24;
+      this.setExplainHeight(Math.floor(columnHeight / 4));
+    },
     addNewTopic(item) {
       if (!item.type) {
         this.$message.error("试题类型丢失!");
@@ -403,6 +411,8 @@ export default {
         ["FILL_QUESTION_SIMPLE", "FILL_QUESTION_MULTIPLY"].includes(item.type)
       ) {
         element.optionCount = this.cardConfig.defaultOptionNumber;
+      } else if (item.type === "EXPLAIN") {
+        element.explainHeight = this.explainHeight;
       }
 
       if (item.type === "FORBID_AREA") {

+ 1 - 0
card/elements/explain/EditExplain.vue

@@ -57,6 +57,7 @@ const initModalForm = {
   startNumber: 1,
   endNumber: 4,
   questionsCount: 4,
+  explainHeight: 250,
 };
 
 export default {

+ 3 - 1
card/elements/explain/model.js

@@ -9,6 +9,7 @@ const EXPLAIN_PROP = {
   nameFontWeight: 400,
   startNumber: 1,
   questionsCount: 1,
+  explainHeight: 250,
 };
 // 解答题-小题
 const MODEL = {
@@ -16,7 +17,7 @@ const MODEL = {
   x: 0,
   y: 0,
   w: 0,
-  h: 458,
+  h: 250,
   minHeight: 60,
   sign: "subjective",
   topicNo: null,
@@ -56,6 +57,7 @@ const getFullModel = (explainProp) => {
       id: getElementId(),
       key: randomCode(),
       w: parent.w,
+      h: parent.explainHeight,
       topicNo: parent.topicNo,
       serialNumber: i + explainProp.startNumber,
       parent,

+ 6 - 0
card/store/card.js

@@ -25,6 +25,8 @@ const state = {
   topicSeries: [], // 大题顺序号,不排重
   topicNoSeries: [], // 大题顺序号,按顺序排重
   openElementEditDialog: false,
+  // 解答题默认高度
+  explainHeight: 250,
 };
 
 const mutations = {
@@ -66,6 +68,9 @@ const mutations = {
   setOpenElementEditDialog(state, openElementEditDialog) {
     state.openElementEditDialog = openElementEditDialog;
   },
+  setExplainHeight(state, explainHeight) {
+    state.explainHeight = explainHeight;
+  },
   initState(state) {
     state.cardConfig = {};
     state.curElement = {};
@@ -78,6 +83,7 @@ const mutations = {
     state.topicNoSeries = [];
     state.insetTarget = {};
     state.openElementEditDialog = false;
+    state.explainHeight = 250;
   },
 };