Преглед на файлове

选题界面默认展示题目内容+简答题解析答案特殊处理

ChengYuXuan преди 5 години
родител
ревизия
cac33b16bd
променени са 2 файла, в които са добавени 31 реда и са изтрити 14 реда
  1. 5 1
      src/views/components/ExamQuestionsInfo.vue
  2. 26 13
      src/views/teacher/components/QuestionList.vue

+ 5 - 1
src/views/components/ExamQuestionsInfo.vue

@@ -27,11 +27,15 @@
             style="height: 100%;width: 100%"
           ></markdown-text>
         </v-col>
-        <v-col class="d-flex align-center justify-end">
+        <v-col
+          class="d-flex align-center justify-end"
+          v-if="question.type !== 'short_answer'"
+        >
           答案:
           <v-chip label color="success" class="ml-2">
             {{ question.answer }}
           </v-chip>
+          <!--  简答题解析即为答案        -->
         </v-col>
       </v-row>
       <v-row class="pl-10"> </v-row>

+ 26 - 13
src/views/teacher/components/QuestionList.vue

@@ -1,6 +1,6 @@
 <template>
   <v-container>
-    <v-card-title>已选题目</v-card-title>
+    <v-card-title class="display-1 mb-4">已选题目</v-card-title>
     <v-data-table
       item-key="id"
       :headers="selectedHeaders"
@@ -33,22 +33,29 @@
       <v-btn class="primary mx-2" @click="onSubmitManualPaper">确认调整</v-btn>
       <v-btn class="secondary mx-2" @click="onLeave">返回</v-btn>
     </v-row>
-    <v-row class="mx-2 mt-5" align="center">
+    <v-card-title class="display-1 text-center">试题列表</v-card-title>
+    <v-row class="mx-2" align="center" justify="space-between">
       <v-col cols="3">
         <v-text-field v-model="stem" label="根据题目内容查找"></v-text-field>
       </v-col>
       <v-col cols="3">
-        <v-text-field v-model="tags" label="标签"></v-text-field>
+        <v-text-field
+          v-model="tags"
+          label="标签"
+          :disabled="true"
+        ></v-text-field>
       </v-col>
       <v-col cols="3">
-        <v-text-field v-model="knowledgeName" label="知识点"></v-text-field>
+        <v-text-field
+          v-model="knowledgeName"
+          label="知识点"
+          :disabled="true"
+        ></v-text-field>
       </v-col>
       <v-col cols="1">
         <v-btn class="primary mb-4 info" @click="onSearch">搜索</v-btn>
       </v-col>
     </v-row>
-
-    <v-card-title>试题列表</v-card-title>
     <v-data-table
       v-model="selectedQuestions"
       item-key="id"
@@ -56,6 +63,7 @@
       :headers="headers"
       :items="questions"
       show-expand
+      :expanded.sync="expanded"
       class="text-wrap"
       :loading="loading"
       @item-selected="onSelectQuestion"
@@ -69,13 +77,16 @@
         </td>
       </template>
     </v-data-table>
-    <v-pagination
-      total-visible="5"
-      class="my-2"
-      :length="Math.ceil(totalNum / pageSize)"
-      v-model="pageNum"
-      @input="changePage"
-    ></v-pagination>
+    <v-row justify="center">
+      <v-col cols="4" align-self="center"
+        ><v-pagination
+          class="my-2"
+          :length="Math.ceil(totalNum / pageSize)"
+          v-model="pageNum"
+          @input="changePage"
+        ></v-pagination
+      ></v-col>
+    </v-row>
     <v-snackbar v-model="selectQuestionsSuccess" top color="info">
       设置试题成功
     </v-snackbar>
@@ -120,6 +131,7 @@ export default Vue.extend({
       totalNum: 0,
       loading: true,
       selectQuestionsSuccess: false,
+      expanded: [] as Array<Question>,
       headers: [
         { text: '题目类型', value: 'typeText' },
         { text: '关键词', value: 'keyPoints', sortable: false },
@@ -158,6 +170,7 @@ export default Vue.extend({
           return { ...val, typeText: questionTypeToText(val.type), score: 5 }
         })
         this.totalNum = data.result.totalNum
+        this.expanded = this.questions
         this.loading = false
       })
     },