Browse Source

修改问题,公共题库增加共享人共享时间,题目编辑页增加总分

dusenyao 11 months ago
parent
commit
9605aa026f

+ 0 - 2
src/styles/mixin.scss

@@ -33,8 +33,6 @@
   .stem {
     display: flex;
     align-items: flex-start;
-
-    // font-weight: bold;
     color: #34343a;
 
     @include rich-text(18pt);

+ 10 - 0
src/views/exercise_questions/create/components/create.vue

@@ -21,6 +21,7 @@
         <span class="now-save" @click="saveQuestion">立即保存</span>
       </div>
       <div class="right-operate">
+        <span class="current-score">当前卷面分:{{ totalScore }}</span>
         <span class="line"></span>
         <a class="preview" @click="setPreview"><SvgIcon icon-class="eye" /><span>预览</span></a>
         <a class="delete" @click="deleteQuestion"><SvgIcon icon-class="delete" /><span>删除</span></a>
@@ -96,6 +97,10 @@ export default {
       type: Boolean,
       required: true,
     },
+    totalScore: {
+      type: Number,
+      required: true,
+    },
   },
   data() {
     return {
@@ -304,6 +309,11 @@ export default {
         }
       }
 
+      .current-score {
+        font-size: 14px;
+        color: #2f3742;
+      }
+
       .preview {
         @extend %setting;
 

+ 4 - 2
src/views/exercise_questions/create/index.vue

@@ -38,6 +38,7 @@
       v-loading="loading"
       :cur-index="curIndex"
       :index-list="index_list"
+      :total-score="totalScore"
       :loading="loading"
       @selectExerciseItem="selectExerciseItem"
       @setPreview="setPreview"
@@ -127,6 +128,7 @@ export default {
       back_url: back_url || '/personal_question', // 返回地址
       visible: false, // 选择题目类型弹窗
       importVisible: false, // 一键导入弹窗
+      totalScore: 0, // 总分
     };
   },
   computed: {
@@ -211,9 +213,9 @@ export default {
      */
     getExerciseQuestionIndexList(init = false, isAdd = false) {
       GetExerciseQuestionIndexList({ exercise_id: this.exercise_id })
-        .then(({ index_list }) => {
+        .then(({ index_list, score }) => {
           this.index_list = index_list;
-
+          this.totalScore = score;
           if (isAdd) {
             this.curIndex = this.index_list.length - 1;
           }

+ 2 - 0
src/views/exercise_questions/preview/MatchingPreview.vue

@@ -187,6 +187,8 @@ export default {
       if (cur) {
         this.clearLine();
         this.circulateAnswerList();
+      } else {
+        this.clearLine();
       }
     },
     isShowRightAnswer(cur) {

+ 5 - 0
src/views/exercise_questions/preview/ReadPreview.vue

@@ -138,6 +138,11 @@ export default {
       if (userAnswer) this.answer = userAnswer;
       if (this.question_list.length === this.answer.question_list.length) {
         return this.fillAnswer(isJudgingRightWrong, isShowRightAnswer, disabled);
+      } else if (this.answer.question_list.length === 0) {
+        this.$refs.preview.forEach((item) => {
+          item.showAnswer(false, false, { answer_list: [] }, true);
+        });
+        return;
       }
       this.$watch('question_list', (val) => {
         if (val.length !== this.answer.question_list.length) return;

+ 20 - 8
src/views/exercise_questions/preview/RepeatPreview.vue

@@ -60,21 +60,33 @@ export default {
       deep: true,
       immediate: true,
     },
+    // 为空时填充数据
+    'answer.answer_list': {
+      handler(val) {
+        if (val.length === 0) {
+          this.fillAnswerList();
+        }
+      },
+      deep: true,
+    },
   },
   methods: {
     // 初始化数据
     handleData() {
       if (!this.isJudgingRightWrong) {
-        this.answer.answer_list = [];
-        this.data.option_list.forEach((item) => {
-          let obj = {
-            mark: item.mark,
-            audio_file_id: '',
-          };
-          this.answer.answer_list.push(obj);
-        });
+        this.fillAnswerList();
       }
     },
+    fillAnswerList() {
+      this.answer.answer_list = [];
+      this.data.option_list.forEach((item) => {
+        let obj = {
+          mark: item.mark,
+          audio_file_id: '',
+        };
+        this.answer.answer_list.push(obj);
+      });
+    },
   },
 };
 </script>

+ 9 - 9
src/views/exercise_questions/preview/ReplaceAnswerPreview.vue

@@ -23,10 +23,10 @@
             @scroll="handleScroll($event, i)"
           >
             <li
-              v-for="(items, indexs) in item"
-              :key="indexs"
+              v-for="(items, j) in item"
+              :key="j"
               :class="[computedAnswerClass(i, items)]"
-              @click="handleClickItem(i, indexs)"
+              @click="handleClickItem(i, j)"
             >
               {{ items.content }}
             </li>
@@ -105,9 +105,9 @@ export default {
         option_lists.push([]);
       });
       this.data.option_list.forEach((item) => {
-        item.forEach((items, indexs) => {
+        item.forEach((items, i) => {
           if (items.content) {
-            option_lists[indexs].push(items);
+            option_lists[i].push(items);
           }
         });
       });
@@ -141,11 +141,11 @@ export default {
       this.answer.answer_list[0].mark_list[i] = this.option_list[i][scrollIndex].mark;
       this.$forceUpdate();
     },
-    handleClickItem(i, indexs) {
+    handleClickItem(i, j) {
       if (this.disabled) return;
-      this.$refs[`ui${i}`][0].scrollTop = indexs * 48;
-      this.active_content[i] = this.option_list[i][indexs].content;
-      this.answer.answer_list[0].mark_list[i] = this.option_list[i][indexs].mark;
+      this.$refs[`ui${i}`][0].scrollTop = j * 48;
+      this.active_content[i] = this.option_list[i][j].content;
+      this.answer.answer_list[0].mark_list[i] = this.option_list[i][j].mark;
       this.$forceUpdate();
     },
     computedAnswerClass(i, item) {

+ 3 - 1
src/views/home/public_question/index.vue

@@ -13,7 +13,9 @@
       </el-table-column>
       <el-table-column prop="intro" label="简介" width="280" />
       <el-table-column prop="teacher_name" label="发布者" width="180" />
-      <el-table-column prop="create_time" label="创建日期" min-width="180" />
+      <el-table-column prop="create_time" label="创建日期" width="180" />
+      <el-table-column prop="public_person_name" label="共享人" width="180" />
+      <el-table-column prop="public_time" label="共享时间" min-width="180" />
       <el-table-column prop="operation" label="操作" fixed="right" width="220">
         <template slot-scope="{ row }">
           <span class="link" @click="showExercise(row.id)">查看</span>

+ 5 - 2
src/views/home/recovery/AnswerData.vue

@@ -103,7 +103,9 @@
         </el-table-column>
         <el-table-column label="操作" fixed="right" width="100">
           <template slot-scope="{ row }">
-            <span class="link" @click="viewExerciseQuestion(row.question_id, row.exercise_id)">查看</span>
+            <span class="link" @click="viewExerciseQuestion(row.question_id, row.exercise_id, row.question_type)">
+              查看
+            </span>
           </template>
         </el-table-column>
       </el-table>
@@ -226,7 +228,7 @@ export default {
     /**
      * 查看练习题题目答题用户列表
      */
-    viewExerciseQuestion(question_id, exercise_id) {
+    viewExerciseQuestion(question_id, exercise_id, question_type) {
       this.$router.push({
         path: '/exercise_answer_user_list',
         query: {
@@ -234,6 +236,7 @@ export default {
           exercise_id,
           share_record_id: this.searchData.share_record_id,
           question_id,
+          question_type,
         },
       });
     },

+ 21 - 25
src/views/home/recovery/ExerciseAnswerUserList.vue

@@ -139,13 +139,14 @@ export default {
   name: 'ExerciseAnswerUserList',
   mixins: [PreviewQuestionTypeMixin],
   data() {
-    const { share_record_id, question_id, exercise_id, search_exercise_id } = this.$route.query;
+    const { share_record_id, question_id, exercise_id, search_exercise_id, question_type } = this.$route.query;
 
     return {
       share_record_id,
       question_id,
       exercise_id, // 练习id
       search_exercise_id, // 搜索练习id
+      question_type, // 题目类型
       exerciseNames,
       scoreTypeList,
       isTeacher: this.$store.getters.isTeacher, // 是否是教师
@@ -220,20 +221,24 @@ export default {
     },
     // 得到答题记录题目信息
     getQuestionInfo_AnswerRecord() {
-      const type = this.questionList[this.curQuestionIndex].type;
+      const type = this.question_type;
+      let answer = {
+        answer_list: [],
+      };
+      if (type === 'activity') {
+        answer.answer_list.push({
+          accessory_file_id_list: [],
+        });
+      }
+      if (type === 'answer_question') {
+        answer.answer_list.push({
+          audio_file_id: '',
+        });
+      }
+      if (type === 'read') {
+        answer.question_list = [];
+      }
       if (type !== 'read') {
-        let answer = {
-          answer_list: [],
-        };
-        if (type === 'activity') {
-          answer = {
-            answer_list: [
-              {
-                accessory_file_id_list: [],
-              },
-            ],
-          };
-        }
         this.$refs.exercise?.[0].showAnswer(false, false, answer, true);
       }
       GetQuestionInfo_AnswerRecord({
@@ -257,27 +262,18 @@ export default {
         if (question.content) {
           this.currentQuestion = JSON.parse(question.content);
           if (!this.curQuestionPage) {
-            this.curQuestionPage = this.previewComponents[this.questionList[this.curQuestionIndex].type];
+            this.curQuestionPage = this.previewComponents[this.question_type];
           }
         }
         this.is_objective = is_objective === 'true';
         this.user_answer.answer_status = answer_status;
-        console.log(JSON.parse(content));
         // 如果已经填写过答案,直接显示答案
         if (is_fill_answer === 'true') {
           this.$nextTick().then(() => {
             this.$refs.exercise?.[0].showAnswer(true, true, content.length > 0 ? JSON.parse(content) : null, true);
           });
         } else {
-          this.$refs.exercise?.[0].showAnswer(
-            false,
-            false,
-            {
-              answer: '',
-              answer_list: [],
-            },
-            true,
-          );
+          this.$refs.exercise?.[0].showAnswer(false, false, answer, true);
         }
       });
     },