remove surplus list

This commit is contained in:
zyronon
2023-12-01 23:49:11 +08:00
parent bdd3b501a0
commit be4912cb40
23 changed files with 99 additions and 999 deletions

View File

@@ -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)

View File

@@ -1,35 +0,0 @@
<script setup lang="ts">
import {Word} from "@/types.ts";
const props = defineProps<{
items: Word[]
}>()
</script>
<template>
<DynamicScroller
:items="items"
:min-item-size="54"
class="scroller"
>
<template v-slot="{ item, index, active }">
<DynamicScrollerItem
:item="item"
:active="active"
:size-dependencies="[
item.name,
]"
:data-index="index"
>
<div class="text">{{ item.name }}</div>
</DynamicScrollerItem>
</template>
</DynamicScroller>
</template>
<style scoped lang="scss">
.scroller {
height: 100%;
}
</style>

View File

@@ -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})
</template>
<template v-slot:suffix="{item,index}">
<BaseIcon
class-name="del"
class="del"
@click="emitter.emit(EventKey.openArticleListModal,item)"
title="编辑"
icon="tabler:edit"/>
<BaseIcon
class-name="del"
class="del"
@click="delArticle(index)"
title="删除"
icon="solar:trash-bin-minimalistic-linear"/>

View File

@@ -1,7 +1,6 @@
<script setup lang="ts">
import {Sort, Word} from "@/types.ts";
import VirtualWordList2 from "@/components/list/VirtualWordList2.vue";
import BaseIcon from "@/components/BaseIcon.vue";
import Empty from "@/components/Empty.vue";
import {$computed, $ref} from "vue/macros";
@@ -10,9 +9,8 @@ import MiniDialog from "@/components/dialog/MiniDialog.vue";
import BaseButton from "@/components/BaseButton.vue";
import {useWindowClick} from "@/hooks/event.ts";
import {reverse, shuffle} from "lodash-es";
import BaseList from "@/components/list2/BaseList.vue";
import VolumeIcon from "@/components/icon/VolumeIcon.vue";
import {usePlayWordAudio} from "@/hooks/sound.ts";
import WordList from '@/components/list2/WordList.vue'
const props = defineProps<{
title: string,
@@ -24,8 +22,8 @@ const props = defineProps<{
const emit = defineEmits<{
add: []
edit: [val: { word: Word, index: number }]
del: [val: { word: Word, index: number }],
edit: [val: { item: Word, index: number }]
del: [val: { item: Word, index: number }],
'update:list': [val: Word[]]
}>()
@@ -61,7 +59,7 @@ let checkedTotal = $computed(() => {
return props.list.filter(v => v.checked).length
})
function del(val: { word: Word, index: number }) {
function del(val: { item: Word, index: number }) {
props.list.splice(val.index, 1)
emit('del', val)
}
@@ -144,8 +142,7 @@ const playWordAudio = usePlayWordAudio()
</div>
</div>
<div class="wrapper">
<!-- TODO -->
<BaseList
<WordList
ref="listRef"
:list="list"
v-if="list.length"
@@ -156,29 +153,19 @@ const playWordAudio = usePlayWordAudio()
@change="handleCheckedChange({item})"
size="large"/>
</template>
<template v-slot="{item,index}">
<div class="item-title">
<span class="word">{{ item.name }}</span>
<span class="phonetic">{{ item.usphone }}</span>
<VolumeIcon class="volume" @click="playWordAudio(item.name)"></VolumeIcon>
</div>
<div class="item-sub-title" v-if="item.trans.length">
<div v-for="tran in item.trans">{{ tran }}</div>
</div>
</template>
<template v-slot:suffix="{item,index}" v-if="canOperation">
<BaseIcon
class-name="del"
class="del"
@click="emit('edit',{item,index})"
title="编辑"
icon="tabler:edit"/>
<BaseIcon
class-name="del"
class="del"
@click="del({item,index})"
title="删除"
icon="solar:trash-bin-minimalistic-linear"/>
</template>
</BaseList>
</WordList>
<Empty :text="emptyTitle" v-else/>
</div>
</div>

View File

@@ -604,7 +604,7 @@ defineExpose({getDictDetail, add: addWord, editDict})
</template>
<template v-slot:suffix="{ item, index }" v-if="isCanOperation">
<BaseIcon
class-name="del"
class="del"
@click="delWordChapter(item.id)"
title="移除"
icon="solar:trash-bin-minimalistic-linear"/>

View File

@@ -29,26 +29,26 @@ const settingStore = useSettingStore()
<div class="options">
<BaseIcon
v-if="!isSimple"
class-name="collect"
class="collect"
@click="$emit('toggleSimple')"
:title="`标记为简单词(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleSimple]})`"
icon="material-symbols:check-circle-outline-rounded"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="$emit('toggleSimple')"
:title="`取消标记简单词(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleSimple]})`"
icon="material-symbols:check-circle-rounded"/>
<BaseIcon
v-if="!isCollect"
class-name="collect"
class="collect"
@click="$emit('toggleCollect')"
:title="`收藏(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleCollect]})`"
icon="ph:star"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="$emit('toggleCollect')"
:title="`取消收藏(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleCollect]})`"
icon="ph:star-fill"/>

View File

@@ -13,14 +13,13 @@ import {useArticleOptions, useWordOptions} from "@/hooks/dict.ts";
import {Icon} from "@iconify/vue";
import Tooltip from "@/components/Tooltip.vue";
import IconWrapper from "@/components/IconWrapper.vue";
import CommonWordList from "@/components/list/CommonWordList.vue";
import BaseIcon from "@/components/BaseIcon.vue";
import {emitter, EventKey} from "@/utils/eventBus.ts";
import ArticleList2 from "@/components/list/ArticleList2.vue";
import {useRouter} from "vue-router";
import {useRuntimeStore} from "@/stores/runtime.ts";
import {cloneDeep} from "lodash-es";
import WordList from "@/components/list2/WordList.vue";
import ArticleList4 from "@/components/list2/ArticleList4.vue";
const router = useRouter()
const store = useBaseStore()
@@ -133,7 +132,7 @@ function addSimple() {
:list="store.collect.words">
<template v-slot:suffix="{item,index}">
<BaseIcon
class-name="del"
class="del"
@click="toggleWordCollect(item)"
title="移除"
icon="solar:trash-bin-minimalistic-linear"/>
@@ -142,19 +141,17 @@ function addSimple() {
<Empty v-else/>
</template>
<template v-else>
<ArticleList2
<ArticleList4
v-if="store.collect.articles.length"
:show-translate="true"
v-model:list="store.collect.articles">
<template v-slot="{source,index}">
<template v-slot:suffix="{item,index}">
<BaseIcon
class-name="del"
@click="toggleArticleCollect(source)"
class="del"
@click="toggleArticleCollect(item)"
title="移除"
icon="solar:trash-bin-minimalistic-linear"/>
</template>
</ArticleList2>
</ArticleList4>
<Empty v-else/>
</template>
</div>
@@ -185,7 +182,7 @@ function addSimple() {
:list="store.simple.words">
<template v-slot:suffix="{item,index}">
<BaseIcon
class-name="del"
class="del"
@click="delSimpleWord(item)"
title="移除"
icon="solar:trash-bin-minimalistic-linear"/>
@@ -213,7 +210,7 @@ function addSimple() {
:list="store.wrong.words">
<template v-slot="{item,index}">
<BaseIcon
class-name="del"
class="del"
@click="delWrongWord(item)"
title="移除"
icon="solar:trash-bin-minimalistic-linear"/>

View File

@@ -393,13 +393,13 @@ const {
/>
<BaseIcon
v-if="!isArticleCollect(props.article)"
class-name="collect"
class="collect"
@click="toggleArticleCollect(props.article)"
:title="`收藏(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleCollect]})`"
icon="ph:star"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="toggleArticleCollect(props.article)"
:title="`取消收藏(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.ToggleCollect]})`"
icon="ph:star-fill"/>

View File

@@ -17,11 +17,9 @@ import {Icon} from "@iconify/vue";
import Tooltip from "@/components/Tooltip.vue";
import {useRuntimeStore} from "@/stores/runtime.ts";
import {useSettingStore} from "@/stores/setting.ts";
import ArticleList2 from "@/components/list/ArticleList2.vue";
import BaseIcon from "@/components/BaseIcon.vue";
import {useArticleOptions} from "@/hooks/dict.ts";
import ArticleList4 from "@/components/list2/ArticleList4.vue";
import WordList from "@/components/list2/WordList.vue";
const store = useBaseStore()
const practiceStore = usePracticeStore()
@@ -290,12 +288,12 @@ const {
<template v-slot:suffix="{item,index}">
<BaseIcon
v-if="!isArticleCollect(item)"
class-name="collect"
class="collect"
@click="toggleArticleCollect(item)"
title="收藏" icon="ph:star"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="toggleArticleCollect(item)"
title="取消收藏" icon="ph:star-fill"/>
</template>

View File

@@ -17,7 +17,6 @@ import IconWrapper from "@/components/IconWrapper.vue";
import {useRuntimeStore} from "@/stores/runtime.ts";
import {useWordOptions} from "@/hooks/dict.ts";
import BaseIcon from "@/components/BaseIcon.vue";
import CommonWordList from "@/components/list/CommonWordList.vue";
import WordList from "@/components/list2/WordList.vue";
import Empty from "@/components/Empty.vue";
@@ -301,23 +300,23 @@ onUnmounted(() => {
<template v-slot:suffix="{item,index}">
<BaseIcon
v-if="!isWordCollect(item)"
class-name="collect"
class="collect"
@click="toggleWordCollect(item)"
title="收藏" icon="ph:star"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="toggleWordCollect(item)"
title="取消收藏" icon="ph:star-fill"/>
<BaseIcon
v-if="!isWordSimple(item)"
class-name="easy"
class="easy"
@click="toggleWordSimple(item)"
title="标记为简单词"
icon="material-symbols:check-circle-outline-rounded"/>
<BaseIcon
v-else
class-name="fill"
class="fill"
@click="toggleWordSimple(item)"
title="取消标记简单词"
icon="material-symbols:check-circle-rounded"/>