Procházet zdrojové kódy

对话课文编辑单条对话不上屏问题

natasha před 1 týdnem
rodič
revize
d8abb7e5d9

+ 9 - 6
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -830,15 +830,18 @@ export default {
         return;
       }
       let textList = this.textInput.trim().split('\n');
-      for (let i = 0; i < textList.length; i++) {
-        if (textList[i].trim()) {
-          if (textList[i].indexOf(':') === -1) {
-            // 如果不包含描述、语境或者角色名
-            this.$message.error('缺少角色或语境,请补全');
-            return false;
+      if (textList.length > 1) {
+        for (let i = 0; i < textList.length; i++) {
+          if (textList[i].trim()) {
+            if (textList[i].indexOf(':') === -1) {
+              // 如果不包含描述、语境或者角色名
+              this.$message.error('缺少角色或语境,请补全');
+              return false;
+            }
           }
         }
       }
+
       textList.forEach((item) => {
         if (item.trim()) {
           let obj = {