Преглед изворни кода

Merge branch 'master' into lhd

natasha пре 1 година
родитељ
комит
6163f2da22

+ 44 - 46
package-lock.json

@@ -2492,49 +2492,6 @@
         "webpack-merge": "^5.7.3",
         "webpack-merge": "^5.7.3",
         "webpack-virtual-modules": "^0.4.2",
         "webpack-virtual-modules": "^0.4.2",
         "whatwg-fetch": "^3.6.2"
         "whatwg-fetch": "^3.6.2"
-      },
-      "dependencies": {
-        "@vue/vue-loader-v15": {
-          "version": "npm:vue-loader@15.11.1",
-          "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
-          "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
-          "dev": true,
-          "requires": {
-            "@vue/component-compiler-utils": "^3.1.0",
-            "hash-sum": "^1.0.2",
-            "loader-utils": "^1.1.0",
-            "vue-hot-reload-api": "^2.3.0",
-            "vue-style-loader": "^4.1.0"
-          },
-          "dependencies": {
-            "hash-sum": {
-              "version": "1.0.2",
-              "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz",
-              "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
-              "dev": true
-            }
-          }
-        },
-        "json5": {
-          "version": "1.0.2",
-          "resolved": "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz",
-          "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
-          "dev": true,
-          "requires": {
-            "minimist": "^1.2.0"
-          }
-        },
-        "loader-utils": {
-          "version": "1.4.2",
-          "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz",
-          "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==",
-          "dev": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^1.0.1"
-          }
-        }
       }
       }
     },
     },
     "@vue/cli-shared-utils": {
     "@vue/cli-shared-utils": {
@@ -2722,6 +2679,47 @@
       "integrity": "sha512-RoorRB50WehYbsiWu497q8egZBYlrvOo9KBUG41uth4O023Cbs+7POLm9uw2CAiViBAIhvpw1Y4w4i+MZxOfXw==",
       "integrity": "sha512-RoorRB50WehYbsiWu497q8egZBYlrvOo9KBUG41uth4O023Cbs+7POLm9uw2CAiViBAIhvpw1Y4w4i+MZxOfXw==",
       "dev": true
       "dev": true
     },
     },
+    "@vue/vue-loader-v15": {
+      "version": "npm:vue-loader@15.11.1",
+      "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
+      "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
+      "dev": true,
+      "requires": {
+        "@vue/component-compiler-utils": "^3.1.0",
+        "hash-sum": "^1.0.2",
+        "loader-utils": "^1.1.0",
+        "vue-hot-reload-api": "^2.3.0",
+        "vue-style-loader": "^4.1.0"
+      },
+      "dependencies": {
+        "hash-sum": {
+          "version": "1.0.2",
+          "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz",
+          "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
+          "dev": true
+        },
+        "json5": {
+          "version": "1.0.2",
+          "resolved": "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz",
+          "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
+          "dev": true,
+          "requires": {
+            "minimist": "^1.2.0"
+          }
+        },
+        "loader-utils": {
+          "version": "1.4.2",
+          "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz",
+          "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==",
+          "dev": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^1.0.1"
+          }
+        }
+      }
+    },
     "@vue/web-component-wrapper": {
     "@vue/web-component-wrapper": {
       "version": "1.3.0",
       "version": "1.3.0",
       "resolved": "https://registry.npmmirror.com/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz",
       "resolved": "https://registry.npmmirror.com/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz",
@@ -9108,9 +9106,9 @@
       "dev": true
       "dev": true
     },
     },
     "prettier": {
     "prettier": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.0.3.tgz",
-      "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
+      "version": "3.1.0",
+      "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.1.0.tgz",
+      "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==",
       "dev": true
       "dev": true
     },
     },
     "prettier-linter-helpers": {
     "prettier-linter-helpers": {

+ 1 - 1
package.json

@@ -42,7 +42,7 @@
     "eslint-plugin-vue": "^9.18.1",
     "eslint-plugin-vue": "^9.18.1",
     "patch-package": "^8.0.0",
     "patch-package": "^8.0.0",
     "postcss-html": "^1.5.0",
     "postcss-html": "^1.5.0",
-    "prettier": "^3.0.3",
+    "prettier": "^3.1.0",
     "sass": "^1.69.5",
     "sass": "^1.69.5",
     "sass-loader": "^13.3.2",
     "sass-loader": "^13.3.2",
     "stylelint": "^15.11.0",
     "stylelint": "^15.11.0",

+ 49 - 19
src/views/exercise_questions/create/components/exercises/DialogueQuestion.vue

@@ -28,14 +28,12 @@
         <el-input v-model="data.dialogue" :autosize="{ minRows: 3 }" type="textarea" placeholder="输入对话" />
         <el-input v-model="data.dialogue" :autosize="{ minRows: 3 }" type="textarea" placeholder="输入对话" />
       </div>
       </div>
 
 
-      <div v-if="isEnable(data.property.is_enable_reference_answer)" class="content">
-        <span class="subtitle">参考答案:</span>
-        <el-input
-          v-model="data.reference_answer"
-          :autosize="{ minRows: 3 }"
-          type="textarea"
-          placeholder="输入参考答案"
-        />
+      <el-button @click="identifyText">识别</el-button>
+      <div v-if="data.answer.answer_list.length > 0" class="correct-answer">
+        <div class="subtitle">正确答案</div>
+        <el-input v-for="(item, i) in data.answer.answer_list" :key="item.mark" v-model="item.value">
+          <span slot="prefix">{{ i + 1 }}.</span>
+        </el-input>
       </div>
       </div>
     </template>
     </template>
 
 
@@ -97,16 +95,6 @@
             {{ label }}
             {{ label }}
           </el-radio>
           </el-radio>
         </el-form-item>
         </el-form-item>
-        <el-form-item label="参考答案">
-          <el-radio
-            v-for="{ value, label } in switchOption"
-            :key="value"
-            v-model="data.property.is_enable_reference_answer"
-            :label="value"
-          >
-            {{ label }}
-          </el-radio>
-        </el-form-item>
       </el-form>
       </el-form>
     </template>
     </template>
   </QuestionBase>
   </QuestionBase>
@@ -172,6 +160,7 @@ export default {
                 content: isFill ? fillList : content,
                 content: isFill ? fillList : content,
                 direction,
                 direction,
                 audio_file_id: '',
                 audio_file_id: '',
+                mark: isFill ? getRandomNumber() : '',
                 type: isFill ? 'input' : 'text',
                 type: isFill ? 'input' : 'text',
               };
               };
             }
             }
