diff --git a/public/dicts/en/article/NCE_2.json b/public/dicts/en/article/NCE_2.json index c53e4069..7933292a 100644 --- a/public/dicts/en/article/NCE_2.json +++ b/public/dicts/en/article/NCE_2.json @@ -32,7 +32,7 @@ { "title": "An exciting trip", "titleTranslate": "激动人心的旅行", - "text": "I have just received a letter from my brother, Tim. \nHe is in Australia. \nHe has been there for six months. \nTim is an engineer. \nHe is working for a big firm and he has already visited a great number of different places in Australia. \nHe has just bought an Australian car and has gone to Alice springs, a small town in the centre of Australia. \nHe will soon visit Darwin. \nFrom there, he will fly to Perth. \nMy brother has never been abroad before, so he is fending this trip very exciting.", + "text": "I have just received a letter from my brother, Tim. \nHe is in Australia. \nHe has been there for six months. \nTim is an engineer. \nHe is working for a big firm and he has already visited a great number of different places in Australia. \nHe has just bought an Australian car and has gone to Alice springs, a small town in the centre of Australia. \nHe will soon visit Darwin. \nFrom there, he will fly to Perth. \nMy brother has never been abroad before, so he is finding this trip very exciting.", "textTranslate": "我刚刚收到弟弟蒂姆的来信, \n他正在澳大利亚。 \n他在那儿已经住了6个月了。 \n蒂姆是个工程师, \n正在一家大公司工作,并且已经去过澳大利亚的不少地方了。 \n他刚买了一辆澳大利亚小汽车,现在去了澳大利亚中部的小镇艾利斯斯普林斯。 \n他不久还将到达达尔文去, \n从那里,他再飞往珀斯。 \n我弟弟以前从未出过国,因此,他觉得这次旅行非常激动人心。", "newWords": [], "audioSrc": "/sound/article/nce2-1/An exciting trip.mp3", diff --git a/public/wechat.png b/public/wechat.png index 1de0dc56..1dc0194e 100644 Binary files a/public/wechat.png and b/public/wechat.png differ diff --git a/src/hooks/article.ts b/src/hooks/article.ts index 23a3f752..5e0d4a9f 100644 --- a/src/hooks/article.ts +++ b/src/hooks/article.ts @@ -4,6 +4,7 @@ import nlp from "compromise/one"; import {usePlayWordAudio} from "@/hooks/sound.ts"; import {getSentenceAllText, getSentenceAllTranslateText} from "@/hooks/translate.ts"; import {getDefaultArticleWord} from "@/types/func.ts"; +import {useSettingStore} from "@/stores/setting.ts"; interface KeyboardMap { Period: string, @@ -534,6 +535,7 @@ export function getTranslateText(article: Article) { export function usePlaySentenceAudio() { const playWordAudio = usePlayWordAudio() + const settingStore = useSettingStore() let timer = $ref(0) function playSentenceAudio(sentence: Sentence, ref?: HTMLAudioElement, article?: Article) { @@ -543,6 +545,7 @@ export function usePlaySentenceAudio() { ref.pause() } let start = sentence.audioPosition[0]; + ref.volume = settingStore.wordSoundVolume / 100 ref.currentTime = start ref.play() let end = sentence.audioPosition?.[1] diff --git a/src/pages/pc/article/StudyArticle.vue b/src/pages/pc/article/StudyArticle.vue index cd2ac8c8..64449e17 100644 --- a/src/pages/pc/article/StudyArticle.vue +++ b/src/pages/pc/article/StudyArticle.vue @@ -149,6 +149,7 @@ function setArticle(val: Article) { articleData.article.sections.map((v, i) => { v.map((w, j) => { w.words.map(s => { + s.input = '' if (!ignoreList.includes(s.word.toLowerCase()) && !s.isSymbol) { statisticsStore.total++ } @@ -188,6 +189,10 @@ function edit(val: Article = articleData.article) { function wrong(word: Word) { let temp = word.word.toLowerCase(); + //过滤简单词 + if (settingStore.ignoreSimpleWord) { + if (this.simpleWords.includes(temp)) return + } if (!allWrongWords.has(word.word.toLowerCase())) { allWrongWords.add(word.word.toLowerCase()) statisticsStore.wrong++ @@ -277,6 +282,12 @@ onUnmounted(() => { let audioRef = $ref() const {playSentenceAudio} = usePlaySentenceAudio() +function play2(e) { + if (settingStore.wordSound || e.handle) { + playSentenceAudio(e.sentence, audioRef, articleData.article) + } +} + diff --git a/src/pages/pc/article/components/TypingArticle.vue b/src/pages/pc/article/components/TypingArticle.vue index 929ba5b8..cbb2532d 100644 --- a/src/pages/pc/article/components/TypingArticle.vue +++ b/src/pages/pc/article/components/TypingArticle.vue @@ -35,7 +35,10 @@ const props = withDefaults(defineProps(), { const emit = defineEmits<{ ignore: [], wrong: [val: Word], - play: [val: Sentence], + play: [val: { + sentence: Sentence, + handle: boolean + }], nextWord: [val: ArticleWord], complete: [], next: [], @@ -180,10 +183,10 @@ function nextSentence() { isEnd = true emit('complete') } else { - emit('play', props.article.sections[sectionIndex][0]) + emit('play', {sentence: props.article.sections[sectionIndex][0], handle: false}) } } else { - emit('play', currentSection[sentenceIndex]) + emit('play', {sentence: currentSection[sentenceIndex], handle: false}) } lockNextSentence = false } @@ -224,7 +227,7 @@ function onTyping(e: KeyboardEvent) { playKeyboardAudio() } else { if (sectionIndex === 0 && sentenceIndex === 0 && wordIndex === 0 && stringIndex === 0) { - emit('play', currentSection[sentenceIndex]) + emit('play', {sentence: currentSection[sentenceIndex], handle: false}) } let letter = e.key @@ -239,7 +242,7 @@ function onTyping(e: KeyboardEvent) { isRight = key === letter } if (!isRight) { - if (!currentWord.isSymbol){ + if (!currentWord.isSymbol) { emit('wrong', currentWord) } playBeep() @@ -273,7 +276,7 @@ function onTyping(e: KeyboardEvent) { function play() { let currentSection = props.article.sections[sectionIndex] - emit('play', currentSection[sentenceIndex]) + emit('play', {sentence: currentSection[sentenceIndex], handle: true}) } function del() { @@ -347,13 +350,13 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j) { sentenceIndex = j wordIndex = 0 stringIndex = 0 - emit('play', sentence) + emit('play', {sentence: sentence, handle: false}) } }, { label: "播放", onClick: () => { - emit('play', sentence) + emit('play', {sentence: sentence, handle: false}) } }, {