浏览代码

AI古诗词课,处理上一节课显示诗词内容

liyanbo 1 月之前
父节点
当前提交
5aaad0f78b
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      src/views/AIPage/aiGenerate/DialogContent.vue

+ 12 - 2
src/views/AIPage/aiGenerate/DialogContent.vue

@@ -440,8 +440,18 @@ const playPrevious = () => {
     // 显示诗词并替换内容为最新的诗词
     showPoem.value = true
     currentPoemContent.value = currentDialogue.value.content
-    playPrevious()
-    return
+  } else {
+    showPoem.value = false
+    currentPoemContent.value = ""
+    //读取上一条诗词内容显示
+    for (let i = currentDialogueIndex.value; i >= 0; i--) {
+      let dialogueTemp = currentSection.value.dialogues[i];
+      if (dialogueTemp.type === 'poem'){
+        // 显示诗词并替换内容为最新的诗词
+        showPoem.value = true
+        currentPoemContent.value = dialogueTemp.content
+      }
+    }
   }
 
   // 播放背景音