@@ -180,7 +169,23 @@ export default {
       },
       },
     },
     },
   },
   },
-  methods: {},
+  methods: {
+    identifyText() {
+      this.data.answer.answer_list = this.data.option_list
+        .filter(({ type }) => type === 'input')
+        .map(({ content }) => {
+          return content
+            .filter(({ type }) => type === 'input')
+            .map(({ content, ...data }) => {
+              return {
+                value: content,
+                ...data,
+              };
+            });
+        })
+        .flat();
+    },
+  },
 };
 };
 </script>
 </script>
 
 
@@ -189,6 +194,9 @@ export default {
   display: flex;
   display: flex;
   flex-direction: column;
   flex-direction: column;
   row-gap: 8px;
   row-gap: 8px;
+  padding-bottom: 8px;
+  margin-bottom: 8px;
+  border-bottom: $border;
 
 
   .subtitle {
   .subtitle {
     font-size: 14px;
     font-size: 14px;
@@ -200,4 +208,26 @@ export default {
     border-top: $border;
     border-top: $border;
   }
   }
 }
 }
+
+.correct-answer {
+  .subtitle {
+    margin: 8px 0;
+    font-size: 14px;
+    color: #4e5969;
+  }
+
+  .el-input {
+    width: 180px;
+
+    :deep &__prefix {
+      display: flex;
+      align-items: center;
+      color: $text-color;
+    }
+
+    + .el-input {
+      margin-left: 8px;
+    }
+  }
+}
 </style>
 </style>

+ 1 - 3
src/views/exercise_questions/data/dialogue.js

@@ -4,11 +4,10 @@ import { stemTypeList, questionNumberTypeList, scoreTypeList, switchOption } fro
 export const dialogueData = {
 export const dialogueData = {
   type: 'dialogue', // 题型
   type: 'dialogue', // 题型
   stem: '', // 题干
   stem: '', // 题干
-  reference_answer: '', // 参考答案
   description: '', // 描述
   description: '', // 描述
   dialogue: '', // 对话内容,用于编辑显示
   dialogue: '', // 对话内容,用于编辑显示
   option_list: [], // 选项
   option_list: [], // 选项
-  answer: { score: 0, score_type: scoreTypeList[0].value }, // 答案
+  answer: { score: 0, score_type: scoreTypeList[0].value, answer_list: [] }, // 答案
   // 题型属性
   // 题型属性
   property: {
   property: {
     stem_type: stemTypeList[0].value, // 题干类型
     stem_type: stemTypeList[0].value, // 题干类型
@@ -16,7 +15,6 @@ export const dialogueData = {
     score: 1, // 分值
     score: 1, // 分值
     is_enable_description: switchOption[0].value, // 描述
     is_enable_description: switchOption[0].value, // 描述
     is_enable_voice_answer: switchOption[0].value, // 语音作答
     is_enable_voice_answer: switchOption[0].value, // 语音作答
-    is_enable_reference_answer: switchOption[0].value, // 参考答案
     score_type: scoreTypeList[0].value, // 分值类型
     score_type: scoreTypeList[0].value, // 分值类型
   },
   },
   // 其他属性
   // 其他属性

+ 11 - 3
src/views/exercise_questions/preview/DialoguePreview.vue

@@ -57,11 +57,19 @@ export default {
       handler(val) {
       handler(val) {
         if (!val) return;
         if (!val) return;
         this.answer.answer_list = val
         this.answer.answer_list = val
-          .map(({ type, content, audio_file_id }) => {
+          .map(({ type, content, audio_file_id, mark }) => {
             if (type === 'text') return;
             if (type === 'text') return;
-
+            let _content = content
+              .filter((item) => item.type === 'input')
+              .map(({ content, ...data }) => {
+                return {
+                  value: content,
+                  ...data,
+                };
+              });
             return {
             return {
-              content: content.filter((item) => item.type === 'input'),
+              content: _content,
+              mark,
               audio_file_id,
               audio_file_id,
             };
             };
           })
           })