Merge branch 'master' into save3

This commit is contained in:
Zyronon
2025-09-25 22:36:37 +08:00
4 changed files with 35 additions and 44 deletions

View File

@@ -16,21 +16,11 @@ const isMoveBottom = $computed(() => {
</script>
<template>
<span class="word-space"
v-if="isWrong"
:class="[
isWrong && 'wrong',
isWait && 'wait',
isShake ? isMoveBottom ? 'shakeBottom' : 'shake' : '',
isMoveBottom && 'to-bottom'
]"
v-bind="$attrs"
></span>
<span class="word-space wrong" v-if="isWrong"></span>
<span v-bind="$attrs" v-else>
<span class="word-space mx-0.5!"
<span class="word-space wait"
:class="[
isWrong && 'wrong',
isWait && 'wait',
isWait ? 'opacity-100':' opacity-0',
isShake ? isMoveBottom ? 'shakeBottom' : 'shake' : '',
isMoveBottom && 'to-bottom'
]"
@@ -46,6 +36,7 @@ const isMoveBottom = $computed(() => {
height: 1.5rem;
box-sizing: border-box;
margin: 0 1px;
border-bottom: 2px solid transparent;
&.wrong {
border-bottom: 2px solid red;
@@ -57,6 +48,8 @@ const isMoveBottom = $computed(() => {
&.wait {
border-bottom: 2px solid var(--color-article);
margin-left: 0.125rem;
margin-right: 0.125rem;
&::after {
content: ' ';

View File

@@ -521,16 +521,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 = ''
}
})
})
})
@@ -556,7 +554,7 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j, w) {
},
{
label: "有道词典翻译",
children:[
children: [
{
label: "翻译单词",
onClick: () => {
@@ -579,9 +577,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]);
}
@@ -589,9 +587,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]);
}
})
@@ -628,10 +626,10 @@ let showQuestions = $ref(false)
<span class="sentence"
v-for="(sentence,indexJ) in section">
<span
v-for="(word,indexW) in sentence.words"
@contextmenu="e=>onContextMenu(e,sentence,indexI,indexJ,indexW)"
class="word"
:class="[(sectionIndex>indexI
v-for="(word,indexW) in sentence.words"
@contextmenu="e=>onContextMenu(e,sentence,indexI,indexJ,indexW)"
class="word"
:class="[(sectionIndex>indexI
?'wrote':
(sectionIndex>=indexI &&sentenceIndex>indexJ)
?'wrote' :
@@ -657,11 +655,11 @@ let showQuestions = $ref(false)
<span class="border-bottom" v-if="settingStore.dictation"></span>
</span>
<Space
v-if="word.nextSpace"
class="word-end"
:is-wrong="false"
:is-wait="isCurrent(indexI,indexJ,indexW) && isSpace"
:is-shake="isCurrent(indexI,indexJ,indexW) && isSpace && wrong !== ''"
v-if="word.nextSpace"
class="word-end"
:is-wrong="false"
:is-wait="isCurrent(indexI,indexJ,indexW) && isSpace"
:is-shake="isCurrent(indexI,indexJ,indexW) && isSpace && wrong !== ''"
/>
</span>
</span>
@@ -691,11 +689,11 @@ let showQuestions = $ref(false)
<div class="options flex justify-center mb-50" v-if="isEnd">
<BaseButton
@click="init">重新练习
@click="init">重新练习
</BaseButton>
<BaseButton
v-if="store.currentBook.lastLearnIndex < store.currentBook.articles.length - 1"
@click="emit('next')">下一篇
v-if="store.currentBook.lastLearnIndex < store.currentBook.articles.length - 1"
@click="emit('next')">下一篇
</BaseButton>
</div>