From d70fd1a4a73d79576b0125f17118ce0e60a4c846 Mon Sep 17 00:00:00 2001 From: Zyronon Date: Thu, 25 Sep 2025 19:31:12 +0800 Subject: [PATCH] Update TypingArticle.vue --- .../article/components/TypingArticle.vue | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/pages/article/components/TypingArticle.vue b/src/pages/article/components/TypingArticle.vue index 5ebb7360..25a86a41 100644 --- a/src/pages/article/components/TypingArticle.vue +++ b/src/pages/article/components/TypingArticle.vue @@ -522,16 +522,14 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j, w) { stringIndex = 0 input = wrong = '' isEnd = isSpace = false - let currentSection = props.article.sections[sectionIndex] - currentSection.slice(sentenceIndex).map(w => { - w.words.map(v => { - v.input = '' - }) - }) - props.article.sections.slice(sectionIndex + 1).map((v, i) => { - v.map((w) => { - w.words.map(v => { - v.input = '' + props.article.sections.map((v, i) => { + v.map((w, j) => { + w.words.map((v, k) => { + if (i <= sectionIndex && j <= sentenceIndex && k < wordIndex) { + v.input = v.word + } else { + v.input = '' + } }) }) }) @@ -557,7 +555,7 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j, w) { }, { label: "有道词典翻译", - children:[ + children: [ { label: "翻译单词", onClick: () => { @@ -580,9 +578,9 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j, w) { onMounted(() => { // 初始化当前单词信息 if (props.article.sections && - props.article.sections[sectionIndex] && - props.article.sections[sectionIndex][sentenceIndex] && - props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]) { + props.article.sections[sectionIndex] && + props.article.sections[sectionIndex][sentenceIndex] && + props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]) { updateCurrentWordInfo(props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]); } @@ -590,9 +588,9 @@ onMounted(() => { wrong = input = '' // 重置时更新当前单词信息 if (props.article.sections && - props.article.sections[sectionIndex] && - props.article.sections[sectionIndex][sentenceIndex] && - props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]) { + props.article.sections[sectionIndex] && + props.article.sections[sectionIndex][sentenceIndex] && + props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]) { updateCurrentWordInfo(props.article.sections[sectionIndex][sentenceIndex].words[wordIndex]); } }) @@ -629,10 +627,10 @@ let showQuestions = $ref(false) @@ -692,11 +690,11 @@ let showQuestions = $ref(false)
重新练习 + @click="init">重新练习 下一篇 + v-if="store.currentBook.lastLearnIndex < store.currentBook.articles.length - 1" + @click="emit('next')">下一篇