save
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -45,7 +45,6 @@ declare module 'vue' {
|
||||
RepeatSetting: typeof import('./src/components/Toolbar/RepeatSetting.vue')['default']
|
||||
Ring: typeof import('./src/components/Ring.vue')['default']
|
||||
SettingModal: typeof import('./src/components/Toolbar/SettingModal.vue')['default']
|
||||
Side: typeof import('./src/components/Side.vue')['default']
|
||||
Statistics: typeof import('./src/components/Practice/Statistics.vue')['default']
|
||||
Toolbar: typeof import('./src/components/Toolbar/Toolbar.vue')['default']
|
||||
Tooltip: typeof import('./src/components/Tooltip.vue')['default']
|
||||
@@ -54,7 +53,6 @@ declare module 'vue' {
|
||||
TypeWord: typeof import('./src/components/Practice/TypeWord.vue')['default']
|
||||
VolumeIcon: typeof import('./src/components/VolumeIcon.vue')['default']
|
||||
VolumeSetting: typeof import('./src/components/Toolbar/VolumeSetting.vue')['default']
|
||||
Word: typeof import('./src/components/Word.vue')['default']
|
||||
WordItem: typeof import('./src/components/WordItem.vue')['default']
|
||||
WordList: typeof import('./src/components/WordList.vue')['default']
|
||||
WordListModal: typeof import('./src/components/WordListModal.vue')['default']
|
||||
|
||||
1230
pnpm-lock.yaml
generated
1230
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import {Word} from "@/types.ts"
|
||||
import {Dict} from "@/types.ts"
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {$computed} from "vue/macros";
|
||||
|
||||
defineProps<{
|
||||
list: Word[][],
|
||||
const props = defineProps<{
|
||||
dict: Dict,
|
||||
activeIndex?: number
|
||||
isArticle?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -13,6 +15,12 @@ const emit = defineEmits<{
|
||||
showWord: [list: any[]]
|
||||
}>()
|
||||
|
||||
|
||||
const list: any[] = $computed(() => {
|
||||
if (props.isArticle) return props.dict.articles
|
||||
return props.dict.chapterWords
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -23,11 +31,19 @@ const emit = defineEmits<{
|
||||
@click="emit('update:activeIndex', index)">
|
||||
<input type="radio" :checked="activeIndex === index">
|
||||
<div class="title">
|
||||
<div>第{{ index + 1 }}章</div>
|
||||
<div class="count"
|
||||
@click.stop="emitter.emit(EventKey.openWordListModal,{title:`第${index + 1}章`,list:item})"
|
||||
>{{ item.length }}词
|
||||
</div>
|
||||
<template v-if="isArticle">
|
||||
<div>{{ index + 1 }}.</div>
|
||||
<div class="count"
|
||||
@click.stop="emitter.emit(EventKey.openWordListModal,{title:`第${index + 1}章`,list:item})"
|
||||
>{{ item.title }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div>第{{ index + 1 }}章</div>
|
||||
<div class="count"
|
||||
@click.stop="emitter.emit(EventKey.openWordListModal,{title:`第${index + 1}章`,list:item})"
|
||||
>{{ item.length }}词
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import WordList from "@/components/WordList.vue"
|
||||
|
||||
import {$computed, $ref} from "vue/macros"
|
||||
import {computed, provide, watch} from "vue"
|
||||
import 'swiper/css';
|
||||
import {Dict, DictType, Word} from "@/types.ts"
|
||||
import PopConfirm from "@/components/PopConfirm.vue"
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {dictionaryResources} from '@/assets/dictionary.ts'
|
||||
import {useBaseStore} from "@/stores/base.ts"
|
||||
import {State, useBaseStore} from "@/stores/base.ts"
|
||||
import {watch} from "vue"
|
||||
import {Dict, DictionaryResource, DictType, Sort, Word} from "@/types.ts"
|
||||
import {chunk, cloneDeep} from "lodash-es";
|
||||
@@ -22,6 +22,7 @@ import {usePlayWordAudio} from "@/hooks/sound.ts";
|
||||
import ChapterList from "@/components/ChapterList.vue";
|
||||
import WordListModal from "@/components/WordListModal.vue";
|
||||
import {emitter, EventKey} from "@/utils/eventBus.ts";
|
||||
import {isArticle} from "@/hooks/article.ts";
|
||||
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -45,6 +46,7 @@ const options = [
|
||||
{id: 'code', name: 'Code', flag: codeFlag},
|
||||
]
|
||||
|
||||
const base = useBaseStore()
|
||||
let currentLanguage = $ref('en')
|
||||
let currentSelectDict: Dict = $ref(cloneDeep(store.currentDict))
|
||||
let step = $ref(1)
|
||||
@@ -147,12 +149,14 @@ function clickEvent(e) {
|
||||
console.log('e', e)
|
||||
}
|
||||
|
||||
let showModal = $ref(false)
|
||||
|
||||
function showWord(list: Word[]) {
|
||||
console.log('list', list)
|
||||
}
|
||||
|
||||
const dictIsArticle = $computed(() => {
|
||||
return isArticle(currentSelectDict.type)
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -207,10 +211,14 @@ function showWord(list: Word[]) {
|
||||
<div class="name">{{ currentSelectDict.name }}</div>
|
||||
<div class="desc">{{ currentSelectDict.description }}</div>
|
||||
<div class="num"
|
||||
v-if="dictIsArticle"
|
||||
>总文章:{{ currentSelectDict.articles.length }}篇
|
||||
</div>
|
||||
<div class="num"
|
||||
v-else
|
||||
@click="emitter.emit(EventKey.openWordListModal,{title:'所有单词',list:currentSelectDict.words})">
|
||||
总词汇:<span class="count">{{ currentSelectDict.length }}词</span>
|
||||
</div>
|
||||
|
||||
<div class="num">开始日期:-</div>
|
||||
<div class="num">花费时间:-</div>
|
||||
<div class="num">累积错误:-</div>
|
||||
@@ -222,7 +230,7 @@ function showWord(list: Word[]) {
|
||||
</div>
|
||||
<div class="setting">
|
||||
<div class="common-title">学习设置</div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="!isArticle(currentSelectDict.type)">
|
||||
<div class="label">每章单词数</div>
|
||||
<el-slider :min="10"
|
||||
:step="10"
|
||||
@@ -294,14 +302,20 @@ function showWord(list: Word[]) {
|
||||
</div>
|
||||
<div class="other">
|
||||
<div class="common-title">
|
||||
章节列表:共{{
|
||||
currentSelectDict.chapterWords.length
|
||||
}}章(每章{{ currentSelectDict.chapterWordNumber }}词)
|
||||
<template v-if="dictIsArticle">
|
||||
文章列表:共{{ currentSelectDict.articles.length }}章
|
||||
</template>
|
||||
<template v-else>
|
||||
章节列表:共{{
|
||||
currentSelectDict.chapterWords.length
|
||||
}}章(每章{{ currentSelectDict.chapterWordNumber }}词)
|
||||
</template>
|
||||
</div>
|
||||
<ChapterList
|
||||
@showWord="showWord"
|
||||
:is-article="dictIsArticle"
|
||||
v-model:active-index="currentSelectDict.chapterIndex"
|
||||
:list="currentSelectDict.chapterWords"/>
|
||||
:dict="currentSelectDict"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="false" class="activity">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ArticleWord, DefaultArticleWord, Sentence} from "@/types.ts";
|
||||
import {ArticleWord, DefaultArticleWord, DictType, Sentence} from "@/types.ts";
|
||||
import {cloneDeep} from "lodash-es";
|
||||
import nlp from "compromise";
|
||||
import {split} from "sentence-splitter";
|
||||
@@ -255,3 +255,9 @@ export function getSplitTranslateText(article: string) {
|
||||
return str
|
||||
}
|
||||
|
||||
export function isArticle(type: DictType): boolean {
|
||||
return [
|
||||
DictType.publicArticle,
|
||||
DictType.customArticle
|
||||
].includes(type)
|
||||
}
|
||||
0
src/hooks/dict.ts
Normal file
0
src/hooks/dict.ts
Normal file
@@ -124,8 +124,9 @@ export const useBaseStore = defineStore('base', {
|
||||
}
|
||||
],
|
||||
current: {
|
||||
dictType: DictType.publicDict,
|
||||
index: 1,
|
||||
// dictType: DictType.publicDict,
|
||||
dictType: DictType.publicArticle,
|
||||
index: 0,
|
||||
editIndex: 0,
|
||||
repeatNumber: 0,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user