This commit is contained in:
zyronon
2023-12-03 03:25:03 +08:00
parent 8510d3733d
commit 8b224c145a
6 changed files with 18 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ let chapterWordList: Word[] = $computed({
},
set(newValue) {
runtimeStore.editDict.chapterWords[chapterIndex] = newValue
syncMyDictList(runtimeStore.editDict)
}
})
@@ -67,6 +68,7 @@ let residueWordList: Word[] = $computed({
},
set(newValue) {
runtimeStore.editDict.residueWords = newValue
syncMyDictList(runtimeStore.editDict)
}
})
@@ -413,7 +415,7 @@ function changeSort(v: Sort) {
resetChapterList()
}
function resetChapterList(num?: number) {
function resetChapterList(num?: number, sync?: boolean) {
if (num !== undefined) {
runtimeStore.editDict.chapterWordNumber = num
}
@@ -423,6 +425,9 @@ function resetChapterList(num?: number) {
runtimeStore.editDict.chapterWords = chunk(runtimeStore.editDict.words, runtimeStore.editDict.chapterWordNumber)
runtimeStore.editDict.length = runtimeStore.editDict.words.length
chapterList2 = runtimeStore.editDict.chapterWords.map((v, i) => ({id: i}))
if (sync!==undefined){
syncMyDictList(runtimeStore.editDict)
}
}
async function resetDict() {
@@ -711,7 +716,7 @@ defineExpose({getDictDetail, add: addWord, editDict})
<Dialog
title="智能分配单词"
:footer="true"
@ok="resetChapterList(chapterWordNumber)"
@ok="resetChapterList(chapterWordNumber,true)"
@cancel="chapterWordNumber = settingStore.chapterWordNumber"
v-model="showAllocationChapterDialog">
<div class="allocation-chapter">
@@ -733,7 +738,7 @@ defineExpose({getDictDetail, add: addWord, editDict})
<div class="notice">
<span class="text">最小:10</span>
<span class="text">最大:{{ runtimeStore.editDict.words.length}}</span>
<span class="text">最大:{{ runtimeStore.editDict.words.length }}</span>
</div>
<div class="row">

View File

@@ -17,6 +17,7 @@ import {ShortcutKey} from "@/types.ts";
import useTheme from "@/hooks/theme.ts";
import SettingDialog from "@/components/dialog/SettingDialog.vue";
import DictModal from "@/components/dialog/DictDiglog.vue";
import {useStartKeyboardEventListener} from "@/hooks/event.ts";
const practiceStore = usePracticeStore()
const store = useBaseStore()
@@ -154,6 +155,8 @@ onUnmounted(() => {
emitter.off(ShortcutKey.TogglePanel, togglePanel)
})
useStartKeyboardEventListener()
</script>
<template>
<div class="practice-wrapper">