Procházet zdrojové kódy

选择题智能识别

dusenyao před 1 rokem
rodič
revize
b498638a6c

+ 14 - 2
src/views/exercise_questions/create/components/exercises/SelectQuestion.vue

@@ -185,8 +185,20 @@ export default {
         .filter((item) => item);
 
       if (arr.length > 0) {
-        this.data.stem = arr[0];
-        this.data.option_list = arr.slice(1).map((content) => getOption(content));
+        let sliceLength = 0;
+        if (arr[0].substring(0, 3) === '题干:') {
+          this.data.stem = arr[0].substring(3);
+          sliceLength += 1;
+        }
+        if (arr.slice(sliceLength)[0] && arr.slice(sliceLength)[0].substring(0, 3) === '提示:') {
+          this.data.description = arr.slice(sliceLength)[0].substring(3);
+          this.data.property.is_enable_description = 'true';
+          sliceLength += 1;
+        } else {
+          this.data.description = '';
+          this.data.property.is_enable_description = 'false';
+        }
+        this.data.option_list = arr.slice(sliceLength).map((content) => getOption(content));
       }
     },
     changeSelectType(val) {