refactor
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script setup lang="tsx">
|
||||
import { nextTick, onMounted, useSlots } from 'vue'
|
||||
import { Sort } from '@/types/types.ts'
|
||||
import MiniDialog from '@/components/dialog/MiniDialog.vue'
|
||||
import BaseIcon from '@/components/BaseIcon.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
@@ -13,6 +12,7 @@ import DeleteIcon from '@/components/icon/DeleteIcon.vue'
|
||||
import Dialog from '@/components/dialog/Dialog.vue'
|
||||
import BaseInput from '@/components/base/BaseInput.vue'
|
||||
import { Host } from '@/config/env.ts'
|
||||
import { Sort } from '@/types/enum.ts'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Dict } from "@/types/types.ts";
|
||||
import type { Dict } from "@/types/types.ts";
|
||||
import Progress from '@/components/base/Progress.vue'
|
||||
import Checkbox from "@/components/base/checkbox/Checkbox.vue";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, provide} from "vue"
|
||||
import {ShortcutKey} from "@/types/types.ts"
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import Close from "@/components/icon/Close.vue";
|
||||
import Tooltip from "@/components/base/Tooltip.vue";
|
||||
import {ShortcutKey} from "@/types/enum.ts";
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
let tabIndex = $ref(0)
|
||||
|
||||
@@ -1,46 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
import type { Word } from '@/types/types.ts'
|
||||
import VolumeIcon from '@/components/icon/VolumeIcon.vue'
|
||||
import { usePlayWordAudio } from '@/hooks/sound.ts'
|
||||
import Tooltip from '@/components/base/Tooltip.vue'
|
||||
import BaseIcon from '@/components/BaseIcon.vue'
|
||||
import { useWordOptions } from '@/hooks/dict.ts'
|
||||
|
||||
import { Word } from "@/types/types.ts";
|
||||
import VolumeIcon from "@/components/icon/VolumeIcon.vue";
|
||||
import { usePlayWordAudio } from "@/hooks/sound.ts";
|
||||
import Tooltip from "@/components/base/Tooltip.vue";
|
||||
import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import { useWordOptions } from "@/hooks/dict.ts";
|
||||
|
||||
withDefaults(defineProps<{
|
||||
item: Word,
|
||||
showTranslate?: boolean
|
||||
showWord?: boolean
|
||||
showTransPop?: boolean
|
||||
showOption?: boolean
|
||||
showCollectIcon?: boolean
|
||||
showMarkIcon?: boolean
|
||||
index?: number
|
||||
active?: boolean
|
||||
}>(), {
|
||||
showTranslate: true,
|
||||
showWord: true,
|
||||
showTransPop: true,
|
||||
showOption: true,
|
||||
showCollectIcon: true,
|
||||
showMarkIcon: true,
|
||||
active: false,
|
||||
})
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
item: Word
|
||||
showTranslate?: boolean
|
||||
showWord?: boolean
|
||||
showTransPop?: boolean
|
||||
showOption?: boolean
|
||||
showCollectIcon?: boolean
|
||||
showMarkIcon?: boolean
|
||||
index?: number
|
||||
active?: boolean
|
||||
}>(),
|
||||
{
|
||||
showTranslate: true,
|
||||
showWord: true,
|
||||
showTransPop: true,
|
||||
showOption: true,
|
||||
showCollectIcon: true,
|
||||
showMarkIcon: true,
|
||||
active: false,
|
||||
}
|
||||
)
|
||||
|
||||
const playWordAudio = usePlayWordAudio()
|
||||
|
||||
const {
|
||||
isWordCollect,
|
||||
toggleWordCollect,
|
||||
isWordSimple,
|
||||
toggleWordSimple
|
||||
} = useWordOptions()
|
||||
const { isWordCollect, toggleWordCollect, isWordSimple, toggleWordSimple } = useWordOptions()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="common-list-item"
|
||||
:class="{active}"
|
||||
>
|
||||
<div class="common-list-item" :class="{ active }">
|
||||
<div class="left">
|
||||
<slot name="prefix" :item="item"></slot>
|
||||
<div class="title-wrapper">
|
||||
@@ -52,10 +47,7 @@ const {
|
||||
</div>
|
||||
<div class="item-sub-title flex flex-col gap-2" v-if="item.trans.length && showTranslate">
|
||||
<div v-for="v in item.trans">
|
||||
<Tooltip
|
||||
v-if="v.cn.length > 30 && showTransPop"
|
||||
:title="v.pos + ' ' + v.cn"
|
||||
>
|
||||
<Tooltip v-if="v.cn.length > 30 && showTransPop" :title="v.pos + ' ' + v.cn">
|
||||
<span>{{ v.pos + ' ' + v.cn.slice(0, 30) + '...' }}</span>
|
||||
</Tooltip>
|
||||
<span v-else>{{ v.pos + ' ' + v.cn }}</span>
|
||||
@@ -66,26 +58,26 @@ const {
|
||||
<div class="right" v-if="showOption">
|
||||
<slot name="suffix" :item="item"></slot>
|
||||
<BaseIcon
|
||||
v-if="showCollectIcon"
|
||||
:class="!isWordCollect(item)?'collect':'fill'"
|
||||
@click.stop="toggleWordCollect(item)"
|
||||
:title="!isWordCollect(item) ? '收藏' : '取消收藏'">
|
||||
<IconFluentStar16Regular v-if="!isWordCollect(item)"/>
|
||||
<IconFluentStar16Filled v-else/>
|
||||
v-if="showCollectIcon"
|
||||
:class="!isWordCollect(item) ? 'collect' : 'fill'"
|
||||
@click.stop="toggleWordCollect(item)"
|
||||
:title="!isWordCollect(item) ? '收藏' : '取消收藏'"
|
||||
>
|
||||
<IconFluentStar16Regular v-if="!isWordCollect(item)" />
|
||||
<IconFluentStar16Filled v-else />
|
||||
</BaseIcon>
|
||||
|
||||
<BaseIcon
|
||||
v-if="showMarkIcon"
|
||||
:class="!isWordSimple(item)?'collect':'fill'"
|
||||
@click.stop="toggleWordSimple(item)"
|
||||
:title="!isWordSimple(item) ? '标记为已掌握' : '取消标记已掌握'">
|
||||
<IconFluentCheckmarkCircle16Regular v-if="!isWordSimple(item)"/>
|
||||
<IconFluentCheckmarkCircle16Filled v-else/>
|
||||
v-if="showMarkIcon"
|
||||
:class="!isWordSimple(item) ? 'collect' : 'fill'"
|
||||
@click.stop="toggleWordSimple(item)"
|
||||
:title="!isWordSimple(item) ? '标记为已掌握' : '取消标记已掌握'"
|
||||
>
|
||||
<IconFluentCheckmarkCircle16Regular v-if="!isWordSimple(item)" />
|
||||
<IconFluentCheckmarkCircle16Filled v-else />
|
||||
</BaseIcon>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Article } from '@/types/types.ts'
|
||||
import type { Article } from '@/types/types.ts'
|
||||
import BaseList from '@/components/list/BaseList.vue'
|
||||
import BaseInput from '@/components/base/BaseInput.vue'
|
||||
import { useArticleOptions } from '@/hooks/dict.ts'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {watch} from "vue";
|
||||
import {DictResource} from "@/types/types.ts";
|
||||
import type {DictResource} from "@/types/types.ts";
|
||||
import DictList from "@/components/list/DictList.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -69,16 +69,16 @@ watch(() => props.groupByTag, () => {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
|
||||
|
||||
.category {
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.tags {
|
||||
margin: 0.5rem 0;
|
||||
gap: 0.3rem;
|
||||
|
||||
|
||||
.tag {
|
||||
padding: 0.3rem 0.8rem;
|
||||
font-size: 0.9rem;
|
||||
@@ -98,7 +98,7 @@ watch(() => props.groupByTag, () => {
|
||||
.category {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
|
||||
.tags {
|
||||
.tag {
|
||||
padding: 0.2rem 0.6rem;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import {Dict} from "@/types/types.ts";
|
||||
import type {Dict} from "@/types/types.ts";
|
||||
import Book from "@/components/Book.vue";
|
||||
|
||||
defineProps<{
|
||||
@@ -38,7 +38,7 @@ const emit = defineEmits<{
|
||||
@media (max-width: 768px) {
|
||||
.flex.gap-4.flex-wrap {
|
||||
gap: 0.5rem;
|
||||
|
||||
|
||||
.book {
|
||||
width: 5rem;
|
||||
height: calc(5rem * 1.4);
|
||||
@@ -46,33 +46,33 @@ const emit = defineEmits<{
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
|
||||
|
||||
.text-base {
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.2;
|
||||
word-break: break-word;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
|
||||
.text-sm {
|
||||
font-size: 0.7rem;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
|
||||
|
||||
.absolute.bottom-4.right-3 {
|
||||
bottom: 0.8rem;
|
||||
right: 0.3rem;
|
||||
font-size: 0.7rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
.absolute.bottom-2.left-3.right-3 {
|
||||
bottom: 0.2rem;
|
||||
left: 0.3rem;
|
||||
right: 0.3rem;
|
||||
}
|
||||
|
||||
|
||||
.absolute.left-3.bottom-3 {
|
||||
left: 0.3rem;
|
||||
bottom: 0.3rem;
|
||||
@@ -85,22 +85,22 @@ const emit = defineEmits<{
|
||||
@media (max-width: 480px) {
|
||||
.flex.gap-4.flex-wrap {
|
||||
gap: 0.3rem;
|
||||
|
||||
|
||||
.book {
|
||||
width: 4.5rem;
|
||||
height: calc(4.5rem * 1.4);
|
||||
padding: 0.4rem;
|
||||
|
||||
|
||||
.text-base {
|
||||
font-size: 0.7rem;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
|
||||
.text-sm {
|
||||
font-size: 0.6rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
.absolute.bottom-4.right-3 {
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import { cloneDeep, throttle } from "@/utils";
|
||||
import { Article } from "@/types/types.ts";
|
||||
import type { Article } from "@/types/types.ts";
|
||||
import DeleteIcon from "@/components/icon/DeleteIcon.vue";
|
||||
import BaseInput from "@/components/base/BaseInput.vue";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import BaseList from "@/components/list/BaseList.vue";
|
||||
import { Word } from "@/types/types.ts";
|
||||
import type { Word } from "@/types/types.ts";
|
||||
import WordItem from "../WordItem.vue";
|
||||
|
||||
withDefaults(defineProps<{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { ShortcutKey } from '@/types/types.ts'
|
||||
import { SoundFileOptions } from '@/config/env.ts'
|
||||
import { getAudioFileUrl, usePlayAudio } from '@/hooks/sound.ts'
|
||||
import Switch from '@/components/base/Switch.vue'
|
||||
@@ -10,6 +9,7 @@ import Slider from '@/components/base/Slider.vue'
|
||||
import SettingItem from '@/pages/setting/SettingItem.vue'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { useBaseStore } from '@/stores/base.ts'
|
||||
import {ShortcutKey} from "@/types/enum.ts";
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
slideTouchMove,
|
||||
slideTouchStart
|
||||
} from "./common";
|
||||
import {SlideType} from "@/types/types.ts";
|
||||
|
||||
import {SlideType} from "@/config/env";
|
||||
|
||||
const props = defineProps({
|
||||
index: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {emitter as bus} from "@/utils/eventBus.ts";
|
||||
import Utils from '@/utils/gm.js'
|
||||
import {SlideType} from "@/types/types.ts";
|
||||
import GM from "@/utils/gm.js";
|
||||
import {SlideType} from "@/config/env";
|
||||
|
||||
export function slideInit(el, state, type) {
|
||||
state.wrapper.width = GM.$getCss(el, 'width')
|
||||
|
||||
Reference in New Issue
Block a user