fix: fix issue #81

This commit is contained in:
zyronon
2025-08-22 00:40:37 +08:00
parent 611527ea1e
commit 361d6e645c
38 changed files with 67 additions and 71 deletions
+1 -1
View File
@@ -420,7 +420,7 @@ a {
.book {
@extend .anim;
@apply p-4 rounded-md relative cursor-pointer bg-third hover:bg-card-active flex flex-col justify-between shrink-0;
@apply p-3 rounded-md relative cursor-pointer bg-third hover:bg-card-active flex flex-col justify-between shrink-0;
$w: 6rem;
width: $w;
height: calc($w * 1.4);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

Before

Width:  |  Height:  |  Size: 496 B

+7 -11
View File
@@ -1,11 +1,7 @@
import {onMounted, watch, watchEffect} from "vue"
import {useSettingStore} from "@/stores/setting.ts";
import {PronunciationApi} from "@/types/types.ts";
import beep from "@/assets/sound/beep.wav";
import correct from "@/assets/sound/correct.wav";
import {SoundFileOptions} from "@/utils/const.ts";
import {useBaseStore} from "@/stores/base.ts";
export function useSound(audioSrcList?: string[], audioFileLength?: number) {
let audioList: HTMLAudioElement[] = $ref([])
@@ -63,7 +59,7 @@ export function usePlayKeyboardAudio() {
export function usePlayBeep() {
const settingStore = useSettingStore()
const {play} = useSound([beep], 1)
const {play} = useSound([`/sound/beep.wav`], 1)
function playAudio() {
if (settingStore.effectSound) {
@@ -76,7 +72,7 @@ export function usePlayBeep() {
export function usePlayCorrect() {
const settingStore = useSettingStore()
const {play} = useSound([correct], 1)
const {play} = useSound([`/sound/correct.wav`], 1)
function playAudio() {
if (settingStore.effectSound) {
@@ -135,13 +131,13 @@ export function usePlayAudio(url: string) {
export function getAudioFileUrl(name: string) {
if (name === '机械键盘') {
return [
`./sound/key-sounds/jixie/机械0.mp3`,
`./sound/key-sounds/jixie/机械1.mp3`,
`./sound/key-sounds/jixie/机械2.mp3`,
`./sound/key-sounds/jixie/机械3.mp3`,
`/sound/key-sounds/jixie/机械0.mp3`,
`/sound/key-sounds/jixie/机械1.mp3`,
`/sound/key-sounds/jixie/机械2.mp3`,
`/sound/key-sounds/jixie/机械3.mp3`,
]
} else {
return [`./sound/key-sounds/${name}.mp3`]
return [`/sound/key-sounds/${name}.mp3`]
}
}
+4 -4
View File
@@ -30,13 +30,13 @@ const studyProgress = $computed(() => {
<div class="book relative overflow-hidden">
<template v-if="!isAdd">
<div>
<div>{{ item?.name }}</div>
<div class="text-base">{{ item?.name }}</div>
<div class="text-sm line-clamp-3" v-opacity="item.name !== item.description">{{ item?.description }}</div>
</div>
<div class="absolute bottom-4 right-4">
<div class="absolute bottom-3 right-3">
<div>{{ studyProgress }}{{ item?.length }}{{ quantifier }}</div>
</div>
<div class="absolute bottom-2 left-4 right-4">
<div class="absolute bottom-2 left-3 right-3">
<Progress v-if="item?.lastLearnIndex || item.complete" class="mt-1"
:percentage="progress"
:show-text="false"></Progress>
@@ -44,7 +44,7 @@ const studyProgress = $computed(() => {
<Checkbox v-if="showCheckbox"
:model-value="checked"
@change="$emit('check')"
class="absolute left-4 bottom-4"/>
class="absolute left-3 bottom-3"/>
<div class="custom" v-if="item.custom">自定义</div>
</template>
<div v-else class="center h-full">
+35 -24
View File
@@ -267,22 +267,11 @@ function importOldData() {
</SettingItem>
</div>
<div v-if="tabIndex === 1">
<SettingItem title="单词循环设置" class="gap-0!">
<RadioGroup v-model="settingStore.repeatCount">
<Radio :value="1" size="default">1</Radio>
<Radio :value="2" size="default">2</Radio>
<Radio :value="3" size="default">3</Radio>
<Radio :value="5" size="default">5</Radio>
<Radio :value="100" size="default">自定义</Radio>
<SettingItem title="单词练习模式">
<RadioGroup v-model="settingStore.wordPracticeMode" class="flex-col gap-0!">
<Radio :value="0" label="智能模式,系统自动计算复习单词与默写单词"/>
<Radio :value="1" label="自由模式,系统不强制复习与默写"/>
</RadioGroup>
<div class="ml-2 center gap-space" v-if="settingStore.repeatCount === 100">
<span>循环次数</span>
<InputNumber v-model="settingStore.repeatCustomCount"
:min="6"
:max="15"
type="number"
/>
</div>
</SettingItem>
<SettingItem title="显示上一个/下一个单词"
@@ -303,21 +292,20 @@ function importOldData() {
<Switch v-model="settingStore.allowWordTip"/>
</SettingItem>
<SettingItem title="单词练习模式">
<RadioGroup v-model="settingStore.wordPracticeMode" class="flex-col gap-0!">
<Radio :value="0" label="智能模式,系统自动计算复习单词与默写单词"/>
<Radio :value="1" label="自由模式,系统不强制复习与默写"/>
</RadioGroup>
</SettingItem>
<SettingItem title="不默认显示练习设置弹框"
desc="在词典详情页面,点击学习按钮后,是否显示练习设置弹框"
>
<Switch v-model="settingStore.disableShowPracticeSettingDialog"/>
</SettingItem>
<div class="line" v-if="settingStore.autoNextWord"></div>
<SettingItem title="自动切换下一个单词">
<Switch v-model="settingStore.autoNextWord"/>
</SettingItem>
<SettingItem title="自动切换下一个单词时间"
desc="正确输入单词后,自动跳转下一个单词的时间"
v-if="settingStore.autoNextWord"
>
<InputNumber v-model="settingStore.waitTimeForChangeWord"
:min="10"
@@ -327,8 +315,30 @@ function importOldData() {
<span class="ml-4">毫秒</span>
</SettingItem>
<div class="line" v-if="settingStore.autoNextWord"></div>
<SettingItem title="单词循环设置" class="gap-0!">
<RadioGroup v-model="settingStore.repeatCount">
<Radio :value="1" size="default">1</Radio>
<Radio :value="2" size="default">2</Radio>
<Radio :value="3" size="default">3</Radio>
<Radio :value="5" size="default">5</Radio>
<Radio :value="100" size="default">自定义</Radio>
</RadioGroup>
<div class="ml-2 center gap-space" v-if="settingStore.repeatCount === 100">
<span>循环次数</span>
<InputNumber v-model="settingStore.repeatCustomCount"
:min="6"
:max="15"
type="number"
/>
</div>
</SettingItem>
<div class="line"></div>
<SettingItem title="字体设置(仅可调整单词练习)"/>
<SettingItem title="字体设置(仅单词练习界面生效)"/>
<SettingItem title="外语字体">
<Slider
:min="10"
@@ -353,6 +363,7 @@ function importOldData() {
<SettingItem title="简单词列表"
class="items-start!"
v-if="settingStore.ignoreSimpleWord"
>
<Textarea
placeholder="多个单词用英文逗号隔号"
@@ -370,7 +381,7 @@ function importOldData() {
<div class="wrapper" @click="editShortcutKey = item[0]">
<div class="set-key" v-if="editShortcutKey === item[0]">
<input :value="item[1]?item[1]:'未设置快捷键'" readonly type="text" @blur="editShortcutKey = ''">
<span @click.stop="editShortcutKey = ''">直接按键盘进行设置</span>
<span @click.stop="editShortcutKey = ''">按键盘进行设置<span class="text-red!">设置完成点击这里</span></span>
</div>
<div v-else>
<div v-if="item[1]">{{ item[1] }}</div>
+15 -11
View File
@@ -79,7 +79,7 @@ function repeat() {
async function onTyping(e: KeyboardEvent) {
if (inputLock) return
console.log('onTyping')
console.log('onTyping', inputLock)
inputLock = true
let letter = e.key
let isTypingRight = false
@@ -104,17 +104,20 @@ async function onTyping(e: KeyboardEvent) {
if (input.toLowerCase() === props.word.word.toLowerCase()) {
playCorrect()
if (settingStore.repeatCount == 100) {
if (settingStore.repeatCustomCount <= wordRepeatCount + 1) {
setTimeout(() => emit('complete'), settingStore.waitTimeForChangeWord)
//不需要把inputLock设为false,输入完成不能再输入了,只能删除,删除会打开锁
if (settingStore.autoNextWord) {
if (settingStore.repeatCount == 100) {
if (settingStore.repeatCustomCount <= wordRepeatCount + 1) {
setTimeout(() => emit('complete'), settingStore.waitTimeForChangeWord)
} else {
repeat()
}
} else {
repeat()
}
} else {
if (settingStore.repeatCount <= wordRepeatCount + 1) {
setTimeout(() => emit('complete'), settingStore.waitTimeForChangeWord)
} else {
repeat()
if (settingStore.repeatCount <= wordRepeatCount + 1) {
setTimeout(() => emit('complete'), settingStore.waitTimeForChangeWord)
} else {
repeat()
}
}
}
} else {
@@ -124,6 +127,7 @@ async function onTyping(e: KeyboardEvent) {
function del() {
playKeyboardAudio()
inputLock = false
if (wrong) {
wrong = ''
+1 -1
View File
@@ -33,7 +33,7 @@ export const DefaultBaseState = (): BaseState => ({
bookList: [
getDefaultDict({id: DictId.wordCollect, name: '收藏'}),
getDefaultDict({id: DictId.wordWrong, name: '错词'}),
getDefaultDict({id: DictId.wordKnown, name: '已掌握'}),
getDefaultDict({id: DictId.wordKnown, name: '已掌握',description:'已掌握后的单词不会出现在练习中'}),
// getDefaultDict({
// id: 'nce-new-2',
// name: '新概念英语(新版)-2',
+3 -1
View File
@@ -43,6 +43,7 @@ export interface SettingState {
ignoreSimpleWord: boolean // 忽略简单词
wordPracticeMode: number // 单词练习模式,0:智能模式,1:自由模式
disableShowPracticeSettingDialog: boolean // 不默认显示练习设置弹框
autoNextWord: boolean //自动切换下一个单词
}
export const getDefaultSettingState = (): SettingState => ({
@@ -84,7 +85,8 @@ export const getDefaultSettingState = (): SettingState => ({
conflictNotice: true,
ignoreSimpleWord: false,
wordPracticeMode: 0,
disableShowPracticeSettingDialog: false
disableShowPracticeSettingDialog: false,
autoNextWord: true
})
export const useSettingStore = defineStore('setting', {
-16
View File
@@ -1,10 +1,3 @@
import bookFlag from "@/assets/img/flags/book.png";
import enFlag from "@/assets/img/flags/en.png";
import jaFlag from "@/assets/img/flags/ja.png";
import deFlag from "@/assets/img/flags/de.png";
import codeFlag from "@/assets/img/flags/code.png";
import myFlag from "@/assets/img/flags/my.png";
export type Word = {
id?: string,
custom?: boolean,
@@ -158,15 +151,6 @@ export enum TranslateEngine {
Baidu = 0,
}
export const languageCategoryOptions = [
{id: 'article', name: '文章', flag: bookFlag},
{id: 'en', name: '英语', flag: enFlag},
{id: 'ja', name: '日语', flag: jaFlag},
{id: 'de', name: '德语', flag: deFlag},
{id: 'code', name: 'Code', flag: codeFlag},
{id: 'my', name: '我的', flag: myFlag},
]
export type DictResource = {
id: string
name: string
+1 -1
View File
@@ -14,7 +14,7 @@ export const SAVE_DICT_KEY = {
}
export const SAVE_SETTING_KEY = {
key: 'typing-word-setting',
version: 11
version: 12
}
export const EXPORT_DATA_KEY = {
key: 'typing-word-export',