Procházet zdrojové kódy

Merge branch 'iteration-20231114' into online

lex před 1 rokem
rodič
revize
16734a1704

+ 16 - 1
src/views/knowledge-library/error-question-mode/index.tsx

@@ -1,4 +1,12 @@
-import { ActionSheet, Button, Image, Popup, Swipe, SwipeItem } from 'vant';
+import {
+  ActionSheet,
+  Button,
+  Image,
+  Popup,
+  Swipe,
+  SwipeItem,
+  showToast
+} from 'vant';
 import {
   computed,
   defineComponent,
@@ -199,6 +207,13 @@ export default defineComponent({
       try {
         const questionList = state.questionList || [];
 
+        const question: any = questionList[state.currentIndex];
+        if (question?.userAnswer?.length <= 0) {
+          showToast('题目尚未做答');
+          state.nextStatus = false;
+          return;
+        }
+
         let result: any = {};
         questionList.forEach((question: any, index: number) => {
           // 格式化所有题目的答案

+ 15 - 1
src/views/knowledge-library/examination-mode/index.tsx

@@ -1,4 +1,12 @@
-import { ActionSheet, Button, Image, Popup, Swipe, SwipeItem } from 'vant';
+import {
+  ActionSheet,
+  Button,
+  Image,
+  Popup,
+  Swipe,
+  SwipeItem,
+  showToast
+} from 'vant';
 import {
   defineComponent,
   nextTick,
@@ -149,6 +157,12 @@ export default defineComponent({
       state.nextStatus = true;
       try {
         const questionList = state.questionList || [];
+        const question: any = questionList[state.currentIndex];
+        if (question?.userAnswer?.length <= 0) {
+          showToast('题目尚未做答');
+          state.nextStatus = false;
+          return;
+        }
         const userAnswerList: any = []; // 所有题目的答案
         questionList.forEach((question: any, index: number) => {
           // 格式化所有题目的答案

+ 3 - 1
src/views/knowledge-library/model/answer-analysis/index.tsx

@@ -61,7 +61,9 @@ export default defineComponent({
               <Icon name={iconAnalysis} class={styles.aImg} />
               答案解析
             </div>
-            <div class={styles.analysisMessage}>{props.answerAnalysis}</div>
+            <div class={styles.analysisMessage}>
+              {props.answerAnalysis || '无'}
+            </div>
           </>
         )}
       </div>

+ 1 - 1
src/views/knowledge-library/model/error-mode/index.tsx

@@ -36,7 +36,7 @@ export default defineComponent({
 
         <div class={styles.resultContent}>
           <span>答案解析:</span>
-          {props.answerAnalysis}
+          {props.answerAnalysis || '无'}
         </div>
 
         <Button

+ 16 - 2
src/views/knowledge-library/practice-mode/index.tsx

@@ -1,4 +1,12 @@
-import { ActionSheet, Button, Image, Popup, Swipe, SwipeItem } from 'vant';
+import {
+  ActionSheet,
+  Button,
+  Image,
+  Popup,
+  Swipe,
+  SwipeItem,
+  showToast
+} from 'vant';
 import {
   computed,
   defineComponent,
@@ -103,7 +111,13 @@ export default defineComponent({
       try {
         const questionList: any = state.questionList || [];
         let currentStatus = true;
-        if (!questionList[state.currentIndex]?.analysis.isAnswer) {
+
+        const question = questionList[state.currentIndex];
+        if (question?.userAnswer?.length <= 0) {
+          showToast('题目尚未做答');
+          return;
+        }
+        if (!question?.analysis.isAnswer) {
           let result: any = {};
           questionList.forEach((question: any, index: number) => {
             // 格式化所有题目的答案