chore: update
This commit is contained in:
@@ -4,7 +4,7 @@ import {$computed, $ref} from "vue/macros"
|
||||
import {onMounted, onUnmounted} from "vue"
|
||||
import {useBaseStore} from "@/stores/base.ts"
|
||||
import Tooltip from "@/components/Tooltip.vue"
|
||||
import {usePracticeStore} from "@/components/Practice/practice.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import {Icon} from "@iconify/vue";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import Toolbar from "@/components/Toolbar/Toolbar.vue"
|
||||
import {onMounted, watch} from "vue";
|
||||
import {usePracticeStore} from "@/components/Practice/practice.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import Footer from "@/components/Practice/Footer.vue";
|
||||
import TypeWord from "@/components/Practice/TypeWord.vue";
|
||||
import TypeArticle from "@/components/Practice/TypeArticle.vue";
|
||||
@@ -11,6 +11,7 @@ import {$ref} from "vue/macros";
|
||||
import Statistics from "@/components/Practice/Statistics.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus";
|
||||
import {useSettingStore} from "@/stores/setting";
|
||||
import {cloneDeep} from "lodash-es";
|
||||
|
||||
const practiceStore = usePracticeStore()
|
||||
const store = useBaseStore()
|
||||
@@ -1143,7 +1144,12 @@ watch(() => store.load, n => {
|
||||
})
|
||||
|
||||
function getCurrentWords() {
|
||||
wordData.words = store.chapter
|
||||
wordData.words = cloneDeep(store.chapter)
|
||||
wordData.index = 0
|
||||
}
|
||||
|
||||
function getCurrentArticle() {
|
||||
wordData.words = cloneDeep(store.chapter)
|
||||
wordData.index = 0
|
||||
}
|
||||
|
||||
@@ -1152,18 +1158,21 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
function write() {
|
||||
console.log('write')
|
||||
settingStore.dictation = true
|
||||
repeat()
|
||||
}
|
||||
|
||||
//TODO 需要判断是否已忽略
|
||||
function repeat() {
|
||||
console.log('repeat')
|
||||
getCurrentWords()
|
||||
emitter.emit(EventKey.resetWord)
|
||||
}
|
||||
|
||||
//TODO 能否下一章
|
||||
function next() {
|
||||
console.log('next')
|
||||
store.currentDict.chapterIndex++
|
||||
repeat()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {onMounted, reactive} from "vue";
|
||||
import {cloneDeep} from "lodash-es";
|
||||
import {Icon} from '@iconify/vue';
|
||||
import {usePracticeStore} from "@/components/Practice/practice.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -3,7 +3,7 @@ import {computed, nextTick, watchEffect} from "vue"
|
||||
import {$ref} from "vue/macros";
|
||||
import {Article, ArticleWord, ShortKeyMap, Word} from "@/types";
|
||||
import {useBaseStore} from "@/stores/base";
|
||||
import {usePracticeStore} from "@/components/Practice/practice.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import TypeWord from "@/components/Practice/TypeWord.vue";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {usePlayBeep, usePlayCorrect, usePlayKeyboardAudio, usePlayWordAudio} from "@/hooks/sound.ts";
|
||||
|
||||
@@ -6,7 +6,7 @@ import {DictType, DisplayStatistics, ShortKeyMap, Statistics, Word} from "../../
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts"
|
||||
import {cloneDeep} from "lodash-es"
|
||||
import {usePracticeStore} from "@/components/Practice/practice.ts"
|
||||
import {usePracticeStore} from "@/stores/practice.ts"
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {usePlayBeep, usePlayCorrect, usePlayKeyboardAudio, usePlayWordAudio} from "@/hooks/sound.ts";
|
||||
import {useEventListener} from "@/hooks/event.ts";
|
||||
@@ -111,7 +111,7 @@ function next() {
|
||||
data.index++
|
||||
practiceStore.inputNumber++
|
||||
console.log('这个词完了')
|
||||
if ([DictType.customDict, DictType.innerDict].includes(store.current.dictType)
|
||||
if ([DictType.customDict, DictType.publicDict].includes(store.current.dictType)
|
||||
&& store.skipWordNames.includes(word.name.toLowerCase())) {
|
||||
next()
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import {defineStore} from "pinia"
|
||||
import {Word} from "@/types.ts"
|
||||
|
||||
export interface PracticeState {
|
||||
type: 'word' | 'article',
|
||||
wrongWords: Word[],
|
||||
repeatNumber: number,
|
||||
startDate: number,
|
||||
total: number,
|
||||
inputNumber: number,
|
||||
wrongNumber: number,
|
||||
correctRate: number,
|
||||
}
|
||||
|
||||
export const usePracticeStore = defineStore('practice', {
|
||||
state: (): PracticeState => {
|
||||
return {
|
||||
// type: 'article',
|
||||
type: 'word',
|
||||
wrongWords: [],
|
||||
repeatNumber: 0,
|
||||
startDate: Date.now(),
|
||||
correctRate: -1,
|
||||
total: 0,
|
||||
inputNumber: 0,
|
||||
wrongNumber: 0,
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -32,7 +32,7 @@ onMounted(() => {
|
||||
return tabIndex = 3;
|
||||
case DictType.wrongDict:
|
||||
return tabIndex = 2;
|
||||
case DictType.innerDict:
|
||||
case DictType.publicDict:
|
||||
case DictType.customDict:
|
||||
return tabIndex = 0;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ const newWordDictActiveIndex = computed(() => {
|
||||
})
|
||||
|
||||
const dictActiveIndex = computed(() => {
|
||||
if (store.current.dictType !== DictType.innerDict) return -1
|
||||
if (store.current.dictType !== DictType.publicDict) return -1
|
||||
else {
|
||||
if (store.current.repeatNumber) {
|
||||
return store.chapter.findIndex(v => v.name === store.word.name)
|
||||
@@ -108,7 +108,7 @@ const skipWordDictActiveIndex = computed(() => {
|
||||
:isActive="store.sideIsOpen && tabIndex === 0"
|
||||
:list="store.dict.chapterWords[store.dict.chapterIndex]??[]"
|
||||
:activeIndex="dictActiveIndex"/>
|
||||
<footer v-if="![DictType.customDict,DictType.innerDict].includes(store.current.dictType)">
|
||||
<footer v-if="![DictType.customDict,DictType.publicDict].includes(store.current.dictType)">
|
||||
<PopConfirm
|
||||
:title="`确认切换?`"
|
||||
@confirm="store.changeDict(store.dict)"
|
||||
|
||||
@@ -40,7 +40,7 @@ async function selectDict(item: Dict) {
|
||||
currentSelectDict = {
|
||||
...item,
|
||||
sort: Sort.normal,
|
||||
type: DictType.innerDict,
|
||||
type: DictType.publicDict,
|
||||
originWords: [],
|
||||
words: [],
|
||||
chapterWordNumber: 15,
|
||||
|
||||
@@ -16,10 +16,12 @@ import RepeatSetting from "@/components/Toolbar/RepeatSetting.vue";
|
||||
import TranslateSetting from "@/components/Toolbar/TranslateSetting.vue";
|
||||
import Add from "@/components/Toolbar/Add.vue";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
|
||||
const {toggle} = useTheme()
|
||||
const store = useBaseStore()
|
||||
const settingStore = useSettingStore()
|
||||
const practiceStore = usePracticeStore()
|
||||
|
||||
const showFeedbackModal = $ref(false)
|
||||
const showSettingModal = $ref(false)
|
||||
@@ -42,7 +44,7 @@ watch(() => settingStore.showToolbar, n => {
|
||||
<header ref="headerRef">
|
||||
<div class="content">
|
||||
<div class="info" @click="showDictModal = true">
|
||||
{{ store.dictTitle }}
|
||||
{{ store.dictTitle }} {{ practiceStore.repeatNumber ? ' 复习错词' : ''}}
|
||||
</div>
|
||||
<div class="options">
|
||||
<Tooltip title="切换主题">
|
||||
|
||||
Reference in New Issue
Block a user