fix:add an article deletion function

This commit is contained in:
zyronon
2025-08-28 00:56:07 +08:00
parent db318c926d
commit 411052b08d
3 changed files with 53 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ import Toast from '@/pages/pc/components/base/toast/Toast.ts'
import {getDefaultArticle} from "@/types/func.ts";
import BackIcon from "@/pages/pc/components/BackIcon.vue";
const emit = defineEmits<{
defineEmits<{
importData: [val: Event]
exportData: [val: string]
}>()

View File

@@ -335,7 +335,18 @@ const {playSentenceAudio} = usePlaySentenceAudio()
<div class="name">时间</div>
</div>
<div class="row">
<div class="num">{{ statisticsStore.total }}</div>
<div class="num center gap-1">
{{ statisticsStore.total }}
<Tooltip>
<IconFluentQuestionCircle20Regular width="18"/>
<template #reference>
<div>
统计词数{{ settingStore.ignoreSimpleWord ? '不包含' : '包含' }}简单词不包含已掌握
<div>简单词可在设置 -> 练习设置 -> 简单词过滤中修改</div>
</div>
</template>
</Tooltip>
</div>
<div class="line"></div>
<div class="name">单词总数</div>
</div>

View File

@@ -271,8 +271,47 @@ function del() {
if (wrong) {
wrong = ''
} else {
input = input.slice(0, -1)
if (isEnd) return;
if (isSpace) {
isSpace = false
}
let endSentence = false
let endWord = false
let endString = false
if (stringIndex === 0) {
if (wordIndex === 0) {
if (sentenceIndex === 0) {
if (sectionIndex === 0) {
return
} else {
endSentence = endString = endWord = true
sectionIndex--
}
} else {
endString = endWord = true
sentenceIndex--
}
} else {
endString = true
wordIndex--
}
} else stringIndex--
let currentSection = props.article.sections[sectionIndex]
if (endSentence) sentenceIndex = currentSection.length - 1
let currentSentence = currentSection[sentenceIndex]
if (endWord) wordIndex = currentSentence.words.length - 1
let currentWord: ArticleWord = currentSentence.words[wordIndex]
if (endString) {
if (currentWord.nextSpace) {
isSpace = true
stringIndex = currentWord.word.length
}else {
stringIndex = currentWord.word.length - 1
}
}
input = currentWord.word.slice(0, stringIndex)
}
checkCursorPosition()
}
function indexWord(word: ArticleWord) {