Skip to content

Commit ec69743

Browse files
committed
wip: test
1 parent 7974b86 commit ec69743

7 files changed

Lines changed: 49 additions & 17 deletions

File tree

apps/nuxt/app/components/FsrsRecordsTable.client.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ function getStateName(state: number | undefined): string {
4949
}
5050
return stateMap[state ?? -1] ?? '未知'
5151
}
52+
function getScheduledDays(state: number | undefined): string {
53+
return state === 0 ? '立刻' : state + '天后'
54+
}
5255
</script>
5356

5457
<template>
@@ -72,28 +75,32 @@ function getStateName(state: number | undefined): string {
7275
>
7376
<vxe-column type="seq" width="60" title="序号" fixed="left" />
7477
<vxe-column field="word" title="单词" min-width="120" fixed="left" sortable />
75-
<vxe-column field="last_review" title="最近复习日期" min-width="160" sortable>
78+
<vxe-column field="last_review" title="最近复习时间" min-width="160" sortable>
7679
<template #default="{ row }">
7780
{{ formatDate(row.last_review as string | Date | null | undefined) }}
7881
</template>
7982
</vxe-column>
80-
<vxe-column field="due" title="下次复习日期" min-width="160" sortable>
83+
<vxe-column field="due" title="下次复习时间" min-width="160" sortable>
8184
<template #default="{ row }">
8285
{{ formatDate(row.due as string | Date | null | undefined) }}
8386
</template>
8487
</vxe-column>
88+
<vxe-column field="scheduled_days" title="复习间隔" min-width="90" sortable>
89+
<template #default="{ row }">
90+
{{ getScheduledDays(row.scheduled_days) }}
91+
</template>
92+
</vxe-column>
8593
<vxe-column field="state" title="状态" min-width="100" sortable>
8694
<template #default="{ row }">
8795
{{ getStateName(row.state) }}
8896
</template>
8997
</vxe-column>
90-
<vxe-column field="stability" title="记忆稳定性" min-width="100" sortable />
91-
<vxe-column field="difficulty" title="难度" min-width="80" sortable />
92-
<!-- <vxe-column field="elapsed_days" title="经过天数" min-width="90" sortable/>-->
93-
<vxe-column field="scheduled_days" title="计划间隔" min-width="90" sortable />
94-
<!-- <vxe-column field="learning_steps" title="学习步骤" min-width="90" />-->
9598
<vxe-column field="reps" title="复习次数" min-width="90" sortable />
9699
<vxe-column field="lapses" title="遗忘次数" min-width="90" sortable />
100+
<!-- <vxe-column field="elapsed_days" title="经过天数" min-width="90" sortable/>-->
101+
<!-- <vxe-column field="learning_steps" title="学习步骤" min-width="90" />-->
102+
<vxe-column field="stability" title="记忆稳定性" min-width="100" sortable />
103+
<vxe-column field="difficulty" title="难度" min-width="80" sortable />
97104
</vxe-table>
98105
</div>
99106
</template>

apps/nuxt/app/components/practice-words-v2/PracticeOnboardingHostV2.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,5 @@ watchOnce(
9595
<template>
9696
<ConflictNotice v-if="showConflictNotice" />
9797
<CollectNotice v-model="showCollectNotice" />
98-
<ConflictNotice2 v-if="showConflictNotice2" v-model="showConflictNotice2" />
98+
<ConflictNotice2 v-model="showConflictNotice2" />
9999
</template>

apps/nuxt/app/components/practice-words-v2/TypeWordV2.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { useInjectedDisplayPolicy } from '~/composables/practice-words/usePracti
2424
import { emitter, EventKey } from '@typewords/core/utils/eventBus.ts'
2525
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
2626
import WordLookupPopover from '@typewords/core/components/word/WordLookupPopover.vue'
27-
import { BaseButton, BaseIcon, Textarea, ToastComponent, Tooltip, VolumeIcon } from '@typewords/base'
27+
import { BaseButton, BaseIcon, Textarea, Toast, ToastComponent, Tooltip, VolumeIcon } from '@typewords/base'
2828
import { useI18n } from 'vue-i18n'
2929
import { useWordOptions } from '@typewords/core/hooks/dict.ts'
3030
import { openWordCollectPicker } from '@typewords/core/hooks/useWordCollectPicker.ts'
@@ -233,19 +233,30 @@ const isWordTestVal = computed(() => {
233233
return props.practiceType === WordPracticeType.Identify && settingStore.identifyMethod === IdentifyMethod.WordTest
234234
})
235235
236+
let showNotice = false
237+
236238
function onIdentifyKnow() {
237239
if (isWordTestVal.value) {
238240
// WordTest 选对
239241
typingCoreRef?.setWordTestResult?.(true, props.word.word)
240242
playCorrect()
241243
emit('know')
244+
245+
if (!showNotice) {
246+
Toast.info($t('press_space_continue'), { duration: 5000 })
247+
showNotice = true
248+
}
242249
return
243250
}
244251
// SelfAssessment "认识"
245252
if (!showWordResult) {
246253
showWordResult = true
247254
typingCoreRef?.revealWord?.(props.word.word)
248255
emit('know')
256+
if (!showNotice) {
257+
Toast.info($t('know_word_tip'), { duration: 5000 })
258+
showNotice = true
259+
}
249260
}
250261
}
251262
@@ -256,6 +267,11 @@ function onIdentifyWrong() {
256267
playBeep()
257268
emit('wrong')
258269
playWord(WordPlayTrigger.Typo)
270+
271+
if (!showNotice) {
272+
Toast.info($t('press_space_continue'), { duration: 5000 })
273+
showNotice = true
274+
}
259275
return
260276
}
261277
// 其他情况透传
@@ -283,7 +299,7 @@ const notice = $computed(() => {
283299
: props.practiceType === WordPracticeType.Listen
284300
? '输入完成后按空格键切换下一个'
285301
: showWordResult
286-
? typingCoreRef?.right
302+
? typingCoreRef?.isWordRight()
287303
? '按空格键切换下一个'
288304
: $t('press_delete_reinput')
289305
: '按空格键完成输入'

apps/nuxt/app/components/practice-words-v2/WordIdentifyPanelV2.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ defineExpose({
131131

132132
<template>
133133
<template v-if="isSelfAssessment && !showWordResult">
134-
<div class="mt-4 flex gap-2">
134+
<div class="mt-4 mb-2 flex gap-2">
135135
<BaseButton
136136
:keyboard="`${$t('shortcut')}(${settingStore.shortcutKeyMap[ShortcutKey.KnowWord]})`"
137137
size="large"

apps/nuxt/app/components/practice-words-v2/WordTypingCoreV2.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import Space from '@typewords/core/components/article/Space.vue'
3030
import { _nextTick, last, normalizeWord } from '@typewords/core/utils'
3131
import { useOnKeyboardEventListener } from '@typewords/core/hooks/event.ts'
3232
import { WordPlayTrigger } from '@typewords/core/composables/useWordPracticeAudio.ts'
33+
import { Toast } from '@typewords/base'
3334
3435
interface IProps {
3536
word: Word
@@ -200,6 +201,7 @@ function del() {
200201
const isSpace = (e: KeyboardEvent) => e.code === 'Space'
201202
202203
async function onTyping(e: KeyboardEvent) {
204+
// console.log('onTyping',e)
203205
if (e.code === 'Backspace') return del()
204206
// if (waitClear) return
205207
@@ -227,7 +229,7 @@ async function onTyping(e: KeyboardEvent) {
227229
// 错误时,提示用户按删除键,仅默写需要提示
228230
pressNumber++
229231
if (pressNumber >= 3) {
230-
// Toast handled in parent shell
232+
Toast.info($t('press_delete_reinput'), { duration: 2000 })
231233
pressNumber = 0
232234
}
233235
}
@@ -237,6 +239,7 @@ async function onTyping(e: KeyboardEvent) {
237239
if (isWordRight) {
238240
pressNumber++
239241
if (pressNumber >= 3) {
242+
Toast.info($t('press_space_continue'), { duration: 2000 })
240243
pressNumber = 0
241244
}
242245
} else {
@@ -474,21 +477,22 @@ function revealWord(wordStr: string) {
474477
inputLock = true
475478
input = wordStr
476479
emitShowWordResult(true)
480+
playCorrect()
477481
}
478482
479483
/** WordTest 选择后设置结果 */
480484
function setWordTestResult(isCorrect: boolean, wordStr: string) {
481485
if (isCorrect) {
482486
input = wordStr
483-
// correct sound handled by parent
487+
playCorrect()
484488
} else {
485489
wrong = wordStr
486-
// beep handled by parent
490+
playBeep()
487491
}
488492
}
489493
490494
defineExpose({
491-
right: isWordRight,
495+
isWordRight: () => isWordRight,
492496
revealWord,
493497
setWordTestResult,
494498
})

apps/nuxt/app/composables/practice-words/usePracticeWordNavigator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type {
3030
PracticeWordsSource,
3131
PracticeWrongWordClearAction,
3232
} from './practice-flow-types.ts'
33+
import { Toast } from '@typewords/base'
3334

3435
export type NavigatorDeps = {
3536
getPracticeData: () => PracticeDataV2
@@ -282,6 +283,7 @@ export function createPracticeWordNavigator(deps: NavigatorDeps) {
282283
function runWrongWordRetry(action: PracticeWrongWordClearAction) {
283284
const data = deps.getPracticeData()
284285
// 实际 practiceType 由 resolvePhaseByCtxCursor 从 action.templateId 派生,无需在此设置
286+
Toast.info('还有错词,继续巩固一下吧')
285287
console.log(`[Nav] 还有错词,进入错词清空(templateId=${action.templateId})`)
286288
data.words = shuffle(cloneDeep(data.wrongWords))
287289
data.index = 0
@@ -451,7 +453,10 @@ export function createPracticeWordNavigator(deps: NavigatorDeps) {
451453
: undefined
452454
if (loopSubStep?.clearWrongOnSuccess && data.wrongTimes === 0) {
453455
const rIndex = data.wrongWords.findIndex(v => v.word.toLowerCase() === temp)
454-
if (rIndex >= 0) data.wrongWords.splice(rIndex, 1)
456+
if (rIndex >= 0) {
457+
Toast.success(temp+' 已自动从错词列表移除!原因:跟写时错误,但拼写时正确')
458+
data.wrongWords.splice(rIndex, 1)
459+
}
455460
}
456461

457462
data.wrongTimesMap[temp] = preTimes + data.wrongTimes

packages/core/src/components/dialog/ConflictNotice2.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Dialog = defineAsyncComponent(() => import('@typewords/base/Dialog'))
99
let settingStore = useSettingStore()
1010
const model = defineModel()
1111
12-
useDisableEventListener(() => model)
12+
useDisableEventListener(model)
1313
</script>
1414

1515
<template>

0 commit comments

Comments
 (0)