diff --git a/components.d.ts b/components.d.ts index d480b586..3bc87cbd 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,17 +8,13 @@ export {} declare module 'vue' { export interface GlobalComponents { Add: typeof import('./src/components/toolbar/Add.vue')['default'] - ArticleList2: typeof import('./src/components/list/ArticleList2.vue')['default'] - ArticleList3: typeof import('./src/components/list/ArticleList3.vue')['default'] ArticleList4: typeof import('./src/components/list2/ArticleList4.vue')['default'] Backgorund: typeof import('./src/components/Backgorund.vue')['default'] BaseButton: typeof import('./src/components/BaseButton.vue')['default'] BaseIcon: typeof import('./src/components/BaseIcon.vue')['default'] BaseList: typeof import('./src/components/list2/BaseList.vue')['default'] - ChapterList: typeof import('./src/components/list/ChapterList.vue')['default'] ChapterName: typeof import('./src/components/toolbar/ChapterName.vue')['default'] Close: typeof import('./src/components/icon/Close.vue')['default'] - CommonWordList: typeof import('./src/components/list/CommonWordList.vue')['default'] Dialog: typeof import('./src/components/dialog/Dialog.vue')['default'] DictDiglog: typeof import('./src/components/dialog/DictDiglog.vue')['default'] DictGroup: typeof import('./src/components/toolbar/DictGroup.vue')['default'] @@ -49,7 +45,6 @@ declare module 'vue' { IconWrapper: typeof import('./src/components/IconWrapper.vue')['default'] Input: typeof import('./src/components/Input.vue')['default'] List: typeof import('./src/components/list/List.vue')['default'] - ListItem: typeof import('./src/components/list/ListItem.vue')['default'] MiniDialog: typeof import('./src/components/dialog/MiniDialog.vue')['default'] PopConfirm: typeof import('./src/components/PopConfirm.vue')['default'] RepeatSetting: typeof import('./src/components/toolbar/RepeatSetting.vue')['default'] @@ -61,11 +56,8 @@ declare module 'vue' { Toolbar: typeof import('./src/components/toolbar/index.vue')['default'] Tooltip: typeof import('./src/components/Tooltip.vue')['default'] TranslateSetting: typeof import('./src/components/toolbar/TranslateSetting.vue')['default'] - VirtualWordList: typeof import('./src/components/list/VirtualWordList.vue')['default'] - VirtualWordList2: typeof import('./src/components/list/VirtualWordList2.vue')['default'] VolumeIcon: typeof import('./src/components/icon/VolumeIcon.vue')['default'] VolumeSetting: typeof import('./src/components/toolbar/VolumeSetting.vue')['default'] - WordItem: typeof import('./src/components/list/WordItem.vue')['default'] WordList: typeof import('./src/components/list2/WordList.vue')['default'] WordListDialog: typeof import('./src/components/dialog/WordListDialog.vue')['default'] } diff --git a/src/components/BaseIcon.vue b/src/components/BaseIcon.vue index ef66c7fd..6a3a8064 100644 --- a/src/components/BaseIcon.vue +++ b/src/components/BaseIcon.vue @@ -7,7 +7,6 @@ import {Icon} from "@iconify/vue"; defineProps<{ title?: string, icon: string, - className?: string }>() defineEmits(['click']) @@ -15,7 +14,7 @@ defineEmits(['click']) - + diff --git a/src/components/dialog/DictDiglog.vue b/src/components/dialog/DictDiglog.vue index c1a509de..2d18c168 100644 --- a/src/components/dialog/DictDiglog.vue +++ b/src/components/dialog/DictDiglog.vue @@ -52,28 +52,40 @@ async function selectDict(val: { dict: DictResource | Dict, index: number }) { ...cloneDeep(DefaultDict), ...item, }) + runtimeStore.editDict.id = nanoid(6) + //设置默认章节单词数 + runtimeStore.editDict.chapterWordNumber = settingStore.chapterWordNumber } if ([DictType.collect, DictType.simple, DictType.wrong].includes(runtimeStore.editDict.type)) { } else { - let url = `./dicts/${runtimeStore.editDict.language}/${runtimeStore.editDict.type}/${runtimeStore.editDict.translateLanguage}/${runtimeStore.editDict.url}`; - if (runtimeStore.editDict.type === DictType.word) { - if (!runtimeStore.editDict.originWords.length) { - let r = await fetch(url) - let v = await r.json() - runtimeStore.editDict.originWords = cloneDeep(v) - changeSort(runtimeStore.editDict.sort) + //如果不是自定义词典,并且有url地址才去下载 + if (!runtimeStore.editDict.isCustom && runtimeStore.editDict.url) { + let url = `./dicts/${runtimeStore.editDict.language}/${runtimeStore.editDict.type}/${runtimeStore.editDict.translateLanguage}/${runtimeStore.editDict.url}`; + if (runtimeStore.editDict.type === DictType.word) { + if (!runtimeStore.editDict.originWords.length) { + let r = await fetch(url) + let v = await r.json() + v.map(s => { + s.id = nanoid(6) + }) + runtimeStore.editDict.originWords = cloneDeep(v) + changeSort(runtimeStore.editDict.sort) + } else { + runtimeStore.editDict.length = runtimeStore.editDict.words.length + runtimeStore.editDict.residueWords.length + } } - } - - if (runtimeStore.editDict.type === DictType.article) { - if (!runtimeStore.editDict.articles.length) { - let r = await fetch(url) - let v = await r.json() - runtimeStore.editDict.articles = cloneDeep(v.map(s => { - s.id = nanoid(6) - return s - })) + if (runtimeStore.editDict.type === DictType.article) { + if (!runtimeStore.editDict.articles.length) { + let r = await fetch(url) + let v = await r.json() + v.map(s => { + s.id = nanoid(6) + }) + runtimeStore.editDict.articles = cloneDeep(v) + } else { + runtimeStore.editDict.length = runtimeStore.editDict.articles.length + } } } } @@ -121,24 +133,13 @@ function changeSort(v) { resetChapterList() } -function editDict() { - show = false - setTimeout(() => { - router.push({path: '/dict', query: {type: 'editDict'}}) - }, 500) -} - let wordListRef: any = $ref() -function add() { +function option(type: string) { show = false setTimeout(() => { - router.push({path: '/dict', query: {type: 'addWordOrArticle'}}) + router.push({path: '/dict', query: {type: type}}) }, 500) - if (dictIsArticle) { - - } else { - } } /**/ @@ -215,9 +216,10 @@ function showWordListModal(val: { item: Word, index: number }) { {{ runtimeStore.editDict.name }} {{ runtimeStore.editDict.description }} @@ -230,7 +232,8 @@ function showWordListModal(val: { item: Word, index: number }) { }}词 开始日期:- @@ -322,7 +325,15 @@ function showWordListModal(val: { item: Word, index: number }) { - {{ dictIsArticle ? '文章' : '章节' }}列表 + + {{ dictIsArticle ? '文章' : '章节' }}列表 + + { emitter.on(EventKey.openWordListModal, (val: any) => { show = true list = val.list - title = val.title + title = val.title + `(${list.length}词)` requestIdleCallback(() => { let count = 0 if (val.translateLanguage === 'common') { @@ -77,10 +77,10 @@ onUnmounted(() => { :indeterminate="false" :show-text="false"/> - - + @@ -93,6 +93,8 @@ onUnmounted(() => { padding-top: 0; width: 400rem; height: 75vh; + display: flex; + flex-direction: column; .progress-wrapper { padding: 0 var(--space); diff --git a/src/components/list/ArticleList2.vue b/src/components/list/ArticleList2.vue deleted file mode 100644 index 66c2bff4..00000000 --- a/src/components/list/ArticleList2.vue +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - {{ `${index + 1}. ${source.title}` }} - - - {{ ` ${source.titleTranslate}` }} - - - - - - - - - - - \ No newline at end of file diff --git a/src/components/list/ArticleList3.vue b/src/components/list/ArticleList3.vue deleted file mode 100644 index 3fbacc79..00000000 --- a/src/components/list/ArticleList3.vue +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - {{ `${index + 1}. ${item.title}` }} - - - {{ ` ${item.titleTranslate}` }} - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/components/list/ChapterList.vue b/src/components/list/ChapterList.vue deleted file mode 100644 index ce07ee16..00000000 --- a/src/components/list/ChapterList.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - {{ index + 1 }}. {{ item.title }} - - {{ item.titleTranslate }} - - - 第{{ index + 1 }}章 {{ item.length }}词 - - - - - - - - - - \ No newline at end of file diff --git a/src/components/list/CommonWordList.vue b/src/components/list/CommonWordList.vue deleted file mode 100644 index ad73ba97..00000000 --- a/src/components/list/CommonWordList.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - {{ source.name }} - {{ source.usphone }} - - - - {{ item }} - - - - - - - - - - - diff --git a/src/components/list/ListItem.vue b/src/components/list/ListItem.vue deleted file mode 100644 index 3b3f6477..00000000 --- a/src/components/list/ListItem.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/components/list/VirtualWordList.vue b/src/components/list/VirtualWordList.vue deleted file mode 100644 index 81a09f80..00000000 --- a/src/components/list/VirtualWordList.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - {{ source.name }} - {{ source.usphone }} - - - - {{ item }} - - - - - - - - - - - - diff --git a/src/components/list/VirtualWordList2.vue b/src/components/list/VirtualWordList2.vue deleted file mode 100644 index f725bdac..00000000 --- a/src/components/list/VirtualWordList2.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - {{ item.name }} - {{ item.usphone }} - - - - {{ tran }} - - - - - - - - - - - - - - diff --git a/src/components/list/WordItem.vue b/src/components/list/WordItem.vue deleted file mode 100644 index 89b1f330..00000000 --- a/src/components/list/WordItem.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/components/list2/ArticleList4.vue b/src/components/list2/ArticleList4.vue index 1c1261a9..9029659e 100644 --- a/src/components/list2/ArticleList4.vue +++ b/src/components/list2/ArticleList4.vue @@ -2,11 +2,7 @@ import Input from "@/components/Input.vue"; import {$computed, $ref} from "vue/macros"; -import {Article, Word} from "@/types.ts"; -import ListItem from "@/components/list/ListItem.vue"; -import {useSettingStore} from "@/stores/setting.ts"; -import {onMounted, useAttrs, watch} from "vue"; -import VolumeIcon from "@/components/icon/VolumeIcon.vue"; +import {Article} from "@/types.ts"; import BaseList from "@/components/list2/BaseList.vue"; const props = withDefaults(defineProps<{ diff --git a/src/pages/dict/DictManage.vue b/src/pages/dict/DictManage.vue index ebb14af4..d506ec72 100644 --- a/src/pages/dict/DictManage.vue +++ b/src/pages/dict/DictManage.vue @@ -76,6 +76,11 @@ onMounted(() => { }) }, 300) break + case 'detail': + setTimeout(() => { + selectDict({dict: runtimeStore.editDict}) + }, 300) + break case 'editDict': setTimeout(() => { selectDict({dict: runtimeStore.editDict}, () => { @@ -97,12 +102,10 @@ onMounted(() => { step = 0 } if (type === "collect") { - selectDict({dict: store.collect, index: 0}) - // addWord('residue') + selectDict({dict: store.collect}) } if (type === "simple") { - selectDict({dict: store.simple, index: 0}) - // addWord('residue') + selectDict({dict: store.simple}) } }) // console.log('categoryList', categoryList) diff --git a/src/pages/dict/Test.vue b/src/pages/dict/Test.vue deleted file mode 100644 index eafc3ea2..00000000 --- a/src/pages/dict/Test.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - {{ item.name }} - - - - - - \ No newline at end of file diff --git a/src/pages/dict/components/ArticleDictDetail.vue b/src/pages/dict/components/ArticleDictDetail.vue index 114283e2..fd39cb8b 100644 --- a/src/pages/dict/components/ArticleDictDetail.vue +++ b/src/pages/dict/components/ArticleDictDetail.vue @@ -4,7 +4,6 @@ import BaseIcon from "@/components/BaseIcon.vue"; import BaseButton from "@/components/BaseButton.vue"; import Empty from "@/components/Empty.vue"; import {useRuntimeStore} from "@/stores/runtime.ts"; -import ArticleList3 from "@/components/list/ArticleList3.vue"; import {$computed, $ref} from "vue/macros"; import {cloneDeep} from "lodash-es"; import {Article, DefaultArticle, DefaultDict, Dict, DictResource, DictType, Sort, TranslateType} from "@/types.ts"; @@ -95,9 +94,10 @@ async function getDictDetail(val: { s.id = nanoid(6) }) runtimeStore.editDict.articles = cloneDeep(v) + } else { + runtimeStore.editDict.length = runtimeStore.editDict.articles.length } } - runtimeStore.editDict.length = runtimeStore.editDict.articles.length + runtimeStore.editDict loading = false } @@ -322,12 +322,12 @@ defineExpose({getDictDetail, add, editDict}) diff --git a/src/pages/dict/components/ChapterWordList.vue b/src/pages/dict/components/ChapterWordList.vue index 0bc2ba42..2ce2b62e 100644 --- a/src/pages/dict/components/ChapterWordList.vue +++ b/src/pages/dict/components/ChapterWordList.vue @@ -1,7 +1,6 @@