zhangjie пре 5 година
родитељ
комит
23a7467391

+ 139 - 0
src/modules/card/components/PaperParams.vue

@@ -0,0 +1,139 @@
+<template>
+  <el-dialog
+    class="paper-params"
+    :visible.sync="modalIsShow"
+    top="10vh"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="dialogOpen"
+    @close="dialogClose"
+  >
+    <h1 slot="title">请上传阅卷参数 <span>卷面总分合计:100分 </span></h1>
+    <div class="params-main">
+      <div class="params-head">
+        <el-button
+          :type="!topicType ? 'primary' : 'default'"
+          @click="selectType(0)"
+          >客观题区</el-button
+        >
+        <el-button
+          :type="topicType ? 'primary' : 'default'"
+          @click="selectType(1)"
+          >主观题区</el-button
+        >
+      </div>
+      <div class="params-body"></div>
+    </div>
+    <div slot="footer">
+      <el-button type="danger" @click="cancel" plain>取消</el-button>
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+export default {
+  name: "paper-params",
+  props: {
+    pages: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      topicType: 0,
+      objectives: [],
+      subjectives: [],
+      objectiveScores: {},
+      subjectiveScores: {}
+    };
+  },
+  methods: {
+    dialogOpen() {
+      let objectiveList = [];
+      let subjectiveList = [];
+      let objectives = [];
+      let subjectives = [];
+      this.pages.forEach(page => {
+        page.columns.forEach(column => {
+          column.elements.forEach(element => {
+            if (element.sign && element.type !== "TOPIC_HEAD") {
+              if (element.sign === "objective") objectiveList.push(element);
+              if (element.sign === "subjective") subjectiveList.push(element);
+            }
+          });
+        });
+      });
+      // 客观题
+      objectiveList.forEach(item => {
+        let topic = {
+          index: objectives.length,
+          sumScore: 0,
+          choiceList: this.getChoiceList(item.optionCount, item.isFill),
+          questions: this.getQuestions(item),
+          ...item
+        };
+        objectives.push(topic);
+      });
+      // 主观题
+      subjectiveList.forEach(item => {
+        if (item.type === "FILL_LINE") {
+          let topic = {
+            index: subjectives.length,
+            sumScore: 0,
+            questions: this.getQuestions(item),
+            ...item
+          };
+          subjectives.push(topic);
+        }
+      });
+    },
+    getQuestions(data) {
+      let questions = [];
+      for (let j = data.startNumber; j < data.questionsCount; j++) {
+        let quesiton = {
+          questionNo: j,
+          score: 0
+        };
+        // if (data.type === "FILL_QUESTION")
+        //   quesiton.answers = data.isMultiply ? [] : "";
+        questions[j] = quesiton;
+      }
+      return questions;
+    },
+    getObjectiveTopicName(data) {
+      if (data.isMultiply) {
+        return "选择题(多选)";
+      } else if (data.isFill) {
+        return "填空题";
+      } else {
+        return "选择题(单选)";
+      }
+    },
+    getChoiceList(num, isFill) {
+      const options = !isFill ? "abcdefghijklmn" : "√×";
+      return options
+        .toUpperCase()
+        .slice(0, num)
+        .split("");
+    },
+    dialogClose() {},
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    selectType(topicType) {
+      this.topicType = topicType;
+    }
+  }
+};
+</script>

+ 2 - 2
src/modules/card/store.js

@@ -279,8 +279,8 @@ const actions = {
     const columnNumber = state.cardConfig.columnNumber;
     // 更新元件最新的高度信息
     // 整理所有元件
-    const objectiveElements = [];
-    const subjectiveElements = [];
+    let objectiveElements = [];
+    let subjectiveElements = [];
     const cardHeadElement = state.pages[0].columns[0].elements[0];
     state.pages.forEach(page => {
       page.columns.forEach(column => {

+ 7 - 1
src/modules/card/views/CardDesign.vue

@@ -87,6 +87,12 @@
           <!-- <br /><br /> -->
           <!-- <el-button @click="initCard">新建页面</el-button> -->
         </div>
+        <div class="action-part">
+          <div class="action-part-title"><h2>阅卷参数</h2></div>
+          <div class="action-part-body">
+            <el-button type="primary">上传阅卷参数(0)</el-button>
+          </div>
+        </div>
       </div>
 
       <!-- edit body -->
@@ -287,7 +293,7 @@ export default {
       prepareTcPCard: this.$ls.get("prepareTcPCard", {}),
       ELEMENT_LIST,
       TOPIC_LIST,
-      steps: ["添加标题", "基本设置", "试题配置", "预览生成"],
+      steps: ["添加标题", "基本设置", "试题配置", "设置阅卷参数", "预览生成"],
       columnWidth: 0,
       cardPreviewUrl: ""
     };