diff --git a/Note.md b/Note.md
index bd132e4b..c3e75098 100644
--- a/Note.md
+++ b/Note.md
@@ -41,4 +41,6 @@ A cold welcome 有bug
[EditAbleText.vue](src%2Fcomponents%2FEditAbleText.vue) 不能自动聚焦
-在文章模式下,背单词时不能调出面板
\ No newline at end of file
+在文章模式下,背单词时不能调出面板
+
+单词发音,点击第二遍时减速
\ No newline at end of file
diff --git a/src/components/Fireworks.vue b/src/components/Fireworks.vue
index a1acf0fc..91392ca3 100644
--- a/src/components/Fireworks.vue
+++ b/src/components/Fireworks.vue
@@ -12,8 +12,8 @@ import shotfire from '@/assets/sound/shotfire.mp3'
import {useSound} from "@/hooks/sound.ts";
const canvas = $ref()
-const [playBoom] = useSound([boom], 3)
-const [playShotfire] = useSound([shotfire], 3)
+const {play: playBoom} = useSound([boom], 3)
+const {play: playShotFire} = useSound([shotfire], 3)
onMounted(() => {
let ctx = canvas.getContext("2d");
@@ -120,7 +120,7 @@ onMounted(() => {
this.dead = false;
this.ba = getRandom(80, 200);
- // playShotfire()
+ // playShotFire()
}
_move() {
diff --git a/src/components/Practice/Practice.vue b/src/components/Practice/Practice.vue
index 0371c5ee..5f9068cf 100644
--- a/src/components/Practice/Practice.vue
+++ b/src/components/Practice/Practice.vue
@@ -58,7 +58,9 @@ watch(() => store.load, n => {
watch([
() => store.current.index,
() => store.current.dictType,
- () => store.currentDict.chapterIndex], n => {
+ () => store.currentDict.chapterIndex,
+ () => store.currentDict.chapterWordNumber,
+], n => {
getCurrentPractice()
})
@@ -130,7 +132,7 @@ function getCurrentPractice() {
}
} else {
wordData.words = cloneDeep(store.chapter)
- wordData.index = store.currentDict.chapterWordIndex
+ wordData.index = 0
console.log('wordData', wordData)
}
}
diff --git a/src/components/Practice/TypeWord.vue b/src/components/Practice/TypeWord.vue
index edd852ee..d40ca2b0 100644
--- a/src/components/Practice/TypeWord.vue
+++ b/src/components/Practice/TypeWord.vue
@@ -36,6 +36,7 @@ let input = $ref('')
let wrong = $ref('')
let showFullWord = $ref(false)
let activeBtnIndex = $ref(-1)
+let wordRepeatCount = $ref(0)
const store = useBaseStore()
const practiceStore = usePracticeStore()
const settingStore = useSettingStore()
@@ -64,8 +65,11 @@ watch(() => props.words, () => {
watch(() => data.index, (n) => {
wrong = input = ''
practiceStore.index = n
- playWordAudio(word.name)
- volumeIconRef?.play()
+ wordRepeatCount = 0
+ if (settingStore.wordSound) {
+ playWordAudio(word.name)
+ volumeIconRef?.play()
+ }
})
const word = $computed(() => {
@@ -135,14 +139,10 @@ function next(isTyping: boolean = true) {
next()
}
}
- wrong = input = ''
}
function prev() {
data.index--
- playWordAudio(word.name)
- volumeIconRef?.play()
- wrong = input = ''
}
function ignore() {
@@ -182,6 +182,18 @@ function onKeyUp(e: KeyboardEvent) {
showFullWord = false
}
+function repeat() {
+ setTimeout(() => {
+ wrong = input = ''
+ wordRepeatCount++
+
+ if (settingStore.wordSound) {
+ playWordAudio(word.name)
+ volumeIconRef?.play()
+ }
+ }, settingStore.waitTimeForChangeWord)
+}
+
async function onKeyDown(e: KeyboardEvent) {
//TODO 还有横杠
if ((e.keyCode >= 65 && e.keyCode <= 90) || e.code === 'Space') {
@@ -192,11 +204,7 @@ async function onKeyDown(e: KeyboardEvent) {
} else {
isWrong = (input + letter) !== word.name.slice(0, input.length + 1)
}
- if (!isWrong) {
- input += letter
- wrong = ''
- playKeyboardAudio()
- } else {
+ if (isWrong) {
if (!store.wrongWordDict.originWords.find((v: Word) => v.name.toLowerCase() === word.name.toLowerCase())) {
store.wrongWordDict.originWords.push(word)
store.wrongWordDict.words.push(word)
@@ -212,10 +220,26 @@ async function onKeyDown(e: KeyboardEvent) {
setTimeout(() => {
wrong = ''
}, 500)
+ } else {
+ input += letter
+ wrong = ''
+ playKeyboardAudio()
}
if (input.toLowerCase() === word.name.toLowerCase()) {
playCorrect()
- setTimeout(next, settingStore.waitTimeForChangeWord)
+ if (settingStore.repeatCount == 100) {
+ if (settingStore.repeatCustomCount === wordRepeatCount + 1) {
+ setTimeout(next, settingStore.waitTimeForChangeWord)
+ } else {
+ repeat()
+ }
+ } else {
+ if (settingStore.repeatCount === wordRepeatCount + 1) {
+ setTimeout(next, settingStore.waitTimeForChangeWord)
+ } else {
+ repeat()
+ }
+ }
}
} else {
// console.log('e', e)
@@ -262,7 +286,7 @@ useOnKeyboardEventListener(onKeyDown, onKeyUp)