ChengYuXuan 5 éve
szülő
commit
52b48da0a0

+ 6 - 1
src/api/types.d.ts

@@ -17,7 +17,12 @@ export interface ReceivedData<R = {}, E = 0> extends AxiosResponseInfo {
   msg: string
 }
 
-export type QuestionType = 'choice' | 'blank' | 'code' | 'multi_choice'
+export type QuestionType =
+  | 'choice'
+  | 'blank'
+  | 'code'
+  | 'multi_choice'
+  | 'true_false'
 export interface ErrorData extends AxiosResponseInfo {
   err: number
   msg: string

+ 4 - 2
src/views/exam/ExamPane.vue

@@ -56,7 +56,7 @@
           </div>
           <div class="justify-space-between">
             <div class="d-flex justify-center">
-              <h2>代码题</h2>
+              <h2>编程题</h2>
             </div>
             <v-progress-linear
               :value="
@@ -174,7 +174,9 @@
             </blank-pane>
             <choice-pane
               v-else-if="
-                questionType() === 'choice' || questionType() === 'multi_choice'
+                questionType() === 'choice' ||
+                  questionType() === 'multi_choice' ||
+                  questionType() === 'true_false'
               "
               :question="currentQuestion"
               @saveAnswer="saveObjectiveAnswer"

+ 15 - 4
src/views/exam/components/ChoicePane.vue

@@ -9,13 +9,19 @@
       <v-card-title v-if="question.type === 'choice'"
         >单选题<v-icon>mdi-radiobox-marked</v-icon></v-card-title
       >
-      <v-card-title v-else
+      <v-card-title v-else-if="question.type === 'multi_choice'"
         >多选题<v-icon>mdi-checkbox-marked</v-icon></v-card-title
       >
+      <v-card-title v-else>
+        判断题<v-icon>mdi-list-status</v-icon>
+      </v-card-title>
     </div>
     <markdown-text :raw="question.stem" class="pa-10"></markdown-text>
     <v-list class="px-10 flex" v-if="!loading">
-      <v-list-item-group v-if="question.type === 'choice'" v-model="answer">
+      <v-list-item-group
+        v-if="question.type === 'choice' || question.type === 'true_false'"
+        v-model="answer"
+      >
         <v-divider></v-divider>
         <template v-for="choice in options">
           <v-list-item :key="choice.label" :value="choice.label">
@@ -87,7 +93,7 @@ export default Vue.extend({
         return ''
       }
 
-      if (this.question.type === 'choice') {
+      if (this.question.type !== 'multi_choice') {
         return this.answer[0]
       } else {
         const sorted = clone(this.answer).sort()
@@ -106,6 +112,11 @@ export default Vue.extend({
   },
   methods: {
     init() {
+      if (this.question.type === 'true_false') {
+        this.question.options?.set('true', '')
+        this.question.options?.set('false', '')
+      }
+
       let keys = Object.keys(this.question.options ?? {})
       let values = Object.values(this.question.options ?? {})
       this.options = []
@@ -114,7 +125,7 @@ export default Vue.extend({
         this.options.push({
           label: keys[i],
           text: values[i],
-          labelText: keys[i] + ' : ' + values[i]
+          labelText: keys[i] + '. ' + values[i]
         })
       }
       this.answer = []

+ 1 - 1
src/views/exam/components/CodePane.vue

@@ -53,7 +53,7 @@
         </div>
         <div style="height: 32px" class="d-flex justify-space-between px-2">
           <span>
-            <span class="mx-2"> 代码题</span>
+            <span class="mx-2"> 编程题</span>
             <slot name="index"></slot>
           </span>
           <v-btn color="info" small @click="prevQuestion">上一题</v-btn>