save
This commit is contained in:
@@ -6,7 +6,7 @@ import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import Footer from "@/pages/pc/practice/Footer.vue";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
|
||||
import Statistics from "@/pages/pc/practice/Statistics.vue";
|
||||
import Statistics from "@/pages/pc/word/Statistics.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
|
||||
@@ -6,7 +6,7 @@ import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import Footer from "@/pages/pc/practice/Footer.vue";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
|
||||
import Statistics from "@/pages/pc/practice/Statistics.vue";
|
||||
import Statistics from "@/pages/pc/word/Statistics.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
|
||||
@@ -62,9 +62,6 @@ let current = $ref({
|
||||
wrongWords: [],
|
||||
})
|
||||
|
||||
let showSortOption = $ref(false)
|
||||
useWindowClick(() => showSortOption = false)
|
||||
|
||||
watch(() => props.data, () => {
|
||||
current.words = props.data.new
|
||||
current.index = 0
|
||||
@@ -76,7 +73,7 @@ watch(() => props.data, () => {
|
||||
statStore.correctRate = -1
|
||||
statStore.inputWordNumber = 0
|
||||
statStore.wrongWordNumber = 0
|
||||
statStore.total = props.data.review.concat(props.data.new).length
|
||||
statStore.total = props.data.review.concat(props.data.new).concat(props.data.write).length
|
||||
statStore.newWordNumber = props.data.new.length
|
||||
statStore.index = 0
|
||||
}, {immediate: true, deep: true})
|
||||
@@ -97,11 +94,11 @@ function next(isTyping: boolean = true) {
|
||||
if (current.index === current.words.length - 1) {
|
||||
if (current.wrongWords.length) {
|
||||
console.log('学完了,但还有错词')
|
||||
current.words = cloneDeep(current.wrongWords)
|
||||
current.words = shuffle(current.wrongWords)
|
||||
current.index = 0
|
||||
current.wrongWords = []
|
||||
} else {
|
||||
console.log('学完了,没错词', statStore.total, statStore.step,current.index,current.words)
|
||||
console.log('学完了,没错词', statStore.total, statStore.step, current.index, current.words)
|
||||
isTyping && statStore.inputWordNumber++
|
||||
statStore.speed = Date.now() - statStore.startDate
|
||||
|
||||
@@ -199,17 +196,6 @@ function play() {
|
||||
typingRef.play()
|
||||
}
|
||||
|
||||
function sort(type: Sort) {
|
||||
if (type === Sort.reverse) {
|
||||
ElMessage.success('已翻转排序')
|
||||
emit('sort', reverse(cloneDeep(current.words)))
|
||||
}
|
||||
if (type === Sort.random) {
|
||||
ElMessage.success('已随机排序')
|
||||
emit('sort', shuffle(current.words))
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
emitter.on(ShortcutKey.ShowWord, show)
|
||||
emitter.on(ShortcutKey.Previous, prev)
|
||||
@@ -228,6 +214,21 @@ onUnmounted(() => {
|
||||
emitter.off(ShortcutKey.PlayWordPronunciation, play)
|
||||
})
|
||||
|
||||
const status = $computed(() => {
|
||||
let str = '正在'
|
||||
switch (statStore.step) {
|
||||
case 0:
|
||||
str += `学习新单词`
|
||||
break
|
||||
case 1:
|
||||
str += '复习上次学习'
|
||||
break
|
||||
case 2:
|
||||
str += '默写所有单词'
|
||||
break
|
||||
}
|
||||
return str
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -279,30 +280,12 @@ onUnmounted(() => {
|
||||
v-loading="!store.load"
|
||||
>
|
||||
<div class="list-header">
|
||||
<div>
|
||||
{{ statStore.step }}
|
||||
{{ statStore.step ? '复习' : '学习' }}
|
||||
{{ current.words.length }}个单词
|
||||
<div class="flex items-center gap-1">
|
||||
<Icon icon="material-symbols:hourglass-empty-rounded" />
|
||||
<span class="text-sm"> {{ status }}</span>
|
||||
</div>
|
||||
<div style="position:relative;"
|
||||
@click.stop="null">
|
||||
<BaseIcon
|
||||
title="改变顺序"
|
||||
icon="icon-park-outline:sort-two"
|
||||
@click="showSortOption = !showSortOption"
|
||||
/>
|
||||
<MiniDialog
|
||||
v-model="showSortOption"
|
||||
style="width: 9rem;"
|
||||
>
|
||||
<div class="mini-row-title">
|
||||
列表循环设置
|
||||
</div>
|
||||
<div class="mini-row">
|
||||
<BaseButton size="small" @click="sort(Sort.reverse)">翻转</BaseButton>
|
||||
<BaseButton size="small" @click="sort(Sort.random)">随机</BaseButton>
|
||||
</div>
|
||||
</MiniDialog>
|
||||
<div class="flex items-center gap-2">
|
||||
<span> {{ current.index}} / {{ current.words.length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<WordList
|
||||
|
||||
@@ -76,13 +76,13 @@ const isEnd = $computed(() => {
|
||||
<Ring
|
||||
:value="statStore.newWordNumber"
|
||||
desc="New"
|
||||
:percentage="35"
|
||||
:percentage="40"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex justify-center gap-10">
|
||||
<div class="flex justify-center items-center py-3 px-10 rounded-md color-red-500 flex-col"
|
||||
style="background: rgb(254,236,236)">
|
||||
<div class="text-3xl">{{ statStore.inputWordNumber }}</div>
|
||||
<div class="text-3xl">{{ statStore.wrongWordNumber }}</div>
|
||||
<div class="center gap-2">
|
||||
<Icon icon="iconamoon:close" class="text-2xl"/>
|
||||
错词
|
||||
@@ -90,7 +90,7 @@ const isEnd = $computed(() => {
|
||||
</div>
|
||||
<div class="flex justify-center items-center py-3 px-10 rounded-md color-green-600 flex-col"
|
||||
style="background: rgb(231,248,241)">
|
||||
<div class="text-3xl">{{ statStore.total - statStore.inputWordNumber }}</div>
|
||||
<div class="text-3xl">{{ statStore.total - statStore.wrongWordNumber }}</div>
|
||||
<div class="center gap-2">
|
||||
<Icon icon="tabler:check" class="text-2xl"/>
|
||||
正确
|
||||
@@ -127,7 +127,7 @@ const isEnd = $computed(() => {
|
||||
<Fireworks v-if="open"/>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
@import "@/assets/css/style";
|
||||
@import "@/assets/css/variable";
|
||||
|
||||
$card-radius: .5rem;
|
||||
$dark-second-bg: rgb(60, 63, 65);
|
||||
@@ -6,7 +6,7 @@ import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import Footer from "@/pages/pc/practice/Footer.vue";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
|
||||
import Statistics from "@/pages/pc/practice/Statistics.vue";
|
||||
import Statistics from "@/pages/pc/word/Statistics.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
|
||||
@@ -8,7 +8,7 @@ import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import {useNav} from "@/utils";
|
||||
import BasePage from "@/pages/pc/components/BasePage.vue";
|
||||
import {getDefaultDict} from "@/types.ts";
|
||||
import {onMounted} from "vue";
|
||||
import {onMounted, watch} from "vue";
|
||||
import {getCurrentStudyWord} from "@/hooks/dict.ts";
|
||||
import {c} from "vite/dist/node/types.d-aGj9QkWt";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
@@ -34,13 +34,20 @@ let currentStudy = $ref({
|
||||
review: [],
|
||||
write: []
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
currentStudy = getCurrentStudyWord()
|
||||
watch(() => store.load, n => {
|
||||
if (n) {
|
||||
currentStudy = getCurrentStudyWord()
|
||||
}
|
||||
})
|
||||
|
||||
function study(){
|
||||
nav('study-word',{},currentStudy)
|
||||
onMounted(() => {
|
||||
if (!currentStudy.new.length) {
|
||||
currentStudy = getCurrentStudyWord()
|
||||
}
|
||||
})
|
||||
|
||||
function study() {
|
||||
nav('study-word', {}, currentStudy)
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -103,7 +110,8 @@ function study(){
|
||||
<div class="flex-1 flex flex-col items-center">
|
||||
<div class="text-4xl font-bold">{{
|
||||
currentStudy.new.length + currentStudy.review.length + currentStudy.write.length
|
||||
}}</div>
|
||||
}}
|
||||
</div>
|
||||
<div class="text">默写数</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -138,7 +138,7 @@ export const DefaultBaseState = (): BaseState => ({
|
||||
word: {
|
||||
dictIndex: 0,
|
||||
perDayStudyNumber: 20,
|
||||
lastLearnIndex: 0,
|
||||
lastLearnIndex: 100,
|
||||
},
|
||||
article: {
|
||||
dictIndex: 0,
|
||||
|
||||
Reference in New Issue
Block a user