Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
refactor(dashboard): refactor dashboard with sidebar layout (#136)
Timothy Yin2290e51afd62
diff --git a/app/components/dashboard/Indicator.vue b/app/components/dashboard/Indicator.vueindex 0092f6d2..5f36b274 100644--- a/app/components/dashboard/Indicator.vue+++ b/app/components/dashboard/Indicator.vue@@ -1,5 +1,5 @@<script lang="ts" setup>-import { isNil } from 'es-toolkit';+import { isNil } from 'es-toolkit'const props = withDefaults(defineProps<{@@ -83,7 +83,9 @@ const currentScheme = computed(() => colorSchemes[props.color])currentScheme.background,currentScheme.border,currentScheme.text,- clickable ? 'cursor-pointer hover:scale-105 transition-transform' : '',+ clickable+ ? 'cursor-pointer hover:scale-[1.01] transition-transform duration-200'+ : '',]"@click="clickable ? emit('click') : undefined">@@ -91,13 +93,13 @@ const currentScheme = computed(() => colorSchemes[props.color])<div class="flex-1 overflow-hidden"><pv-if="title"- class="text-sm opacity-90 font-medium max-w-48 truncate"+ class="text-lg opacity-90 font-medium max-w-48 truncate">{{ title }}</p><pv-if="!isNil(value)"- class="text-lg font-bold max-w-full sm:max-w-1/2 truncate"+ class="text-2xl font-bold max-w-full sm:max-w-1/2 truncate">{{ value }}</p>diff --git a/app/layouts/dashboard.vue b/app/layouts/dashboard.vueindex 6724472c..efb934c1 100644--- a/app/layouts/dashboard.vue+++ b/app/layouts/dashboard.vue@@ -1,33 +1,60 @@<script lang="ts" setup>import type { NavigationMenuItem } from '@nuxt/ui'-import { motion } from 'motion-v'-const items = ref<NavigationMenuItem[]>([- {- label: $t('title.dashboard'),- icon: 'tabler:dashboard',- to: '/dashboard',- },- {- label: $t('title.photos'),- icon: 'tabler:photo-cog',- to: '/dashboard/photos',- },- {- label: $t('title.albums'),- icon: 'tabler:album',- to: '/dashboard/albums',- },- {- label: $t('title.queue'),- icon: 'tabler:list-check',- to: '/dashboard/queue',- },- {- label: $t('title.logs'),- icon: 'tabler:file-text',- to: '/dashboard/logs',- },+const navItems = ref<NavigationMenuItem[][]>([+ [+ {+ label: $t('title.dashboard'),+ icon: 'tabler:dashboard',+ to: '/dashboard',+ },+ {+ label: $t('title.photos'),+ icon: 'tabler:photo-cog',+ to: '/dashboard/photos',+ },+ {+ label: $t('title.albums'),+ icon: 'tabler:album',+ to: '/dashboard/albums',+ },+ {+ label: $t('title.queue'),+ icon: 'tabler:list-check',+ to: '/dashboard/queue',+ },+ {+ label: $t('title.logs'),+ icon: 'tabler:file-text',+ to: '/dashboard/logs',+ },+ {+ label: $t('title.siteAdministration'),+ icon: 'tabler:settings',+ to: '/dashboard/site-administration',+ disabled: true,+ },+ ],+ [+ {+ label: 'GitHub',+ icon: 'tabler:brand-github',+ to: 'https://github.com/HoshinoSuzumi/chronoframe',+ target: '_blank',+ },+ {+ label: 'Documentation',+ icon: 'tabler:book',+ to: 'https://chronoframe.bh8.ga/',+ target: '_blank',+ },+ {+ label: 'Discord',+ icon: 'tabler:brand-discord',+ to: 'https://discord.gg/chronoframe',+ target: '_blank',+ },+ ],])const route = useRoute()@@ -41,159 +68,110 @@ useHead({`${title ? title + ' | ' : ''}${config.public.app.title}`,})-const isMobileMenuOpen = ref(false)--const isRouteActive = (itemPath: string) => {- if (itemPath === '/dashboard') {- return route.path === '/dashboard'- }- return route.path.startsWith(itemPath)-}-const handleLogin = () => {router.push({path: '/signin',query: { redirect: route.fullPath },})}--const toggleMobileMenu = () => {- isMobileMenuOpen.value = !isMobileMenuOpen.value-}--const closeMobileMenu = () => {- isMobileMenuOpen.value = false-}</script><template>- <div class="container mx-auto">- <header- v-if="loggedIn"- class="w-full px-4 border-b border-default"+ <!-- TODO: unified error page -->+ <div+ v-if="!loggedIn || !user?.isAdmin"+ class="h-svh flex flex-col gap-4 items-center justify-center px-4"+ >+ <Icon+ name="tabler:alert-triangle"+ class="size-12 text-primary"+ />+ <p class="text-gray-500 text-center">+ {{+ !user?.isAdmin+ ? 'Please login to view dashboard'+ : 'Sorry, you do not have access to this page.'+ }}+ </p>+ <UButton @click="handleLogin">Sign In</UButton>+ </div>+ <UDashboardGroup v-else>+ <UDashboardSidebar+ id="cframe-dashboard-sidebar"+ resizable+ collapsible+ mode="drawer"+ :min-size="8"+ :max-size="12"+ :ui="{ footer: 'border-t border-default' }"+ :toggle="{+ color: 'primary',+ variant: 'subtle',+ class: 'rounded-full',+ }">- <!-- 桌面端导航 -->- <div class="hidden md:flex items-center gap-4">- <div class="flex items-center gap-2">- <Icon- name="tabler:photo-circle"- class="size-6 text-primary"- />- <NuxtLink- to="/"- class="text-lg font-medium text-nowrap"- >- {{ config.public.app.title || $t('title.dashboard') }}- </NuxtLink>- </div>- <UNavigationMenu- variant="pill"- :items="items"- :ui="{- viewportWrapper: 'max-w-5xl',- }"- class="w-full"- />- </div>+ <template #toggle>+ <UDashboardSidebarToggle variant="soft" />+ </template>- <!-- 移动端导航 -->- <div class="md:hidden">- <!-- 移动端顶部栏 -->- <div class="flex items-center justify-between py-3">- <div class="flex items-center gap-2">- <Icon- name="tabler:photo-circle"- class="size-6 text-primary"- />+ <template #header="{ collapsed }">+ <div+ v-if="!collapsed"+ class="flex items-center gap-2"+ >+ <img+ src="/favicon.svg"+ class="h-8 w-auto shrink-0"+ />+ <div class="flex flex-col overflow-hidden"><NuxtLinkto="/"- class="text-lg font-medium"+ class="text-lg font-medium line-clamp-1">{{ config.public.app.title || $t('title.dashboard') }}</NuxtLink></div>- <UButton- variant="ghost"- size="sm"- :icon="isMobileMenuOpen ? 'tabler:x' : 'tabler:menu-2'"- @click="toggleMobileMenu"- /></div>+ <img+ v-else+ src="/favicon.svg"+ class="size-8 mx-auto"+ />+ </template>- <!-- 移动端下拉菜单 -->- <AnimatePresence>- <motion.div- v-if="isMobileMenuOpen"- :initial="{ opacity: 0, y: -10, height: 0 }"- :animate="{ opacity: 1, y: 0, height: 'auto' }"- :exit="{ opacity: 0, y: -10, height: 0 }"- :transition="{- duration: 0.3,- ease: 'easeOut',- height: { duration: 0.2 },- }"- class="border-t border-default bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 overflow-hidden"- >- <nav class="py-2">- <motion.div- v-for="(item, index) in items"- :key="index"- :initial="{ opacity: 0, x: -20 }"- :animate="{ opacity: 1, x: 0 }"- :transition="{- duration: 0.2,- delay: index * 0.06,- ease: 'easeOut',- }"- >- <NuxtLink- :to="item.to"- :class="[- 'flex items-center gap-3 px-4 py-3 text-sm font-medium transition-colors',- isRouteActive(item.to as string)- ? 'bg-primary/10 text-primary border-r-2 border-primary'- : 'hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300',- ]"- @click="closeMobileMenu"- >- <Icon- :name="item.icon!"- :class="[- 'size-5',- isRouteActive(item.to as string)- ? 'text-primary'- : 'text-gray-500',- ]"- />- <span>{{ item.label }}</span>- </NuxtLink>- </motion.div>- </nav>- </motion.div>- </AnimatePresence>- </div>- </header>- <main v-if="loggedIn && user?.isAdmin">- <NuxtPage />- </main>- <div- v-else- class="h-svh flex flex-col gap-4 items-center justify-center px-4"- >- <Icon- name="tabler:alert-triangle"- class="size-12 text-primary"- />- <p class="text-gray-500 text-center">- {{- !user?.isAdmin- ? 'Please login to view dashboard'- : 'Sorry, you do not have access to this page.'- }}- </p>- <UButton @click="handleLogin">Sign In</UButton>- </div>- </div>+ <template #default="{ collapsed }">+ <UNavigationMenu+ :collapsed="collapsed"+ :items="navItems[0]"+ orientation="vertical"+ />+ <UNavigationMenu+ :collapsed="collapsed"+ :items="navItems[1]"+ orientation="vertical"+ class="mt-auto"+ />+ </template>++ <template #footer="{ collapsed }">+ <UButton+ :avatar="{+ src: user?.avatar || '',+ alt: user?.username || user?.email || 'User Avatar',+ icon: 'tabler:user',+ }"+ :label="collapsed ? undefined : user?.username || 'User'"+ size="lg"+ color="neutral"+ variant="ghost"+ class="w-full"+ :block="collapsed"+ />+ </template>+ </UDashboardSidebar>++ <NuxtPage />+ </UDashboardGroup></template><style scoped></style>diff --git a/app/pages/dashboard/albums.vue b/app/pages/dashboard/albums.vueindex 1caffa76..4cfb6293 100644--- a/app/pages/dashboard/albums.vue+++ b/app/pages/dashboard/albums.vue@@ -318,644 +318,654 @@ const columns: any[] = [</script><template>- <div class="flex flex-col gap-6 h-full p-4">- <div class="flex items-center justify-between">- <div>- <h1 class="text-2xl font-bold">{{ $t('dashboard.albums.title') }}</h1>- <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">- {{ $t('dashboard.albums.subtitle') }}- </p>- </div>- <UButton- icon="tabler:plus"- @click="openCreateSlideover"- >- {{ $t('dashboard.albums.createButton') }}- </UButton>- </div>-- <div- v-if="albums.length > 0"- class="bg-white dark:bg-neutral-900 rounded-lg border border-gray-200 dark:border-neutral-800"- >- <UTable- :data="albums"- :columns="columns"- >- <template #coverPhoto-cell="{ row }">- <div- class="w-16 h-12 rounded-lg overflow-hidden bg-gray-100 dark:bg-neutral-800 flex-shrink-0"+ <UDashboardPanel>+ <template #header>+ <UDashboardNavbar :title="$t('title.albums')">+ <template #right>+ <UButton+ icon="tabler:plus"+ variant="soft"+ @click="openCreateSlideover">- <img- v-if="(row.original as unknown as AlbumItem).coverPhoto"- :src="- (row.original as unknown as AlbumItem).coverPhoto- ?.thumbnailUrl || ''- "- :alt="(row.original as unknown as AlbumItem).title"- class="w-full h-full object-cover"- />- <div- v-else- class="w-full h-full flex items-center justify-center text-gray-400 dark:text-gray-600"- >- <Icon- name="tabler:image"- size="20"- />- </div>- </div>+ {{ $t('dashboard.albums.createButton') }}+ </UButton></template>+ </UDashboardNavbar>+ </template>- <template #title-cell="{ row }">- <NuxtLink- :to="`/albums/${(row.original as unknown as AlbumItem).id}`"- target="_blank"- class="font-medium text-primary-600 dark:text-primary-400 hover:underline cursor-pointer inline-flex items-center gap-2"+ <template #body>+ <div class="flex flex-col gap-6">+ <div+ v-if="albums.length > 0"+ class="bg-white dark:bg-neutral-900 rounded-lg border border-gray-200 dark:border-neutral-800"+ >+ <UTable+ :data="albums"+ :columns="columns">- {{ (row.original as unknown as AlbumItem).title }}- <Icon- name="tabler:external-link"- size="16"- class="flex-shrink-0 opacity-60 hover:opacity-100 transition-opacity"- />- </NuxtLink>- </template>+ <template #coverPhoto-cell="{ row }">+ <div+ class="w-16 h-12 rounded-lg overflow-hidden bg-gray-100 dark:bg-neutral-800 shrink-0"+ >+ <img+ v-if="(row.original as unknown as AlbumItem).coverPhoto"+ :src="+ (row.original as unknown as AlbumItem).coverPhoto+ ?.thumbnailUrl || ''+ "+ :alt="(row.original as unknown as AlbumItem).title"+ class="w-full h-full object-cover"+ />+ <div+ v-else+ class="w-full h-full flex items-center justify-center text-gray-400 dark:text-gray-600"+ >+ <Icon+ name="tabler:image"+ size="20"+ />+ </div>+ </div>+ </template>- <template #description-cell="{ row }">- <div- v-if="(row.original as unknown as AlbumItem).description"- class="text-sm text-gray-600 dark:text-gray-400 line-clamp-1"- >- {{ (row.original as unknown as AlbumItem).description }}- </div>- <div- v-else- class="text-sm text-gray-400 dark:text-gray-600"- >- -- </div>- </template>+ <template #title-cell="{ row }">+ <NuxtLink+ :to="`/albums/${(row.original as unknown as AlbumItem).id}`"+ target="_blank"+ class="font-medium text-primary-600 dark:text-primary-400 hover:underline cursor-pointer inline-flex items-center gap-2"+ >+ {{ (row.original as unknown as AlbumItem).title }}+ <Icon+ name="tabler:external-link"+ size="16"+ class="shrink-0 opacity-60 hover:opacity-100 transition-opacity"+ />+ </NuxtLink>+ </template>- <template #photoCount-cell="{ row }">- <UBadge- variant="soft"- color="neutral"- >- {{ (row.original as unknown as AlbumItem).photoCount || 0 }} 张- </UBadge>- </template>+ <template #description-cell="{ row }">+ <div+ v-if="(row.original as unknown as AlbumItem).description"+ class="text-sm text-gray-600 dark:text-gray-400 line-clamp-1"+ >+ {{ (row.original as unknown as AlbumItem).description }}+ </div>+ <div+ v-else+ class="text-sm text-gray-400 dark:text-gray-600"+ >+ -+ </div>+ </template>- <template #createdAt-cell="{ row }">- <div class="text-sm text-gray-600 dark:text-gray-400">- {{- dayjs((row.original as unknown as AlbumItem).createdAt).format(- 'YYYY-MM-DD',- )- }}- </div>- </template>+ <template #photoCount-cell="{ row }">+ <UBadge+ variant="soft"+ color="neutral"+ >+ {{ (row.original as unknown as AlbumItem).photoCount || 0 }} 张+ </UBadge>+ </template>++ <template #createdAt-cell="{ row }">+ <div class="text-sm text-gray-600 dark:text-gray-400">+ {{+ dayjs(+ (row.original as unknown as AlbumItem).createdAt,+ ).format('YYYY-MM-DD')+ }}+ </div>+ </template>++ <template #actions-cell="{ row }">+ <div class="flex gap-1">+ <UButton+ variant="ghost"+ color="primary"+ size="xs"+ icon="tabler:edit"+ @click="+ openEditSlideover(row.original as unknown as AlbumItem)+ "+ />+ <UButton+ variant="ghost"+ color="error"+ size="xs"+ icon="tabler:trash"+ @click="+ openDeleteConfirm(row.original as unknown as AlbumItem)+ "+ />+ </div>+ </template>+ </UTable>+ </div>- <template #actions-cell="{ row }">- <div class="flex gap-1">- <UButton- variant="ghost"- color="primary"- size="xs"- icon="tabler:edit"- @click="openEditSlideover(row.original as unknown as AlbumItem)"- />- <UButton- variant="ghost"- color="error"- size="xs"- icon="tabler:trash"- @click="openDeleteConfirm(row.original as unknown as AlbumItem)"- />- </div>- </template>- </UTable>- </div>-- <div- v-else-if="!isLoadingAlbums"- class="flex flex-col items-center justify-center py-12 text-center"- >- <Icon- name="tabler:album"- size="48"- class="text-gray-400 dark:text-gray-600 mb-4"- />- <h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300">- {{ $t('dashboard.albums.noAlbums') }}- </h3>- <p class="text-sm text-gray-500 dark:text-gray-400 mt-2 mb-4">- {{ $t('dashboard.albums.noAlbumsTip') }}- </p>- <UButton- icon="tabler:plus"- @click="openCreateSlideover"- >- {{ $t('dashboard.albums.createButton') }}- </UButton>- </div>- <div- v-else- class="flex items-center justify-center py-12"- >- <Icon- name="tabler:loader"- size="32"- class="animate-spin text-primary-500"- />- </div>-- <USlideover- v-model:open="isAlbumSlideoverOpen"- :title="slideoverTitle"- :description="slideoverDescription"- :ui="{ footer: 'justify-end', body: 'p-0 sm:p-0 space-y-4' }"- >- <template #body><div- v-if="coverPhotoId"- class="relative w-full aspect-video bg-gray-100 dark:bg-neutral-800 overflow-hidden"+ v-else-if="!isLoadingAlbums"+ class="flex flex-col items-center justify-center py-12 text-center">- <ThumbImage- :src="- allPhotos.find((p) => p.id === coverPhotoId)?.thumbnailUrl || ''- "- :alt="coverPhotoId"- class="absolute inset-0 w-full h-full object-cover"+ <Icon+ name="tabler:album"+ size="48"+ class="text-gray-400 dark:text-gray-600 mb-4"/>- <button- class="absolute inset-0 bg-black/50 opacity-0 hover:opacity-100 transition-opacity flex items-center justify-center"- @click="coverPhotoId = ''"+ <h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300">+ {{ $t('dashboard.albums.noAlbums') }}+ </h3>+ <p class="text-sm text-gray-500 dark:text-gray-400 mt-2 mb-4">+ {{ $t('dashboard.albums.noAlbumsTip') }}+ </p>+ <UButton+ icon="tabler:plus"+ @click="openCreateSlideover">- <Icon- name="tabler:x"- class="text-white"- />- </button>+ {{ $t('dashboard.albums.createButton') }}+ </UButton></div>- <button+ <divv-else- class="w-full h-48 bg-gray-100 dark:bg-neutral-800 flex flex-col items-center justify-center text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 hover:bg-gray-200 dark:hover:bg-neutral-700 transition-colors cursor-pointer"- @click="isPhotoSelectorOpen = true"+ class="flex items-center justify-center py-12"><Icon- name="tabler:photo"- size="40"- class="mb-2"+ name="tabler:loader"+ size="32"+ class="animate-spin text-primary-500"/>- <p class="text-sm font-medium">- {{ $t('dashboard.albums.form.addCoverPhoto') }}- </p>- </button>- <div class="space-y-4 px-4">- <UForm- ref="formRef"- :state="formData"- :validate="validateForm"- class="space-y-4"- @submit="onFormSubmit"- >- <UFormField- :label="$t('dashboard.albums.form.title')"- name="title"- required- >- <UInput- v-model="formData.title"- class="w-full"- :placeholder="$t('dashboard.albums.form.titlePlaceholder')"- />- </UFormField>+ </div>- <UFormField- :label="$t('dashboard.albums.form.description')"- name="description"+ <USlideover+ v-model:open="isAlbumSlideoverOpen"+ :title="slideoverTitle"+ :description="slideoverDescription"+ :ui="{ footer: 'justify-end', body: 'p-0 sm:p-0 space-y-4' }"+ >+ <template #body>+ <div+ v-if="coverPhotoId"+ class="relative w-full aspect-video bg-gray-100 dark:bg-neutral-800 overflow-hidden">- <UTextarea- v-model="formData.description"- class="w-full"- :placeholder="- $t('dashboard.albums.form.descriptionPlaceholder')+ <ThumbImage+ :src="+ allPhotos.find((p) => p.id === coverPhotoId)?.thumbnailUrl ||+ ''"- :rows="3"+ :alt="coverPhotoId"+ class="absolute inset-0 w-full h-full object-cover"/>- </UFormField>- </UForm>-- <!-- 照片选择部分 -->- <div class="space-y-3">- <UButton- variant="outline"- color="primary"- icon="tabler:photo-plus"- size="lg"- class="w-full"+ <button+ class="absolute inset-0 bg-black/50 opacity-0 hover:opacity-100 transition-opacity flex items-center justify-center"+ @click="coverPhotoId = ''"+ >+ <Icon+ name="tabler:x"+ class="text-white"+ />+ </button>+ </div>+ <button+ v-else+ class="w-full h-48 bg-gray-100 dark:bg-neutral-800 flex flex-col items-center justify-center text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 hover:bg-gray-200 dark:hover:bg-neutral-700 transition-colors cursor-pointer"@click="isPhotoSelectorOpen = true">- {{- selectedPhotoIds.length > 0- ? $t('dashboard.albums.form.editPhotos')- : $t('dashboard.albums.form.selectPhotos')- }}- </UButton>+ <Icon+ name="tabler:photo"+ size="40"+ class="mb-2"+ />+ <p class="text-sm font-medium">+ {{ $t('dashboard.albums.form.addCoverPhoto') }}+ </p>+ </button>+ <div class="space-y-4 px-4">+ <UForm+ ref="formRef"+ :state="formData"+ :validate="validateForm"+ class="space-y-4"+ @submit="onFormSubmit"+ >+ <UFormField+ :label="$t('dashboard.albums.form.title')"+ name="title"+ required+ >+ <UInput+ v-model="formData.title"+ class="w-full"+ :placeholder="$t('dashboard.albums.form.titlePlaceholder')"+ />+ </UFormField>- <div- v-if="selectedPhotoIds.length > 0"- class="space-y-2"- >- <div class="flex items-center justify-between">- <label- class="text-sm font-medium text-gray-700 dark:text-gray-300"- >{{- $t('dashboard.albums.form.selectedCount', {- count: selectedPhotoIds.length,- })- }}</label+ <UFormField+ :label="$t('dashboard.albums.form.description')"+ name="description">+ <UTextarea+ v-model="formData.description"+ class="w-full"+ :placeholder="+ $t('dashboard.albums.form.descriptionPlaceholder')+ "+ :rows="3"+ />+ </UFormField>+ </UForm>++ <!-- 照片选择部分 -->+ <div class="space-y-3"><UButton- variant="ghost"- color="neutral"- size="xs"- icon="tabler:trash"- @click="selectedPhotoIds = []"+ variant="outline"+ color="primary"+ icon="tabler:photo-plus"+ size="lg"+ class="w-full"+ @click="isPhotoSelectorOpen = true">- {{ $t('dashboard.albums.form.clearAll') }}+ {{+ selectedPhotoIds.length > 0+ ? $t('dashboard.albums.form.editPhotos')+ : $t('dashboard.albums.form.selectPhotos')+ }}</UButton>- </div>- <div- class="grid grid-cols-4 gap-2 p-3 bg-gray-50 dark:bg-neutral-800/50 rounded-lg border border-gray-200 dark:border-neutral-700"- ><div- v-for="photoId in selectedPhotoIds"- :key="photoId"- class="relative group aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700"+ v-if="selectedPhotoIds.length > 0"+ class="space-y-2">- <img- :src="- allPhotos.find((p) => p.id === photoId)?.thumbnailUrl ||- ''- "- :alt="photoId"- class="w-full h-full object-cover"- />+ <div class="flex items-center justify-between">+ <label+ class="text-sm font-medium text-gray-700 dark:text-gray-300"+ >{{+ $t('dashboard.albums.form.selectedCount', {+ count: selectedPhotoIds.length,+ })+ }}</label+ >+ <UButton+ variant="ghost"+ color="neutral"+ size="xs"+ icon="tabler:trash"+ @click="selectedPhotoIds = []"+ >+ {{ $t('dashboard.albums.form.clearAll') }}+ </UButton>+ </div><div- v-if="coverPhotoId === photoId"- class="absolute top-1 left-1 bg-primary-500 text-white px-1.5 py-0.5 rounded text-xs font-medium"+ class="grid grid-cols-4 gap-2 p-3 bg-gray-50 dark:bg-neutral-800/50 rounded-lg border border-gray-200 dark:border-neutral-700">- {{ $t('dashboard.albums.modal.setCover') }}+ <div+ v-for="photoId in selectedPhotoIds"+ :key="photoId"+ class="relative group aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700"+ >+ <img+ :src="+ allPhotos.find((p) => p.id === photoId)+ ?.thumbnailUrl || ''+ "+ :alt="photoId"+ class="w-full h-full object-cover"+ />++ <div+ v-if="coverPhotoId === photoId"+ class="absolute top-1 left-1 bg-primary-500 text-white px-1.5 py-0.5 rounded text-xs font-medium"+ >+ {{ $t('dashboard.albums.modal.setCover') }}+ </div>++ <button+ class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"+ @click="togglePhotoSelection(photoId)"+ >+ <Icon+ name="tabler:x"+ class="text-white"+ />+ </button>+ </div></div>-- <button- class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"- @click="togglePhotoSelection(photoId)"- >- <Icon- name="tabler:x"- class="text-white"- />- </button></div></div></div>- </div>- </div>- </template>+ </template>- <template #footer="{ close }">- <UButton- variant="ghost"- color="neutral"- @click="close"- >- {{ $t('dashboard.albums.slideover.cancel') }}- </UButton>- <UButton- icon="tabler:check"- :loading="isSubmittingForm"- @click="formRef?.submit()"- >- {{ submitButtonLabel }}- </UButton>- </template>- </USlideover>-- <UModal- v-model:open="isPhotoSelectorOpen"- :ui="{ content: 'w-full max-w-6xl overflow-hidden' }"- >- <template #content>- <div class="flex flex-col h-[85vh] max-h-[85vh]">- <div- class="flex-shrink-0 border-b border-gray-200 dark:border-neutral-700 p-3 sm:p-4 md:p-6"- >- <div class="flex items-center justify-between mb-3 sm:mb-4">- <div>- <h2 class="text-lg sm:text-xl font-bold">- {{ $t('dashboard.albums.modal.selectPhotos') }}- </h2>- <p- class="text-xs sm:text-sm text-gray-500 dark:text-gray-400 mt-1"- >- {{- $t('dashboard.albums.modal.totalPhotos', {- count: allPhotos.length,- })- }}- ·- {{- $t('dashboard.albums.modal.selectedPhotos', {- count: selectedPhotoIds.length,- })- }}- </p>- </div>- <UButton- variant="ghost"- color="neutral"- size="md"- icon="tabler:x"- @click="isPhotoSelectorOpen = false"- />- </div>-- <div- class="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center"+ <template #footer="{ close }">+ <UButton+ variant="ghost"+ color="neutral"+ @click="close">- <UInput- v-model="photoSelectorSearchQuery"- icon="tabler:search"- :placeholder="$t('dashboard.albums.modal.searchPlaceholder')"- class="flex-1 text-sm"- />- <div- class="hidden sm:flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-neutral-800 rounded-lg whitespace-nowrap"- >- <UCheckbox- :model-value="areAllPhotosSelected"- :indeterminate="areSomePhotosSelected"- @update:model-value="toggleAllPhotos"- />- <span class="text-sm font-medium">{{- $t('dashboard.albums.modal.selectAll')- }}</span>- </div>- <UButton- v-show="!areAllPhotosSelected && allPhotos.length > 0"- class="sm:hidden"- size="sm"- color="neutral"- variant="soft"- @click="toggleAllPhotos"- >- {{ $t('dashboard.albums.modal.selectAll') }}- </UButton>- </div>-- <div- v-if="photoSelectorSearchQuery"- class="text-xs text-gray-500 dark:text-gray-400 mt-2"+ {{ $t('dashboard.albums.slideover.cancel') }}+ </UButton>+ <UButton+ icon="tabler:check"+ :loading="isSubmittingForm"+ @click="formRef?.submit()">- {{- $t('dashboard.albums.modal.searchResults', {- current: filteredPhotos.length,- total: allPhotos.length,- })- }}- </div>- </div>+ {{ submitButtonLabel }}+ </UButton>+ </template>+ </USlideover>- <div class="flex-1 overflow-y-auto p-2 sm:p-3 md:p-6">- <div- v-if="filteredPhotos.length > 0"- class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 sm:gap-3"- >+ <UModal+ v-model:open="isPhotoSelectorOpen"+ :ui="{ content: 'w-full max-w-6xl overflow-hidden' }"+ >+ <template #content>+ <div class="flex flex-col h-[85vh] max-h-[85vh]"><div- v-for="photo in filteredPhotos"- :key="photo.id"- class="relative group cursor-pointer"- @click="togglePhotoSelection(photo.id)"+ class="shrink-0 border-b border-gray-200 dark:border-neutral-700 p-3 sm:p-4 md:p-6">+ <div class="flex items-center justify-between mb-3 sm:mb-4">+ <div>+ <h2 class="text-lg sm:text-xl font-bold">+ {{ $t('dashboard.albums.modal.selectPhotos') }}+ </h2>+ <p+ class="text-xs sm:text-sm text-gray-500 dark:text-gray-400 mt-1"+ >+ {{+ $t('dashboard.albums.modal.totalPhotos', {+ count: allPhotos.length,+ })+ }}+ ·+ {{+ $t('dashboard.albums.modal.selectedPhotos', {+ count: selectedPhotoIds.length,+ })+ }}+ </p>+ </div>+ <UButton+ variant="ghost"+ color="neutral"+ size="md"+ icon="tabler:x"+ @click="isPhotoSelectorOpen = false"+ />+ </div>+<div- class="relative aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700 border-2 sm:border-3 transition-all"- :class="{- 'border-primary-500 shadow-lg ring-2 ring-primary-300 dark:ring-primary-700':- selectedPhotoIds.includes(photo.id),- 'border-gray-300 dark:border-neutral-600 hover:border-gray-400 dark:hover:border-neutral-500':- !selectedPhotoIds.includes(photo.id),- }"+ class="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center">- <ThumbImage- :src="photo.thumbnailUrl || ''"- :alt="photo.title || 'Photo'"- class="w-full h-full object-cover"+ <UInput+ v-model="photoSelectorSearchQuery"+ icon="tabler:search"+ :placeholder="+ $t('dashboard.albums.modal.searchPlaceholder')+ "+ class="flex-1 text-sm"/>-<div- v-if="selectedPhotoIds.includes(photo.id)"- class="absolute top-1 left-1 sm:top-2 sm:left-2 flex items-center justify-center w-5 h-5 sm:w-6 sm:h-6 rounded-full bg-primary-500 border-2 border-white shadow-md"+ class="hidden sm:flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-neutral-800 rounded-lg whitespace-nowrap">- <Icon- name="tabler:check"- size="12"- class="text-white sm:hidden"- />- <Icon- name="tabler:check"- size="14"- class="text-white hidden sm:block"+ <UCheckbox+ :model-value="areAllPhotosSelected"+ :indeterminate="areSomePhotosSelected"+ @update:model-value="toggleAllPhotos"/>+ <span class="text-sm font-medium">{{+ $t('dashboard.albums.modal.selectAll')+ }}</span></div>-- <UBadge- v-if="coverPhotoId === photo.id"- class="absolute top-1 right-1 sm:top-2 sm:right-2"- variant="solid"- color="warning"- size="sm"- >- <Icon- name="tabler:star-filled"- class="inline mr-0.5"- size="14"- />- {{ $t('dashboard.albums.modal.setCover') }}- </UBadge><UButton- v-if="coverPhotoId !== photo.id"- class="absolute bottom-1 right-1 sm:bottom-2 sm:right-2 opacity-0 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity"- variant="solid"- color="warning"- size="xs"- @click.stop="setCoverPhoto(photo.id)"+ v-show="!areAllPhotosSelected && allPhotos.length > 0"+ class="sm:hidden"+ size="sm"+ color="neutral"+ variant="soft"+ @click="toggleAllPhotos">- <Icon- name="tabler:star"- class="inline"- size="12"- />- <span class="hidden sm:inline ml-1">{{- $t('dashboard.albums.modal.setCover')- }}</span>+ {{ $t('dashboard.albums.modal.selectAll') }}</UButton>+ </div>- <button- v-if="coverPhotoId !== photo.id"- class="sm:hidden absolute bottom-0 right-0 left-0 bg-gradient-to-t from-black/80 to-transparent p-1 text-white flex items-center justify-center text-xs gap-1 rounded-b-lg"- @click.stop="setCoverPhoto(photo.id)"- >- <Icon- name="tabler:star"- size="14"- />- <span>{{ $t('dashboard.albums.modal.setCover') }}</span>- </button>+ <div+ v-if="photoSelectorSearchQuery"+ class="text-xs text-gray-500 dark:text-gray-400 mt-2"+ >+ {{+ $t('dashboard.albums.modal.searchResults', {+ current: filteredPhotos.length,+ total: allPhotos.length,+ })+ }}</div></div>- </div>- <div- v-else- class="flex flex-col items-center justify-center h-64 text-gray-500"- >- <Icon- name="tabler:image-off"- size="48"- class="mb-3 opacity-50"- />- <p class="font-medium">- {{- photoSelectorSearchQuery- ? $t('dashboard.albums.modal.noResults')- : $t('dashboard.albums.modal.noPhotos')- }}- </p>- <p- v-if="photoSelectorSearchQuery"- class="text-sm mt-1"- >- {{ $t('dashboard.albums.modal.tryOtherKeywords') }}- </p>- </div>- </div>+ <div class="flex-1 overflow-y-auto p-2 sm:p-3 md:p-6">+ <div+ v-if="filteredPhotos.length > 0"+ class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 sm:gap-3"+ >+ <div+ v-for="photo in filteredPhotos"+ :key="photo.id"+ class="relative group cursor-pointer"+ @click="togglePhotoSelection(photo.id)"+ >+ <div+ class="relative aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700 border-2 sm:border-3 transition-all"+ :class="{+ 'border-primary-500 shadow-lg ring-2 ring-primary-300 dark:ring-primary-700':+ selectedPhotoIds.includes(photo.id),+ 'border-gray-300 dark:border-neutral-600 hover:border-gray-400 dark:hover:border-neutral-500':+ !selectedPhotoIds.includes(photo.id),+ }"+ >+ <ThumbImage+ :src="photo.thumbnailUrl || ''"+ :alt="photo.title || 'Photo'"+ class="w-full h-full object-cover"+ />++ <div+ v-if="selectedPhotoIds.includes(photo.id)"+ class="absolute top-1 left-1 sm:top-2 sm:left-2 flex items-center justify-center w-5 h-5 sm:w-6 sm:h-6 rounded-full bg-primary-500 border-2 border-white shadow-md"+ >+ <Icon+ name="tabler:check"+ size="12"+ class="text-white sm:hidden"+ />+ <Icon+ name="tabler:check"+ size="14"+ class="text-white hidden sm:block"+ />+ </div>++ <UBadge+ v-if="coverPhotoId === photo.id"+ class="absolute top-1 right-1 sm:top-2 sm:right-2"+ variant="solid"+ color="warning"+ size="sm"+ >+ <Icon+ name="tabler:star-filled"+ class="inline mr-0.5"+ size="14"+ />+ {{ $t('dashboard.albums.modal.setCover') }}+ </UBadge>+ <UButton+ v-if="coverPhotoId !== photo.id"+ class="absolute bottom-1 right-1 sm:bottom-2 sm:right-2 opacity-0 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity"+ variant="solid"+ color="warning"+ size="xs"+ @click.stop="setCoverPhoto(photo.id)"+ >+ <Icon+ name="tabler:star"+ class="inline"+ size="12"+ />+ <span class="hidden sm:inline ml-1">{{+ $t('dashboard.albums.modal.setCover')+ }}</span>+ </UButton>++ <button+ v-if="coverPhotoId !== photo.id"+ class="sm:hidden absolute bottom-0 right-0 left-0 bg-linear-to-t from-black/80 to-transparent p-1 text-white flex items-center justify-center text-xs gap-1 rounded-b-lg"+ @click.stop="setCoverPhoto(photo.id)"+ >+ <Icon+ name="tabler:star"+ size="14"+ />+ <span>{{ $t('dashboard.albums.modal.setCover') }}</span>+ </button>+ </div>+ </div>+ </div>++ <div+ v-else+ class="flex flex-col items-center justify-center h-64 text-gray-500"+ >+ <Icon+ name="tabler:image-off"+ size="48"+ class="mb-3 opacity-50"+ />+ <p class="font-medium">+ {{+ photoSelectorSearchQuery+ ? $t('dashboard.albums.modal.noResults')+ : $t('dashboard.albums.modal.noPhotos')+ }}+ </p>+ <p+ v-if="photoSelectorSearchQuery"+ class="text-sm mt-1"+ >+ {{ $t('dashboard.albums.modal.tryOtherKeywords') }}+ </p>+ </div>+ </div>- <div- class="flex-shrink-0 border-t border-gray-200 dark:border-neutral-700 bg-gray-50 dark:bg-neutral-900/50 p-3 sm:p-4 md:p-6"- >- <div- class="flex flex-col sm:flex-row gap-3 sm:gap-4 items-center justify-between"- ><div- class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4 text-xs sm:text-sm w-full sm:w-auto"+ class="shrink-0 border-t border-gray-200 dark:border-neutral-700 bg-gray-50 dark:bg-neutral-900/50 p-3 sm:p-4 md:p-6">- <div>- <span class="font-medium">{{- $t('dashboard.albums.modal.selectedInfo')- }}</span>- <span- class="text-primary-600 dark:text-primary-400 font-bold"- >- {{ selectedPhotoIds.length }}- </span>- <span class="text-gray-600 dark:text-gray-400"- >/ {{ allPhotos.length }}</span+ <div+ class="flex flex-col sm:flex-row gap-3 sm:gap-4 items-center justify-between"+ >+ <div+ class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4 text-xs sm:text-sm w-full sm:w-auto">+ <div>+ <span class="font-medium">{{+ $t('dashboard.albums.modal.selectedInfo')+ }}</span>+ <span+ class="text-primary-600 dark:text-primary-400 font-bold"+ >+ {{ selectedPhotoIds.length }}+ </span>+ <span class="text-gray-600 dark:text-gray-400"+ >/ {{ allPhotos.length }}</span+ >+ </div>+ <div+ v-if="coverPhotoId"+ class="text-amber-600 dark:text-amber-400 flex items-center gap-1"+ >+ <Icon+ name="tabler:star-filled"+ size="16"+ />+ {{ $t('dashboard.albums.modal.coverSetInfo') }}+ </div>+ </div>++ <div class="flex gap-2 w-full sm:w-auto">+ <UButton+ variant="outline"+ color="neutral"+ class="flex-1 sm:flex-none"+ size="sm"+ @click="isPhotoSelectorOpen = false"+ >+ {{ $t('dashboard.albums.slideover.cancel') }}+ </UButton>+ <UButton+ icon="tabler:check"+ color="primary"+ class="flex-1 sm:flex-none"+ size="sm"+ :disabled="selectedPhotoIds.length === 0"+ @click="isPhotoSelectorOpen = false"+ >+ {{+ $t('dashboard.albums.modal.confirm', {+ count: selectedPhotoIds.length,+ })+ }}+ </UButton>+ </div></div>+ </div>+ </div>+ </template>+ </UModal>++ <UModal v-model:open="isDeleteConfirmOpen">+ <template #content>+ <div class="p-6 space-y-4">+ <div class="flex items-center gap-3"><div- v-if="coverPhotoId"- class="text-amber-600 dark:text-amber-400 flex items-center gap-1"+ class="shrink-0 w-10 h-10 bg-error-100 dark:bg-error-900/30 rounded-full flex items-center justify-center"><Icon- name="tabler:star-filled"- size="16"+ name="tabler:alert-circle"+ class="text-error-500"/>- {{ $t('dashboard.albums.modal.coverSetInfo') }}+ </div>+ <div>+ <h3 class="text-lg font-semibold">+ {{ $t('dashboard.albums.delete.title') }}+ </h3>+ <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">+ {{+ $t('dashboard.albums.delete.message', {+ title: currentAlbum?.title,+ })+ }}+ </p></div></div>- <div class="flex gap-2 w-full sm:w-auto">+ <div class="flex justify-end gap-2 pt-4"><UButton- variant="outline"+ variant="ghost"color="neutral"- class="flex-1 sm:flex-none"- size="sm"- @click="isPhotoSelectorOpen = false"+ @click="isDeleteConfirmOpen = false">- {{ $t('dashboard.albums.slideover.cancel') }}+ {{ $t('dashboard.albums.delete.cancel') }}</UButton><UButton- icon="tabler:check"- color="primary"- class="flex-1 sm:flex-none"- size="sm"- :disabled="selectedPhotoIds.length === 0"- @click="isPhotoSelectorOpen = false"+ color="error"+ icon="tabler:trash"+ @click="deleteAlbum">- {{- $t('dashboard.albums.modal.confirm', {- count: selectedPhotoIds.length,- })- }}+ {{ $t('dashboard.albums.delete.confirm') }}</UButton></div></div>- </div>- </div>- </template>- </UModal>-- <UModal v-model:open="isDeleteConfirmOpen">- <template #content>- <div class="p-6 space-y-4">- <div class="flex items-center gap-3">- <div- class="flex-shrink-0 w-10 h-10 bg-error-100 dark:bg-error-900/30 rounded-full flex items-center justify-center"- >- <Icon- name="tabler:alert-circle"- class="text-error-500"- />- </div>- <div>- <h3 class="text-lg font-semibold">- {{ $t('dashboard.albums.delete.title') }}- </h3>- <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">- {{- $t('dashboard.albums.delete.message', {- title: currentAlbum?.title,- })- }}- </p>- </div>- </div>-- <div class="flex justify-end gap-2 pt-4">- <UButton- variant="ghost"- color="neutral"- @click="isDeleteConfirmOpen = false"- >- {{ $t('dashboard.albums.delete.cancel') }}- </UButton>- <UButton- color="error"- icon="tabler:trash"- @click="deleteAlbum"- >- {{ $t('dashboard.albums.delete.confirm') }}- </UButton>- </div>- </div>- </template>- </UModal>- </div>+ </template>+ </UModal>+ </div>+ </template>+ </UDashboardPanel></template><style scoped></style>diff --git a/app/pages/dashboard/index.vue b/app/pages/dashboard/index.vueindex 1d83add6..79b0cb05 100644--- a/app/pages/dashboard/index.vue+++ b/app/pages/dashboard/index.vue@@ -139,331 +139,340 @@ const onShareSite = () => {</script><template>- <div class="flex flex-col gap-6 h-full p-4">- <div class="flex items-center justify-between">- <h1 class="text-2xl font-bold">- {{ $t('dashboard.overview.title') }}- </h1>- </div>-- <div class="grid grid-cols-2 lg:grid-cols-4 gap-4">- <DashboardIndicator- :title="$t('dashboard.overview.indicator.totalPhotos')"- icon="tabler:photo"- color="blue"- :value="dashboardStats?.photos?.total || 0"- />- <DashboardIndicator- :title="$t('dashboard.overview.indicator.thisMonth')"- icon="tabler:photo-plus"- color="green"- :value="dashboardStats?.photos?.thisMonth || 0"- />- <DashboardIndicator- :title="$t('dashboard.overview.indicator.queueStatus.title')"- icon="tabler:loader"- color="purple"- :value="- (dashboardStats?.workerPool?.activeWorkers || 0) > 0- ? $t('dashboard.overview.indicator.queueStatus.processing')- : $t('dashboard.overview.indicator.queueStatus.pending')- "- clickable- @click="$router.push('/dashboard/queue')"- />- <DashboardIndicator- :title="$t('dashboard.overview.indicator.storageUsage')"- icon="tabler:database"- color="blue"- :value="formatBytes(dashboardStats?.storage?.totalSize || 0)"- />- </div>-- <!-- 运行信息 -->- <UCard>- <template #header>- <h2 class="text-lg font-semibold pb-1.5">- {{ $t('dashboard.overview.section.runtimeInfo.title') }}- </h2>- </template>-- <div class="grid grid-cols-2 md:grid-cols-4 gap-4">- <div>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.overview.section.runtimeInfo.version') }}- </p>- <NuxtLink- class="text-lg font-bold hover:text-primary"- target="_blank"- external- :to="`https://github.com/HoshinoSuzumi/chronoframe/releases/tag/v${$config.public.VERSION}`"- >- v{{ $config.public.VERSION }}- </NuxtLink>- </div>- <div>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.overview.section.runtimeInfo.uptime') }}- </p>- <p class="text-lg font-bold">- {{- dashboardStats?.uptime- ? $dayjs.duration(dashboardStats.uptime, 'seconds').humanize()- : '-'- }}- </p>- </div>- <div>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.overview.section.runtimeInfo.environment') }}- </p>- <UBadge- :color="dashboardStats?.runningOn === 'docker' ? 'info' : 'success'"- variant="soft"- >- {{- $t(- `dashboard.overview.section.runtimeInfo.systems.${dashboardStats?.runningOn || 'unknown'}`,- )- }}- </UBadge>- </div>- <!-- <div>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.overview.section.runtimeInfo.lastUpdate') }}- </p>- <p class="text-lg font-bold">- <ClientOnly>- {{ $dayjs().fromNow() }}- <template #placeholder>--</template>- </ClientOnly>- </p>- </div> -->- <div>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- Share Your Site- </p>- <p class="text-lg font-bold">- <UButton- external- variant="subtle"- size="xs"- color="info"- trailing-icon="tabler:external-link"- @click="onShareSite"- >- 分享你的站点- </UButton>- </p>+ <UDashboardPanel>+ <template #header>+ <UDashboardNavbar :title="$t('dashboard.overview.title')" />+ </template>++ <template #body>+ <div class="flex flex-col gap-6">+ <div class="grid grid-cols-2 lg:grid-cols-4 gap-4">+ <DashboardIndicator+ :title="$t('dashboard.overview.indicator.totalPhotos')"+ icon="tabler:photo"+ color="blue"+ :value="dashboardStats?.photos?.total || 0"+ clickable+ @click="$router.push('/dashboard/photos')"+ />+ <DashboardIndicator+ :title="$t('dashboard.overview.indicator.thisMonth')"+ icon="tabler:photo-plus"+ color="green"+ :value="dashboardStats?.photos?.thisMonth || 0"+ />+ <DashboardIndicator+ :title="$t('dashboard.overview.indicator.queueStatus.title')"+ icon="tabler:loader"+ color="purple"+ :value="+ (dashboardStats?.workerPool?.activeWorkers || 0) > 0+ ? $t('dashboard.overview.indicator.queueStatus.processing')+ : $t('dashboard.overview.indicator.queueStatus.pending')+ "+ clickable+ @click="$router.push('/dashboard/queue')"+ />+ <DashboardIndicator+ :title="$t('dashboard.overview.indicator.storageUsage')"+ icon="tabler:database"+ color="blue"+ :value="formatBytes(dashboardStats?.storage?.totalSize || 0)"+ /></div>- </div>- </UCard>- <!-- 详细统计区域 -->- <div class="grid grid-cols-1 lg:grid-cols-3 gap-4">- <!-- 左侧 -->- <div class="lg:col-span-2">- <UCard>- <div class="heatmap-container">- <ClientOnly>- <CalendarHeatmap- theme="blue"- :values="heatmapData"- :start-date="heatmapStartDate"- :end-date="heatmapEndDate"- :round="3"- :tooltip-formatter="- (item: CalendarItem) => {- return $t('common.heatmap.tooltip.data', [- $dayjs(item.date).format('LL'),- item.count || 0,- ])- }- "- :tooltip-no-data-formatter="- (date: Date) =>- $t('common.heatmap.tooltip.noData', [- $dayjs(date).format('LL'),- ])- "- :locale="{- months: [- $t('common.months.jan'),- $t('common.months.feb'),- $t('common.months.mar'),- $t('common.months.apr'),- $t('common.months.may'),- $t('common.months.jun'),- $t('common.months.jul'),- $t('common.months.aug'),- $t('common.months.sep'),- $t('common.months.oct'),- $t('common.months.nov'),- $t('common.months.dec'),- ],- days: [- $t('common.days.sun'),- $t('common.days.mon'),- $t('common.days.tue'),- $t('common.days.wed'),- $t('common.days.thu'),- $t('common.days.fri'),- $t('common.days.sat'),- ],- less: $t('common.heatmap.legend.less'),- more: $t('common.heatmap.legend.more'),- }"- :dark-mode="$colorMode.value === 'dark'"- >- <template #vch__legend-left>- <USelectMenu- v-model="selectedYear"- :items="yearOptions"- :disabled="yearOptions.length <= 1"- :search-input="false"- value-key="value"- size="xs"- variant="soft"- class="w-24"- />- </template>- </CalendarHeatmap>- <template #placeholder>- <div class="flex items-center justify-center h-[164.5px]">- <Icon- name="svg-spinners:180-ring-with-bg"- class="size-8 opacity-50"- mode="svg"- />- </div>- </template>- </ClientOnly>- </div>- </UCard>- </div>-- <!-- 右侧:系统资源监控 -->- <div class="w-full space-y-4">- <!-- 内存使用 -->+ <!-- 运行信息 --><UCard><template #header>- <h3 class="font-semibold pb-1.5">- {{ $t('dashboard.overview.section.memory.title') }}- </h3>+ <h2 class="text-lg font-semibold pb-1.5">+ {{ $t('dashboard.overview.section.runtimeInfo.title') }}+ </h2></template>- <div class="space-y-2">- <UProgress- :model-value="- dashboardStats?.memory- ? Math.round(- (dashboardStats.memory.used /- dashboardStats.memory.total) *- 100,- )- : 0- "- :color="- systemStatus === 'healthy'- ? 'success'- : systemStatus === 'warning'- ? 'warning'- : systemStatus === 'critical'- ? 'error'- : 'neutral'- "- class="w-full"- />- <div class="flex justify-between text-sm">- <div class="text-xs text-neutral-500 dark:text-neutral-400">+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">+ <div>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.overview.section.runtimeInfo.version') }}+ </p>+ <NuxtLink+ class="text-lg font-bold hover:text-primary"+ target="_blank"+ external+ :to="`https://github.com/HoshinoSuzumi/chronoframe/releases/tag/v${$config.public.VERSION}`"+ >+ v{{ $config.public.VERSION }}+ </NuxtLink>+ </div>+ <div>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.overview.section.runtimeInfo.uptime') }}+ </p>+ <p class="text-lg font-bold">{{- dashboardStats?.memory- ? `${Math.round((dashboardStats.memory.used / 1024 / 1024 / 1024) * 100) / 100}GB / ${Math.round((dashboardStats.memory.total / 1024 / 1024 / 1024) * 100) / 100}GB`- : 'memory info not available'+ dashboardStats?.uptime+ ? $dayjs+ .duration(dashboardStats.uptime, 'seconds')+ .humanize()+ : '-'}}- </div>- <span>- {{- dashboardStats?.memory- ? Math.round(- (dashboardStats.memory.used /- dashboardStats.memory.total) *- 100,- )- : 0- }}%- </span>+ </p></div>- </div>- </UCard>-- <!-- 队列详情 -->- <UCard>- <template #header>- <h3 class="font-semibold pb-1.5">- {{ $t('dashboard.overview.section.queue.title') }}- </h3>- </template>-- <div class="space-y-1">- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.activeWorkers') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.activeWorkers || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalWorkers') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalWorkers || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalProcessed') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalProcessed || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalFailed') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalErrors || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.avgSuccessRate') }}- </span>+ <div>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.overview.section.runtimeInfo.environment') }}+ </p><UBadge:color="- (dashboardStats?.workerPool?.averageSuccessRate || 0) > 90- ? 'success'- : (dashboardStats?.workerPool?.averageSuccessRate || 0) > 70- ? 'warning'- : 'error'+ dashboardStats?.runningOn === 'docker' ? 'info' : 'success'"variant="soft">{{- Math.round(- dashboardStats?.workerPool?.averageSuccessRate || 0,+ $t(+ `dashboard.overview.section.runtimeInfo.systems.${dashboardStats?.runningOn || 'unknown'}`,)- }}%+ }}</UBadge></div>+ <!-- <div>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.overview.section.runtimeInfo.lastUpdate') }}+ </p>+ <p class="text-lg font-bold">+ <ClientOnly>+ {{ $dayjs().fromNow() }}+ <template #placeholder>--</template>+ </ClientOnly>+ </p>+ </div> -->+ <div>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ Share Your Site+ </p>+ <p class="text-lg font-bold">+ <UButton+ external+ variant="subtle"+ size="xs"+ color="info"+ trailing-icon="tabler:external-link"+ @click="onShareSite"+ >+ 分享你的站点+ </UButton>+ </p>+ </div></div></UCard>++ <!-- 详细统计区域 -->+ <div class="grid grid-cols-1 lg:grid-cols-5 gap-4">+ <!-- 左侧 -->+ <div class="lg:col-span-3">+ <UCard>+ <div class="heatmap-container">+ <ClientOnly>+ <CalendarHeatmap+ theme="blue"+ :values="heatmapData"+ :start-date="heatmapStartDate"+ :end-date="heatmapEndDate"+ :round="3"+ :tooltip-formatter="+ (item: CalendarItem) => {+ return $t('common.heatmap.tooltip.data', [+ $dayjs(item.date).format('LL'),+ item.count || 0,+ ])+ }+ "+ :tooltip-no-data-formatter="+ (date: Date) =>+ $t('common.heatmap.tooltip.noData', [+ $dayjs(date).format('LL'),+ ])+ "+ :locale="{+ months: [+ $t('common.months.jan'),+ $t('common.months.feb'),+ $t('common.months.mar'),+ $t('common.months.apr'),+ $t('common.months.may'),+ $t('common.months.jun'),+ $t('common.months.jul'),+ $t('common.months.aug'),+ $t('common.months.sep'),+ $t('common.months.oct'),+ $t('common.months.nov'),+ $t('common.months.dec'),+ ],+ days: [+ $t('common.days.sun'),+ $t('common.days.mon'),+ $t('common.days.tue'),+ $t('common.days.wed'),+ $t('common.days.thu'),+ $t('common.days.fri'),+ $t('common.days.sat'),+ ],+ less: $t('common.heatmap.legend.less'),+ more: $t('common.heatmap.legend.more'),+ }"+ :dark-mode="$colorMode.value === 'dark'"+ >+ <template #vch__legend-left>+ <USelectMenu+ v-model="selectedYear"+ :items="yearOptions"+ :disabled="yearOptions.length <= 1"+ :search-input="false"+ value-key="value"+ size="xs"+ variant="soft"+ class="w-24"+ />+ </template>+ </CalendarHeatmap>+ <template #placeholder>+ <div class="flex items-center justify-center h-[164.5px]">+ <Icon+ name="svg-spinners:180-ring-with-bg"+ class="size-8 opacity-50"+ mode="svg"+ />+ </div>+ </template>+ </ClientOnly>+ </div>+ </UCard>+ </div>++ <!-- 右侧:系统资源监控 -->+ <div class="lg:col-span-2 w-full space-y-4">+ <!-- 内存使用 -->+ <UCard>+ <template #header>+ <h3 class="font-semibold pb-1.5">+ {{ $t('dashboard.overview.section.memory.title') }}+ </h3>+ </template>++ <div class="space-y-2">+ <UProgress+ :model-value="+ dashboardStats?.memory+ ? Math.round(+ (dashboardStats.memory.used /+ dashboardStats.memory.total) *+ 100,+ )+ : 0+ "+ :color="+ systemStatus === 'healthy'+ ? 'success'+ : systemStatus === 'warning'+ ? 'warning'+ : systemStatus === 'critical'+ ? 'error'+ : 'neutral'+ "+ class="w-full"+ />+ <div class="flex justify-between text-sm">+ <div class="text-xs text-neutral-500 dark:text-neutral-400">+ {{+ dashboardStats?.memory+ ? `${Math.round((dashboardStats.memory.used / 1024 / 1024 / 1024) * 100) / 100}GB / ${Math.round((dashboardStats.memory.total / 1024 / 1024 / 1024) * 100) / 100}GB`+ : 'memory info not available'+ }}+ </div>+ <span>+ {{+ dashboardStats?.memory+ ? Math.round(+ (dashboardStats.memory.used /+ dashboardStats.memory.total) *+ 100,+ )+ : 0+ }}%+ </span>+ </div>+ </div>+ </UCard>++ <!-- 队列详情 -->+ <UCard>+ <template #header>+ <h3 class="font-semibold pb-1.5">+ {{ $t('dashboard.overview.section.queue.title') }}+ </h3>+ </template>++ <div class="space-y-1">+ <div class="flex justify-between items-center text-sm">+ <span>+ {{ $t('dashboard.overview.section.queue.activeWorkers') }}+ </span>+ <UBadge variant="soft">+ {{ dashboardStats?.workerPool?.activeWorkers || 0 }}+ </UBadge>+ </div>+ <div class="flex justify-between items-center text-sm">+ <span>+ {{ $t('dashboard.overview.section.queue.totalWorkers') }}+ </span>+ <UBadge variant="soft">+ {{ dashboardStats?.workerPool?.totalWorkers || 0 }}+ </UBadge>+ </div>+ <div class="flex justify-between items-center text-sm">+ <span>+ {{ $t('dashboard.overview.section.queue.totalProcessed') }}+ </span>+ <UBadge variant="soft">+ {{ dashboardStats?.workerPool?.totalProcessed || 0 }}+ </UBadge>+ </div>+ <div class="flex justify-between items-center text-sm">+ <span>+ {{ $t('dashboard.overview.section.queue.totalFailed') }}+ </span>+ <UBadge variant="soft">+ {{ dashboardStats?.workerPool?.totalErrors || 0 }}+ </UBadge>+ </div>+ <div class="flex justify-between items-center text-sm">+ <span>+ {{ $t('dashboard.overview.section.queue.avgSuccessRate') }}+ </span>+ <UBadge+ :color="+ (dashboardStats?.workerPool?.averageSuccessRate || 0) > 90+ ? 'success'+ : (dashboardStats?.workerPool?.averageSuccessRate ||+ 0) > 70+ ? 'warning'+ : 'error'+ "+ variant="soft"+ >+ {{+ Math.round(+ dashboardStats?.workerPool?.averageSuccessRate || 0,+ )+ }}%+ </UBadge>+ </div>+ </div>+ </UCard>+ </div>+ </div></div>- </div>- </div>+ </template>+ </UDashboardPanel></template><style>diff --git a/app/pages/dashboard/logs.vue b/app/pages/dashboard/logs.vueindex f0e4d77e..58df9efc 100644--- a/app/pages/dashboard/logs.vue+++ b/app/pages/dashboard/logs.vue@@ -57,37 +57,37 @@ const addLogEntry = (logEntry: LogEntry) => {// 处理批队列const processBatch = async () => {if (isBatchProcessing.value || batchQueue.value.length === 0) return-+isBatchProcessing.value = true-+while (batchQueue.value.length > 0) {const batch = batchQueue.value.splice(0, BATCH_SIZE)logs.value.push(...batch)-+// 限制日志条数,避免内存泄漏if (logs.value.length > 10000) {logs.value = logs.value.slice(-5000)}-+// 更新加载进度(只在初始加载时显示)if (isInitialLoading.value) {const totalProcessed = logs.value.lengthloadingProgress.value = Math.min(100, (totalProcessed / 512) * 100)}-+// 自动滚动到底部if (autoScroll.value) {await scrollToBottom()}-+// 如果还有更多批次,延迟处理以避免阻塞UIif (batchQueue.value.length > 0) {- await new Promise(resolve => setTimeout(resolve, BATCH_DELAY))+ await new Promise((resolve) => setTimeout(resolve, BATCH_DELAY))}}-+isBatchProcessing.value = false-+// 注意:初始加载完成现在由消息超时检测控制,不在这里处理}@@ -241,7 +241,7 @@ const handleScroll = () => {const { scrollTop, scrollHeight, clientHeight } = logContainer.valueconst isNearBottom = scrollTop + clientHeight >= scrollHeight - 50 // 距离底部50px以内const isAtTop = scrollTop + clientHeight < scrollHeight - 200 // 距离底部200px以上-+// 如果滚动到接近底部,自动开启自动滚动if (isNearBottom && !autoScroll.value) {autoScroll.value = true@@ -263,10 +263,10 @@ const connectLogStream = () => {batchQueue.value = []isInitialLoading.value = trueloadingProgress.value = 0-+connectionStatus.value = '正在连接...'eventSource = new EventSource('/api/system/logs')-+let initialLoadCompleteTimer: NodeJS.Timeout | null = nullconst MESSAGE_TIMEOUT = 2000 // 消息间隔超时时间(毫秒)@@ -280,16 +280,15 @@ const connectLogStream = () => {if (logLine && logLine.trim()) {const logEntry = parseLogLine(logLine)if (logEntry) {-// 清除之前的定时器if (initialLoadCompleteTimer) {clearTimeout(initialLoadCompleteTimer)initialLoadCompleteTimer = null}-+if (isInitialLoading.value) {addLogEntry(logEntry)-+// 设置新的定时器,如果在指定时间内没有新消息,认为初始加载完成initialLoadCompleteTimer = setTimeout(() => {if (isInitialLoading.value) {@@ -302,7 +301,6 @@ const connectLogStream = () => {}, 500)}}, MESSAGE_TIMEOUT)-} else {// 实时日志直接添加addLogEntry(logEntry)@@ -340,75 +338,79 @@ onUnmounted(() => {</script><template>- <div class="h-full flex flex-col pt-4">- <!-- 日志内容区域 -->- <div- class="flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-950 rounded-md relative"- >+ <UDashboardPanel>+ <template #header>+ <UDashboardNavbar :title="$t('title.logs')" />+ </template>++ <template #body><div- class="px-4 py-2 border-b border-neutral-300 dark:border-neutral-900 flex items-center justify-between"+ class="flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-950 rounded-md relative">- <div>- <h2 class="text-lg font-medium text-blue-600">app.log</h2>- <p class="text-xs text-gray-500 dark:text-gray-400">- <span- v-if="connectionStatus"- :class="getConnectionStatusClass()"- >- {{ connectionStatus }}- </span>- </p>- </div>- <div class="flex items-center gap-2">- <!-- Search -->- <UInput- v-model="searchQuery"- placeholder="搜索日志内容..."- size="sm"- class="w-48"- icon="tabler:search"- :ui="{ trailing: 'pe-1' }"- >- <template- v-if="searchQuery?.length"- #trailing+ <div+ class="px-4 py-2 border-b border-neutral-300 dark:border-neutral-900 flex items-center justify-between"+ >+ <div>+ <h2 class="text-lg font-medium text-blue-600">app.log</h2>+ <p class="text-xs text-gray-500 dark:text-gray-400">+ <span+ v-if="connectionStatus"+ :class="getConnectionStatusClass()"+ >+ {{ connectionStatus }}+ </span>+ </p>+ </div>+ <div class="flex items-center gap-2">+ <!-- Search -->+ <UInput+ v-model="searchQuery"+ placeholder="搜索日志内容..."+ size="sm"+ class="w-48"+ icon="tabler:search"+ :ui="{ trailing: 'pe-1' }">- <UButton- color="neutral"- variant="link"- size="sm"- icon="tabler:x"- aria-label="Clear search input"- @click="searchQuery = ''"- />- </template>- </UInput>- <!-- Log level -->- <USelect- v-model="selectedLevels"- :items="- logLevels.map((level) => ({- label: level.toUpperCase(),- value: level,- }))- "- multiple- size="sm"- placeholder="过滤级别"- class="w-24"- :clearable="false"- />- <!-- Auto scroll -->- <UButton- icon="tabler:arrow-bar-to-down"- color="neutral"- size="sm"- :variant="autoScroll ? 'outline' : 'soft'"- @click="toggleAutoScroll"- />- <!-- Download raw log -->- <!-- TODO: Download raw log file -->- <!-- <UButton+ <template+ v-if="searchQuery?.length"+ #trailing+ >+ <UButton+ color="neutral"+ variant="link"+ size="sm"+ icon="tabler:x"+ aria-label="Clear search input"+ @click="searchQuery = ''"+ />+ </template>+ </UInput>+ <!-- Log level -->+ <USelect+ v-model="selectedLevels"+ :items="+ logLevels.map((level) => ({+ label: level.toUpperCase(),+ value: level,+ }))+ "+ multiple+ size="sm"+ placeholder="过滤级别"+ class="w-24"+ :clearable="false"+ />+ <!-- Auto scroll -->+ <UButton+ icon="tabler:arrow-bar-to-down"+ color="neutral"+ size="sm"+ :variant="autoScroll ? 'outline' : 'soft'"+ @click="toggleAutoScroll"+ />+ <!-- Download raw log -->+ <!-- TODO: Download raw log file -->+ <!-- <UButtonas="a"target="_blank"rel="noopener"@@ -417,94 +419,98 @@ onUnmounted(() => {size="sm"variant="soft"/> -->- </div>- </div>- <!-- 加载进度指示器 -->- <div- v-if="isInitialLoading"- class="absolute inset-0 bg-white/80 dark:bg-black/80 backdrop-blur-sm flex items-center justify-center z-10"- >- <div class="text-center">- <div class="mb-4">- <UIcon name="tabler:loader-2" class="animate-spin w-8 h-8 text-blue-500" />- </div>- <div class="text-sm text-gray-600 dark:text-gray-400 mb-2">- 正在加载历史日志...- </div>- <div class="w-64 bg-gray-200 dark:bg-gray-700 rounded-full h-2">- <div- class="bg-blue-500 h-2 rounded-full transition-all duration-300 ease-out"- :style="{ width: `${loadingProgress}%` }"- ></div></div>- <div class="text-xs text-gray-500 dark:text-gray-400 mt-1">- {{ Math.round(loadingProgress) }}%+ </div>+ <!-- 加载进度指示器 -->+ <div+ v-if="isInitialLoading"+ class="absolute inset-0 bg-white/80 dark:bg-black/80 backdrop-blur-sm flex items-center justify-center z-10"+ >+ <div class="text-center">+ <div class="mb-4">+ <UIcon+ name="tabler:loader-2"+ class="animate-spin w-8 h-8 text-blue-500"+ />+ </div>+ <div class="text-sm text-gray-600 dark:text-gray-400 mb-2">+ 正在加载历史日志...+ </div>+ <div class="w-64 bg-gray-200 dark:bg-gray-700 rounded-full h-2">+ <div+ class="bg-blue-500 h-2 rounded-full transition-all duration-300 ease-out"+ :style="{ width: `${loadingProgress}%` }"+ ></div>+ </div>+ <div class="text-xs text-gray-500 dark:text-gray-400 mt-1">+ {{ Math.round(loadingProgress) }}%+ </div></div></div>- </div>- <div- ref="logContainer"- class="h-[calc(100vh-10rem)] overflow-y-auto overflow-x-auto scroll-smooth font-mono text-sm relative"- @scroll="handleScroll"- >- <div class="p-2 space-y-1">- <div- v-for="(log, index) in filteredLogs"- :key="index"- :class="['px-2 py-0.5 rounded border-l-4', getLogLineStyle(log)]"- >- <div class="flex items-start space-x-3 text-sm">- <!-- 时间戳 -->- <span- class="text-neutral-400 dark:text-neutral-500 text-xs whitespace-nowrap min-w-0 flex-shrink-0 mt-0.5"- >- {{ $dayjs(log.date).format('HH:mm:ss.SSS') }}- </span>-- <!-- 日志级别 -->- <UBadge- size="sm"- :variant="log.level <= 1 ? 'solid' : 'soft'"- :color="getBadgeColor(log.type || getLevelType(log.level))"- >- {{- (log.type || getLevelType(log.level))- .toUpperCase()- .slice(0, 4)- }}- </UBadge>-- <!-- 日志内容 -->- <div class="flex-1 min-w-0">+ <div+ ref="logContainer"+ class="h-[calc(100vh-10rem)] overflow-y-auto overflow-x-auto scroll-smooth font-mono text-sm relative"+ @scroll="handleScroll"+ >+ <div class="p-2 space-y-1">+ <div+ v-for="(log, index) in filteredLogs"+ :key="index"+ :class="['px-2 py-0.5 rounded border-l-4', getLogLineStyle(log)]"+ >+ <div class="flex items-start space-x-3 text-sm">+ <!-- 时间戳 -->+ <span+ class="text-neutral-400 dark:text-neutral-500 text-xs whitespace-nowrap min-w-0 flex-shrink-0 mt-0.5"+ >+ {{ $dayjs(log.date).format('HH:mm:ss.SSS') }}+ </span>++ <!-- 日志级别 -->+ <UBadge+ size="sm"+ :variant="log.level <= 1 ? 'solid' : 'soft'"+ :color="getBadgeColor(log.type || getLevelType(log.level))"+ >+ {{+ (log.type || getLevelType(log.level))+ .toUpperCase()+ .slice(0, 4)+ }}+ </UBadge>++ <!-- 日志内容 -->+ <div class="flex-1 min-w-0">+ <span+ class="whitespace-pre-wrap break-words"+ v-html="highlightSearch(formatLogArgs(log.args))"+ ></span>+ </div>++ <!-- 标签 --><span- class="whitespace-pre-wrap break-words"- v-html="highlightSearch(formatLogArgs(log.args))"- ></span>+ v-if="log.tag"+ class="text-xs whitespace-nowrap flex-shrink-0 truncate text-neutral-400/80"+ >+ {{ log.tag }}+ </span></div>-- <!-- 标签 -->- <span- v-if="log.tag"- class="text-xs whitespace-nowrap flex-shrink-0 truncate text-neutral-400/80"- >- {{ log.tag }}- </span></div>- </div>- <!-- 空状态 -->- <div- v-if="filteredLogs.length === 0"- class="text-center py-8 text-gray-500 dark:text-gray-400"- >- <div v-if="logs.length === 0">等待日志数据...</div>- <div v-else>没有匹配的日志条目</div>+ <!-- 空状态 -->+ <div+ v-if="filteredLogs.length === 0"+ class="text-center py-8 text-gray-500 dark:text-gray-400"+ >+ <div v-if="logs.length === 0">等待日志数据...</div>+ <div v-else>没有匹配的日志条目</div>+ </div></div></div></div>- </div>- </div>+ </template>+ </UDashboardPanel></template><style scoped>diff --git a/app/pages/dashboard/photos.vue b/app/pages/dashboard/photos.vueindex 4798c685..0ebfda35 100644--- a/app/pages/dashboard/photos.vue+++ b/app/pages/dashboard/photos.vue@@ -1755,710 +1755,738 @@ onUnmounted(() => {</script><template>- <div class="flex flex-col gap-3 sm:gap-4 h-full p-3 sm:p-4">- <!-- 上传队列容器 - 使用新的浮动组件 -->- <UploadQueuePanel- :uploading-files="uploadingFiles"- @remove-file="removeUploadingFile"- @clear-completed="clearCompletedUploads"- @clear-all="clearAllUploads"- @go-to-queue="$router.push('/dashboard/queue')"- />-- <!-- 文件上传入口 -->- <div- class="relative overflow-hidden rounded-3xl border border-neutral-200/80 bg-linear-to-br from-white via-white to-neutral-50 shadow-sm transition dark:border-neutral-800/70 dark:from-neutral-900 dark:via-neutral-900/80 dark:to-neutral-900"- >- <div- class="pointer-events-none absolute -left-32 -top-24 h-72 w-[18rem] rounded-full bg-primary-400/20 blur-3xl dark:bg-primary-500/20"- />- <div class="relative flex flex-col gap-6 p-5 sm:p-8">+ <UDashboardPanel>+ <template #header>+ <UDashboardNavbar :title="$t('dashboard.photos.toolbar.title')" />+ </template>++ <template #body>+ <div class="flex flex-col gap-3">+ <!-- 上传队列容器 -->+ <UploadQueuePanel+ :uploading-files="uploadingFiles"+ @remove-file="removeUploadingFile"+ @clear-completed="clearCompletedUploads"+ @clear-all="clearAllUploads"+ @go-to-queue="$router.push('/dashboard/queue')"+ />++ <!-- 文件上传入口 --><div- class="flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between"+ class="relative overflow-hidden rounded-3xl border border-neutral-200/80 bg-linear-to-br from-white via-white to-neutral-50 shadow-sm transition dark:border-neutral-800/70 dark:from-neutral-900 dark:via-neutral-900/80 dark:to-neutral-900">- <div class="space-y-4">- <div class="flex items-center gap-3">- <span- class="flex size-12 items-center justify-center rounded-2xl bg-primary-500/10 text-primary-600 dark:bg-primary-500/15 dark:text-primary-300"- >- <Icon- name="tabler:cloud-upload"- class="size-6"- />- </span>- <div>- <h2- class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"+ <div+ class="pointer-events-none absolute -left-32 -top-24 h-72 w-[18rem] rounded-full bg-primary-400/20 blur-3xl dark:bg-primary-500/20"+ />+ <div class="relative flex flex-col gap-6 p-5 sm:p-8">+ <div+ class="flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between"+ >+ <div class="space-y-4">+ <div class="flex items-center gap-3">+ <span+ class="flex size-12 items-center justify-center rounded-2xl bg-primary-500/10 text-primary-600 dark:bg-primary-500/15 dark:text-primary-300"+ >+ <Icon+ name="tabler:cloud-upload"+ class="size-6"+ />+ </span>+ <div>+ <h2+ class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"+ >+ {{ $t('dashboard.photos.title') }}+ </h2>+ <i18n-t+ keypath="dashboard.photos.subtitle"+ tag="p"+ class="mt-1 text-sm text-neutral-500 dark:text-neutral-400"+ >+ <template #default>+ <NuxtLink+ to="/dashboard/albums"+ class="text-primary font-medium"+ >+ {{ $t('title.albums') }}+ </NuxtLink>+ </template>+ </i18n-t>+ </div>+ </div>+ <div+ class="flex flex-wrap items-center gap-1 text-xs font-medium text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.photos.title') }}- </h2>- <i18n-t- keypath="dashboard.photos.subtitle"- tag="p"- class="mt-1 text-sm text-neutral-500 dark:text-neutral-400"+ <UBadge+ variant="soft"+ color="primary"+ size="sm"+ >+ JPEG / PNG+ </UBadge>+ <UBadge+ variant="soft"+ color="primary"+ size="sm"+ >+ HEIC+ </UBadge>+ <UBadge+ variant="soft"+ color="primary"+ size="sm"+ >+ {{ $t('ui.livePhoto') }}+ </UBadge>+ <UBadge+ variant="soft"+ color="primary"+ size="sm"+ >+ Motion Photo+ </UBadge>+ <UBadge+ variant="outline"+ color="neutral"+ size="sm"+ >+ {{+ $t('dashboard.photos.maxFileSize', {+ size: MAX_FILE_SIZE,+ })+ }}+ </UBadge>+ </div>+ </div>++ <div class="flex gap-2 items-center">+ <UButton+ variant="soft"+ size="lg"+ class="w-full sm:w-auto"+ icon="tabler:list-check"+ @click="$router.push('/dashboard/queue')">- <template #default>- <NuxtLink- to="/dashboard/albums"- class="text-primary font-medium"- >- {{ $t('title.albums') }}- </NuxtLink>- </template>- </i18n-t>+ {{ $t('dashboard.photos.buttons.queue') }}+ </UButton>+ <UButton+ size="lg"+ class="w-full sm:w-auto"+ icon="tabler:cloud-upload"+ @click="openUploadSlideover"+ >+ {{ $t('dashboard.photos.buttons.upload') }}+ </UButton></div></div>+ </div>+ </div>++ <USlideover+ v-model:open="isUploadSlideoverOpen"+ :title="$t('dashboard.photos.slideover.title')"+ :description="$t('dashboard.photos.slideover.description')"+ :ui="{+ content: 'sm:max-w-xl',+ body: 'p-2',+ header:+ 'px-6 py-5 border-b border-neutral-200 dark:border-neutral-800',+ footer:+ 'px-6 py-5 border-t border-neutral-200 dark:border-neutral-800',+ }"+ >+ <template #body>+ <UFileUpload+ v-model="selectedFiles"+ :label="$t('dashboard.photos.uploader.label')"+ :description="+ $t('dashboard.photos.uploader.description', {+ maxSize: MAX_FILE_SIZE,+ })+ "+ icon="tabler:cloud-upload"+ layout="list"+ size="xl"+ accept="image/jpeg,image/png,image/heic,image/heif,video/quicktime,.mov"+ multiple+ highlight+ dropzone+ :file-delete="{ variant: 'soft', color: 'neutral' }"+ :ui="{+ root: 'w-full',+ base: 'group relative flex flex-col items-center justify-center gap-3 rounded-3xl border-2 border-dashed border-neutral-200/80 bg-white/90 px-6 py-12 text-center shadow-sm transition-all duration-300 hover:border-primary-400/80 hover:bg-primary-500/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/60 dark:border-neutral-700/70 dark:bg-neutral-900/80',+ wrapper: 'flex flex-col items-center gap-2',+ label:+ 'text-base font-semibold text-neutral-800 dark:text-neutral-100',+ description: 'text-sm text-neutral-500 dark:text-neutral-400',+ files: 'mt-2 flex w-full flex-col gap-2 overflow-y-auto',+ file: 'flex items-center justify-between gap-3 rounded-2xl border border-neutral-200/80 bg-white/80 px-4 py-3 text-left shadow-sm shadow-black/5 backdrop-blur-sm dark:border-neutral-800/80 dark:bg-neutral-900/70',+ fileLeadingAvatar: 'ring-1 ring-white/80 dark:ring-neutral-800',+ fileWrapper: 'min-w-0 flex-1',+ fileName:+ 'text-sm font-medium text-neutral-700 dark:text-neutral-100 truncate',+ fileSize: 'text-xs text-neutral-500 dark:text-neutral-400',+ fileTrailingButton: 'text-neutral-400 hover:text-error-500',+ }"+ />+ </template>++ <template #footer><div- class="flex flex-wrap items-center gap-1 text-xs font-medium text-neutral-500 dark:text-neutral-400"+ class="flex w-full flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">- <UBadge- variant="soft"- color="primary"- size="sm"- >- JPEG / PNG- </UBadge>- <UBadge- variant="soft"- color="primary"- size="sm"+ <div+ class="flex flex-col gap-1 text-sm text-neutral-500 dark:text-neutral-400">- HEIC- </UBadge>+ <span>{{+ hasSelectedFiles+ ? selectedFilesSummary+ : $t('dashboard.photos.slideover.footer.noSelection')+ }}</span>+ </div>+ <div class="flex w-full flex-col gap-2 sm:w-auto sm:flex-row">+ <UButton+ variant="soft"+ color="neutral"+ class="w-full sm:w-auto"+ :disabled="!hasSelectedFiles"+ @click="clearSelectedFiles"+ >+ {{ $t('dashboard.photos.slideover.buttons.clear') }}+ </UButton>+ <UButton+ color="primary"+ size="lg"+ class="w-full sm:w-auto"+ icon="tabler:upload"+ :disabled="!hasSelectedFiles"+ @click="handleUpload"+ >+ {{+ hasSelectedFiles+ ? $t('dashboard.photos.slideover.buttons.upload', {+ count: selectedFiles.length,+ })+ : $t('dashboard.photos.buttons.upload')+ }}+ </UButton>+ </div>+ </div>+ </template>+ </USlideover>++ <!-- 工具栏 -->+ <div+ class="flex flex-row sm:items-center justify-between gap-3 sm:gap-0 p-3 sm:p-4 bg-neutral-50 dark:bg-neutral-900/50 border border-neutral-200 dark:border-neutral-700 rounded-lg"+ >+ <div class="flex items-center gap-2">+ <UIcon+ name="tabler:photo"+ class="text-neutral-500"+ />+ <span+ class="font-medium text-neutral-700 dark:text-neutral-300 hidden sm:inline"+ >+ {{ $t('dashboard.photos.toolbar.title') }}+ </span>+ <div class="flex items-center gap-1 sm:gap-2"><UBadge+ v-if="livePhotoStats.staticPhotos > 0"variant="soft"- color="primary"+ color="neutral"size="sm">- {{ $t('ui.livePhoto') }}+ <span class="hidden sm:inline"+ >{{ livePhotoStats.staticPhotos }}+ {{ $t('dashboard.photos.stats.photos') }}</span+ >+ <span class="sm:hidden"+ >{{ livePhotoStats.staticPhotos }}P</span+ ></UBadge><UBadge+ v-if="livePhotoStats.livePhotos > 0"variant="soft"- color="primary"- size="sm"- >- Motion Photo- </UBadge>- <UBadge- variant="outline"- color="neutral"+ color="warning"size="sm">- {{- $t('dashboard.photos.maxFileSize', { size: MAX_FILE_SIZE })- }}+ <span class="hidden sm:inline"+ >{{ livePhotoStats.livePhotos }}+ {{ $t('dashboard.photos.stats.livePhotos') }}</span+ >+ <span class="sm:hidden">{{ livePhotoStats.livePhotos }}LP</span></UBadge></div></div>- <div class="flex gap-2 items-center">- <UButton- variant="soft"- size="lg"- class="w-full sm:w-auto"- icon="tabler:list-check"- @click="$router.push('/dashboard/queue')"- >- {{ $t('dashboard.photos.buttons.queue') }}- </UButton>- <UButton- size="lg"- class="w-full sm:w-auto"- icon="tabler:cloud-upload"- @click="openUploadSlideover"+ <div class="flex items-center gap-2">+ <UPopover>+ <UTooltip :text="$t('ui.action.filter.tooltip')">+ <UChip+ inset+ size="sm"+ color="info"+ :show="totalSelectedFilters > 0"+ >+ <UButton+ variant="soft"+ :color="hasActiveFilters ? 'info' : 'neutral'"+ class="bg-transparent rounded-full cursor-pointer relative"+ icon="tabler:filter"+ size="sm"+ />+ </UChip>+ </UTooltip>++ <template #content>+ <UCard variant="glassmorphism">+ <OverlayFilterPanel />+ </UCard>+ </template>+ </UPopover>+ <!-- 过滤器 -->+ <USelectMenu+ v-model="photoFilter"+ class="w-full sm:w-48"+ :items="[+ {+ label: $t('dashboard.photos.photoFilter.all'),+ value: 'all',+ icon: 'tabler:photo-scan',+ },+ {+ label: $t('dashboard.photos.photoFilter.livephoto'),+ value: 'livephoto',+ icon: 'tabler:live-photo',+ },+ {+ label: $t('dashboard.photos.photoFilter.static'),+ value: 'static',+ icon: 'tabler:photo',+ },+ ]"+ value-key="value"+ label-key="label"+ size="sm">- {{ $t('dashboard.photos.buttons.upload') }}- </UButton>- </div>- </div>- </div>- </div>-- <USlideover- v-model:open="isUploadSlideoverOpen"- :title="$t('dashboard.photos.slideover.title')"- :description="$t('dashboard.photos.slideover.description')"- :ui="{- content: 'sm:max-w-xl',- body: 'p-2',- header: 'px-6 py-5 border-b border-neutral-200 dark:border-neutral-800',- footer: 'px-6 py-5 border-t border-neutral-200 dark:border-neutral-800',- }"- >- <template #body>- <UFileUpload- v-model="selectedFiles"- :label="$t('dashboard.photos.uploader.label')"- :description="- $t('dashboard.photos.uploader.description', {- maxSize: MAX_FILE_SIZE,- })- "- icon="tabler:cloud-upload"- layout="list"- size="xl"- accept="image/jpeg,image/png,image/heic,image/heif,video/quicktime,.mov"- multiple- highlight- dropzone- :file-delete="{ variant: 'soft', color: 'neutral' }"- :ui="{- root: 'w-full',- base: 'group relative flex flex-col items-center justify-center gap-3 rounded-3xl border-2 border-dashed border-neutral-200/80 bg-white/90 px-6 py-12 text-center shadow-sm transition-all duration-300 hover:border-primary-400/80 hover:bg-primary-500/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/60 dark:border-neutral-700/70 dark:bg-neutral-900/80',- wrapper: 'flex flex-col items-center gap-2',- label:- 'text-base font-semibold text-neutral-800 dark:text-neutral-100',- description: 'text-sm text-neutral-500 dark:text-neutral-400',- files: 'mt-2 flex w-full flex-col gap-2 overflow-y-auto',- file: 'flex items-center justify-between gap-3 rounded-2xl border border-neutral-200/80 bg-white/80 px-4 py-3 text-left shadow-sm shadow-black/5 backdrop-blur-sm dark:border-neutral-800/80 dark:bg-neutral-900/70',- fileLeadingAvatar: 'ring-1 ring-white/80 dark:ring-neutral-800',- fileWrapper: 'min-w-0 flex-1',- fileName:- 'text-sm font-medium text-neutral-700 dark:text-neutral-100 truncate',- fileSize: 'text-xs text-neutral-500 dark:text-neutral-400',- fileTrailingButton: 'text-neutral-400 hover:text-error-500',- }"- />- </template>+ </USelectMenu>- <template #footer>- <div- class="flex w-full flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"- >- <div- class="flex flex-col gap-1 text-sm text-neutral-500 dark:text-neutral-400"- >- <span>{{- hasSelectedFiles- ? selectedFilesSummary- : $t('dashboard.photos.slideover.footer.noSelection')- }}</span>- </div>- <div class="flex w-full flex-col gap-2 sm:w-auto sm:flex-row">+ <!-- 刷新按钮 --><UButtonvariant="soft"- color="neutral"- class="w-full sm:w-auto"- :disabled="!hasSelectedFiles"- @click="clearSelectedFiles"- >- {{ $t('dashboard.photos.slideover.buttons.clear') }}- </UButton>- <UButton- color="primary"- size="lg"- class="w-full sm:w-auto"- icon="tabler:upload"- :disabled="!hasSelectedFiles"- @click="handleUpload"- >- {{- hasSelectedFiles- ? $t('dashboard.photos.slideover.buttons.upload', {- count: selectedFiles.length,- })- : $t('dashboard.photos.buttons.upload')- }}- </UButton>- </div>- </div>- </template>- </USlideover>-- <!-- 工具栏 -->- <div- class="flex flex-row sm:items-center justify-between gap-3 sm:gap-0 p-3 sm:p-4 bg-neutral-50 dark:bg-neutral-900/50 border border-neutral-200 dark:border-neutral-700 rounded-lg"- >- <div class="flex items-center gap-2">- <UIcon- name="tabler:photo"- class="text-neutral-500"- />- <span- class="font-medium text-neutral-700 dark:text-neutral-300 hidden sm:inline"- >- {{ $t('dashboard.photos.toolbar.title') }}- </span>- <div class="flex items-center gap-1 sm:gap-2">- <UBadge- v-if="livePhotoStats.staticPhotos > 0"- variant="soft"- color="neutral"- size="sm"- >- <span class="hidden sm:inline"- >{{ livePhotoStats.staticPhotos }}- {{ $t('dashboard.photos.stats.photos') }}</span- >- <span class="sm:hidden">{{ livePhotoStats.staticPhotos }}P</span>- </UBadge>- <UBadge- v-if="livePhotoStats.livePhotos > 0"- variant="soft"- color="warning"- size="sm"- >- <span class="hidden sm:inline"- >{{ livePhotoStats.livePhotos }}- {{ $t('dashboard.photos.stats.livePhotos') }}</span- >- <span class="sm:hidden">{{ livePhotoStats.livePhotos }}LP</span>- </UBadge>- </div>- </div>-- <div class="flex items-center gap-2">- <UPopover>- <UTooltip :text="$t('ui.action.filter.tooltip')">- <UChip- inset- size="sm"color="info"- :show="totalSelectedFilters > 0"+ size="sm"+ icon="tabler:refresh"+ :loading="reactionsLoading"+ @click="+ async () => {+ await refresh()+ if (filteredData.length > 0) {+ await fetchReactions(filteredData.map((p: Photo) => p.id))+ }+ }+ ">- <UButton- variant="soft"- :color="hasActiveFilters ? 'info' : 'neutral'"- class="bg-transparent rounded-full cursor-pointer relative"- icon="tabler:filter"- size="sm"- />- </UChip>- </UTooltip>+ <span class="hidden sm:inline">{{+ $t('dashboard.photos.toolbar.refresh')+ }}</span>+ </UButton>- <template #content>- <UCard variant="glassmorphism">- <OverlayFilterPanel />- </UCard>- </template>- </UPopover>- <!-- 过滤器 -->- <USelectMenu- v-model="photoFilter"- class="w-full sm:w-48"- :items="[- {- label: $t('dashboard.photos.photoFilter.all'),- value: 'all',- icon: 'tabler:photo-scan',- },- {- label: $t('dashboard.photos.photoFilter.livephoto'),- value: 'livephoto',- icon: 'tabler:live-photo',- },- {- label: $t('dashboard.photos.photoFilter.static'),- value: 'static',- icon: 'tabler:photo',- },- ]"- value-key="value"- label-key="label"- size="sm"- >- </USelectMenu>-- <!-- 刷新按钮 -->- <UButton- variant="soft"- color="info"- size="sm"- icon="tabler:refresh"- :loading="reactionsLoading"- @click="- async () => {- await refresh()- if (filteredData.length > 0) {- await fetchReactions(filteredData.map((p: Photo) => p.id))- }- }- "- >- <span class="hidden sm:inline">{{- $t('dashboard.photos.toolbar.refresh')- }}</span>- </UButton>-- <!-- 列可见性按钮 -->- <UDropdownMenu- :items="- table?.tableApi- ?.getAllColumns()- .filter((column: any) => column.getCanHide())- .map((column: any) => ({- label: columnNameMap[column.id] || column.id,- type: 'checkbox' as const,- checked: column.getIsVisible(),- disabled:- !column.getCanHide() ||- column.id === 'thumbnailUrl' ||- column.id === 'id' ||- column.id === 'actions',- onUpdateChecked(checked: boolean) {- table?.tableApi- ?.getColumn(column.id)- ?.toggleVisibility(!!checked)- },- onSelect(e: Event) {- e.preventDefault()- },- }))- "- :content="{ align: 'end' }"- >- <UButton- label=""- color="neutral"- variant="outline"- size="sm"- icon="tabler:columns-3"- :title="$t('dashboard.photos.table.columnVisibility.description')"- >- <span class="hidden sm:inline">{{- $t('dashboard.photos.table.columnVisibility.button')- }}</span>- </UButton>- </UDropdownMenu>- </div>- </div>-- <!-- 照片列表 -->- <div- class="border border-neutral-300 dark:border-neutral-800 rounded overflow-hidden"- >- <UTable- ref="table"- v-model:row-selection="rowSelection"- v-model:column-visibility="columnVisibility"- :column-pinning="{- right: ['actions'],- }"- :data="filteredData as Photo[]"- :columns="columns"- :loading="status === 'pending'"- sticky- class="h-[calc(100vh-25rem)] sm:h-[calc(100vh-24.5rem)]"- :ui="{- separator: 'bg-neutral-200 dark:bg-neutral-700',- }"- >- <template #actions-cell="{ row }">- <div class="flex justify-end">+ <!-- 列可见性按钮 --><UDropdownMenu- size="sm"- :content="{- align: 'end',- }"- :items="getRowActions(row.original)"+ :items="+ table?.tableApi+ ?.getAllColumns()+ .filter((column: any) => column.getCanHide())+ .map((column: any) => ({+ label: columnNameMap[column.id] || column.id,+ type: 'checkbox' as const,+ checked: column.getIsVisible(),+ disabled:+ !column.getCanHide() ||+ column.id === 'thumbnailUrl' ||+ column.id === 'id' ||+ column.id === 'actions',+ onUpdateChecked(checked: boolean) {+ table?.tableApi+ ?.getColumn(column.id)+ ?.toggleVisibility(!!checked)+ },+ onSelect(e: Event) {+ e.preventDefault()+ },+ }))+ "+ :content="{ align: 'end' }"><UButton- variant="outline"+ label=""color="neutral"+ variant="outline"size="sm"- icon="tabler:dots-vertical"- />+ icon="tabler:columns-3"+ :title="+ $t('dashboard.photos.table.columnVisibility.description')+ "+ >+ <span class="hidden sm:inline">{{+ $t('dashboard.photos.table.columnVisibility.button')+ }}</span>+ </UButton></UDropdownMenu></div>- </template>- </UTable>+ </div>- <!-- 选择状态信息和批量操作 -->- <div- class="px-4 py-4 border-t border-neutral-200 dark:border-neutral-700"- >+ <!-- 照片列表 --><div- class="text-sm text-neutral-600 dark:text-neutral-400 flex items-center gap-2"+ class="border border-neutral-300 dark:border-neutral-800 rounded overflow-hidden">- <div class="leading-6">- {{- $t('dashboard.photos.selection.selected', {- count: selectedRowsCount,- total: totalRowsCount,- })- }}- </div>+ <UTable+ ref="table"+ v-model:row-selection="rowSelection"+ v-model:column-visibility="columnVisibility"+ :column-pinning="{+ right: ['actions'],+ }"+ :data="filteredData as Photo[]"+ :columns="columns"+ :loading="status === 'pending'"+ sticky+ class="h-[calc(100vh-27rem)] sm:h-[calc(100vh-24.5rem)]"+ :ui="{+ separator: 'bg-neutral-200 dark:bg-neutral-700',+ }"+ >+ <template #actions-cell="{ row }">+ <div class="flex justify-end">+ <UDropdownMenu+ size="sm"+ :content="{+ align: 'end',+ }"+ :items="getRowActions(row.original)"+ >+ <UButton+ variant="outline"+ color="neutral"+ size="sm"+ icon="tabler:dots-vertical"+ />+ </UDropdownMenu>+ </div>+ </template>+ </UTable>++ <!-- 选择状态信息和批量操作 --><div- v-if="selectedRowsCount > 0"- class="flex items-center gap-1 sm:gap-2"+ class="px-4 py-4 border-t border-neutral-200 dark:border-neutral-700">- <UButton- variant="soft"- color="info"- size="xs"- icon="tabler:refresh"- class="flex-1 sm:flex-none"- @click="handleBatchReprocess"+ <div+ class="text-sm text-neutral-600 dark:text-neutral-400 flex items-center gap-2">- <span>{{ $t('dashboard.photos.selection.batchReprocess') }}</span>- </UButton>+ <div class="leading-6">+ {{+ $t('dashboard.photos.selection.selected', {+ count: selectedRowsCount,+ total: totalRowsCount,+ })+ }}+ </div>+ <div+ v-if="selectedRowsCount > 0"+ class="flex items-center gap-1 sm:gap-2"+ >+ <UButton+ variant="soft"+ color="info"+ size="xs"+ icon="tabler:refresh"+ class="flex-1 sm:flex-none"+ @click="handleBatchReprocess"+ >+ <span>{{+ $t('dashboard.photos.selection.batchReprocess')+ }}</span>+ </UButton>- <UButton- variant="soft"- color="primary"- size="xs"- icon="tabler:download"- class="flex-1 sm:flex-none"- @click="handleBatchDownload"- >- <span>{{ $t('dashboard.photos.selection.batchDownload') }}</span>- </UButton>+ <UButton+ variant="soft"+ color="primary"+ size="xs"+ icon="tabler:download"+ class="flex-1 sm:flex-none"+ @click="handleBatchDownload"+ >+ <span>{{+ $t('dashboard.photos.selection.batchDownload')+ }}</span>+ </UButton>- <UButton- color="error"- variant="soft"- size="xs"- icon="tabler:trash"- class="flex-1 sm:flex-none"- @click="handleBatchDelete"- >- <span>{{ $t('dashboard.photos.selection.batchDelete') }}</span>- </UButton>+ <UButton+ color="error"+ variant="soft"+ size="xs"+ icon="tabler:trash"+ class="flex-1 sm:flex-none"+ @click="handleBatchDelete"+ >+ <span>{{+ $t('dashboard.photos.selection.batchDelete')+ }}</span>+ </UButton>+ </div>+ </div></div></div>- </div>- </div>-- <UModal v-model:open="isEditModalOpen">- <template #content>- <div class="p-6 space-y-6">- <div class="space-y-1">- <h2- class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"- >- {{ $t('dashboard.photos.editModal.title') }}- </h2>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.photos.editModal.description') }}- </p>- <p- v-if="editingPhoto"- class="text-xs text-neutral-500 dark:text-neutral-500"- >- {{ editingPhoto.title || editingPhoto.id }}- </p>- </div>- <UForm- :state="editFormState"- class="space-y-5"- @submit="handleEditSubmit"- >- <UFormField- :label="$t('dashboard.photos.editModal.fields.title')"- name="title"- >- <UInput- v-model="editFormState.title"- class="w-full"- />- </UFormField>-- <UFormField- :label="$t('dashboard.photos.editModal.fields.description')"- name="description"- >- <UTextarea- v-model="editFormState.description"- :rows="3"- class="w-full"- />- </UFormField>-- <div class="space-y-2">- <UFormField- :label="$t('dashboard.photos.editModal.fields.tags')"- name="tags"- >- <UInputTags- v-model="tagsModel"- class="w-full"- />- </UFormField>- <p class="text-xs text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.photos.editModal.fields.tagsHint') }}- </p>- </div>+ <UModal v-model:open="isEditModalOpen">+ <template #content>+ <div class="p-6 space-y-6">+ <div class="space-y-1">+ <h2+ class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"+ >+ {{ $t('dashboard.photos.editModal.title') }}+ </h2>+ <p class="text-sm text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.photos.editModal.description') }}+ </p>+ <p+ v-if="editingPhoto"+ class="text-xs text-neutral-500 dark:text-neutral-500"+ >+ {{ editingPhoto.title || editingPhoto.id }}+ </p>+ </div>- <div class="flex items-center justify-between space-y-2">- <label- class="text-sm font-medium text-neutral-700 dark:text-neutral-200"+ <UForm+ :state="editFormState"+ class="space-y-5"+ @submit="handleEditSubmit">- {{ $t('dashboard.photos.editModal.fields.rating') }}- </label>- <div class="flex items-center gap-3">- <span- v-if="editFormState.rating"- class="text-sm text-neutral-600 dark:text-neutral-400"+ <UFormField+ :label="$t('dashboard.photos.editModal.fields.title')"+ name="title">- {{ editFormState.rating }} / 5- </span>- <span- v-else- class="text-sm text-neutral-500 dark:text-neutral-500"+ <UInput+ v-model="editFormState.title"+ class="w-full"+ />+ </UFormField>++ <UFormField+ :label="$t('dashboard.photos.editModal.fields.description')"+ name="description">- {{ $t('dashboard.photos.editModal.fields.noRating') }}- </span>- <Rating- :model-value="editFormState.rating || 0"- :allow-half="false"- size="lg"- @update:model-value="editFormState.rating = $event || null"- />- </div>+ <UTextarea+ v-model="editFormState.description"+ :rows="3"+ class="w-full"+ />+ </UFormField>++ <div class="space-y-2">+ <UFormField+ :label="$t('dashboard.photos.editModal.fields.tags')"+ name="tags"+ >+ <UInputTags+ v-model="tagsModel"+ class="w-full"+ />+ </UFormField>+ <p class="text-xs text-neutral-500 dark:text-neutral-400">+ {{ $t('dashboard.photos.editModal.fields.tagsHint') }}+ </p>+ </div>++ <div class="flex items-center justify-between space-y-2">+ <label+ class="text-sm font-medium text-neutral-700 dark:text-neutral-200"+ >+ {{ $t('dashboard.photos.editModal.fields.rating') }}+ </label>+ <div class="flex items-center gap-3">+ <span+ v-if="editFormState.rating"+ class="text-sm text-neutral-600 dark:text-neutral-400"+ >+ {{ editFormState.rating }} / 5+ </span>+ <span+ v-else+ class="text-sm text-neutral-500 dark:text-neutral-500"+ >+ {{ $t('dashboard.photos.editModal.fields.noRating') }}+ </span>+ <Rating+ :model-value="editFormState.rating || 0"+ :allow-half="false"+ size="lg"+ @update:model-value="+ editFormState.rating = $event || null+ "+ />+ </div>+ </div>++ <div class="space-y-3">+ <div class="flex items-center justify-between">+ <label+ class="text-sm font-medium text-neutral-700 dark:text-neutral-200"+ >+ {{ $t('dashboard.photos.editModal.fields.location') }}+ </label>+ <UButton+ v-if="locationSelection"+ variant="ghost"+ color="neutral"+ size="xs"+ icon="tabler:map-off"+ @click.prevent="clearSelectedLocation"+ >+ {{+ $t('dashboard.photos.editModal.fields.clearLocation')+ }}+ </UButton>+ </div>++ <MapLocationPicker+ v-model="locationSelection"+ class="border border-neutral-200 dark:border-neutral-800"+ @pick="handleLocationPick"+ >+ <template #empty>+ <span+ class="px-3 py-2 rounded-full bg-white/80 text-neutral-600 dark:bg-neutral-900/80 dark:text-neutral-200 shadow"+ >+ {{+ $t('dashboard.photos.editModal.fields.locationHint')+ }}+ </span>+ </template>+ </MapLocationPicker>++ <div+ class="text-xs text-neutral-500 dark:text-neutral-400 flex items-center gap-2"+ >+ <span+ >{{+ $t('dashboard.photos.editModal.fields.coordinates')+ }}:</span+ >+ <span v-if="formattedCoordinates">+ {{ formattedCoordinates.latitude }},+ {{ formattedCoordinates.longitude }}+ </span>+ <span v-else>+ {{ $t('dashboard.photos.editModal.fields.noLocation') }}+ </span>+ </div>+ </div>++ <div+ class="flex items-center justify-end gap-2 pt-4 border-t border-neutral-200 dark:border-neutral-800"+ >+ <UButton+ variant="ghost"+ color="neutral"+ @click.prevent="isEditModalOpen = false"+ >+ {{ $t('dashboard.photos.editModal.actions.cancel') }}+ </UButton>+ <UButton+ type="submit"+ :loading="isSavingMetadata"+ :disabled="!isMetadataDirty || isSavingMetadata"+ icon="tabler:device-floppy"+ >+ {{ $t('dashboard.photos.editModal.actions.save') }}+ </UButton>+ </div>+ </UForm></div>+ </template>+ </UModal>- <div class="space-y-3">- <div class="flex items-center justify-between">- <label- class="text-sm font-medium text-neutral-700 dark:text-neutral-200"- >- {{ $t('dashboard.photos.editModal.fields.location') }}- </label>+ <UModal v-model:open="isDeleteConfirmOpen">+ <template #content>+ <div class="p-6 space-y-4">+ <div class="flex items-start gap-3">+ <Icon+ name="tabler:trash"+ class="mt-1 size-6 shrink-0 text-error-500"+ />+ <div class="space-y-2">+ <h3 class="text-lg font-semibold">+ {{+ deleteMode === 'single'+ ? $t('dashboard.photos.delete.single.title')+ : $t('dashboard.photos.delete.batch.title')+ }}+ </h3>+ <p class="text-sm text-neutral-600 dark:text-neutral-400">+ {{+ deleteMode === 'single'+ ? $t('dashboard.photos.delete.single.message')+ : $t('dashboard.photos.delete.batch.message', {+ count: deleteTargetPhotos.length,+ })+ }}+ </p>+ <p class="text-sm text-error-500 dark:text-error-400">+ {{ $t('dashboard.photos.delete.warning') }}+ </p>+ </div>+ </div>+ <div class="flex justify-end gap-2"><UButton- v-if="locationSelection"variant="ghost"color="neutral"- size="xs"- icon="tabler:map-off"- @click.prevent="clearSelectedLocation"+ :disabled="isDeleting"+ @click="isDeleteConfirmOpen = false">- {{ $t('dashboard.photos.editModal.fields.clearLocation') }}+ {{ $t('dashboard.photos.delete.buttons.cancel') }}</UButton>- </div>-- <MapLocationPicker- v-model="locationSelection"- class="border border-neutral-200 dark:border-neutral-800"- @pick="handleLocationPick"- >- <template #empty>- <span- class="px-3 py-2 rounded-full bg-white/80 text-neutral-600 dark:bg-neutral-900/80 dark:text-neutral-200 shadow"- >- {{ $t('dashboard.photos.editModal.fields.locationHint') }}- </span>- </template>- </MapLocationPicker>-- <div- class="text-xs text-neutral-500 dark:text-neutral-400 flex items-center gap-2"- >- <span- >{{- $t('dashboard.photos.editModal.fields.coordinates')- }}:</span+ <UButton+ color="error"+ icon="tabler:trash"+ :loading="isDeleting"+ @click="confirmDelete">- <span v-if="formattedCoordinates">- {{ formattedCoordinates.latitude }},- {{ formattedCoordinates.longitude }}- </span>- <span v-else>- {{ $t('dashboard.photos.editModal.fields.noLocation') }}- </span>+ {{ $t('dashboard.photos.delete.buttons.confirm') }}+ </UButton></div></div>+ </template>+ </UModal>+ <!-- 图片预览模态框 -->+ <UModal+ v-model:open="isImagePreviewOpen"+ title="Photo Preview"+ :description="previewingPhoto?.description || ''"+ >+ <template #body><div- class="flex items-center justify-end gap-2 pt-4 border-t border-neutral-200 dark:border-neutral-800"+ class="flex items-center justify-center w-full"+ style="max-height: calc(100vh - 12rem)">- <UButton- variant="ghost"- color="neutral"- @click.prevent="isEditModalOpen = false"- >- {{ $t('dashboard.photos.editModal.actions.cancel') }}- </UButton>- <UButton- type="submit"- :loading="isSavingMetadata"- :disabled="!isMetadataDirty || isSavingMetadata"- icon="tabler:device-floppy"- >- {{ $t('dashboard.photos.editModal.actions.save') }}- </UButton>- </div>- </UForm>- </div>- </template>- </UModal>-- <UModal v-model:open="isDeleteConfirmOpen">- <template #content>- <div class="p-6 space-y-4">- <div class="flex items-start gap-3">- <Icon- name="tabler:trash"- class="mt-1 size-6 shrink-0 text-error-500"- />- <div class="space-y-2">- <h3 class="text-lg font-semibold">- {{- deleteMode === 'single'- ? $t('dashboard.photos.delete.single.title')- : $t('dashboard.photos.delete.batch.title')- }}- </h3>- <p class="text-sm text-neutral-600 dark:text-neutral-400">- {{- deleteMode === 'single'- ? $t('dashboard.photos.delete.single.message')- : $t('dashboard.photos.delete.batch.message', {- count: deleteTargetPhotos.length,- })- }}- </p>- <p class="text-sm text-error-500 dark:text-error-400">- {{ $t('dashboard.photos.delete.warning') }}- </p>+ <div class="w-full max-w-2xl rounded-lg overflow-hidden">+ <MasonryItemPhoto+ v-if="previewingPhoto"+ :photo="previewingPhoto"+ :index="0"+ @visibility-change="() => {}"+ @open-viewer="openInNewTab(`/${previewingPhoto.id}`)"+ />+ </div></div>- </div>- <div class="flex justify-end gap-2">- <UButton- variant="ghost"- color="neutral"- :disabled="isDeleting"- @click="isDeleteConfirmOpen = false"- >- {{ $t('dashboard.photos.delete.buttons.cancel') }}- </UButton>- <UButton- color="error"- icon="tabler:trash"- :loading="isDeleting"- @click="confirmDelete"- >- {{ $t('dashboard.photos.delete.buttons.confirm') }}- </UButton>- </div>- </div>- </template>- </UModal>-- <!-- 图片预览模态框 -->- <UModal- v-model:open="isImagePreviewOpen"- title="Photo Preview"- :description="previewingPhoto?.description || ''"- >- <template #body>- <div- class="flex items-center justify-center w-full"- style="max-height: calc(100vh - 12rem)"- >- <div class="w-full max-w-2xl rounded-lg overflow-hidden">- <MasonryItemPhoto- v-if="previewingPhoto"- :photo="previewingPhoto"- :index="0"- @visibility-change="() => {}"- @open-viewer="openInNewTab(`/${previewingPhoto.id}`)"- />- </div>- </div>- </template>- </UModal>- </div>+ </template>+ </UModal>+ </div>+ </template>+ </UDashboardPanel></template><style scoped></style>diff --git a/app/pages/dashboard/queue.vue b/app/pages/dashboard/queue.vueindex f4cdbbb8..465a1374 100644--- a/app/pages/dashboard/queue.vue+++ b/app/pages/dashboard/queue.vue@@ -211,17 +211,21 @@ const expanded = ref<Record<string, boolean>>({})const columns: TableColumn<any>[] = [{id: 'expand',- cell: ({ row }) => h(UButton, {- 'color': 'neutral',- 'variant': 'ghost',- 'icon': 'tabler:chevron-down',- 'square': true,- 'aria-label': 'Expand',- 'ui': {- leadingIcon: ['transition-transform', row.getIsExpanded() ? 'duration-200 rotate-180' : '']- },- 'onClick': () => row.toggleExpanded()- }),+ cell: ({ row }) =>+ h(UButton, {+ color: 'neutral',+ variant: 'ghost',+ icon: 'tabler:chevron-down',+ square: true,+ 'aria-label': 'Expand',+ ui: {+ leadingIcon: [+ 'transition-transform',+ row.getIsExpanded() ? 'duration-200 rotate-180' : '',+ ],+ },+ onClick: () => row.toggleExpanded(),+ }),enableSorting: false,enableHiding: false,},@@ -268,239 +272,271 @@ onBeforeUnmount(() => {</script><template>- <div class="flex flex-col gap-6 h-full p-4">- <!-- 页面标题和操作 -->- <div class="flex items-center justify-between">- <h1 class="text-2xl font-bold">- {{ $t('dashboard.queue.title') }}- </h1>- <div class="flex items-center gap-2">- <UButton- icon="tabler:refresh"- variant="soft"- :loading="isLoading"- @click="refreshData"- >- {{ $t('dashboard.queue.actions.refresh') }}- </UButton>- <UButton- icon="tabler:refresh"- color="warning"- variant="soft"- :loading="isLoading"- @click="retryAllFailedTasks"- >- {{ $t('dashboard.queue.actions.retryAll') }}- </UButton>- <UButton- icon="tabler:trash"- color="error"- variant="soft"- :loading="isLoading"- @click="clearNonActiveTasks"- >- {{ $t('dashboard.queue.actions.clearNonActive') }}- </UButton>- </div>- </div>-- <!-- 状态指示器 -->- <div class="grid grid-cols-2 lg:grid-cols-4 gap-4">- <DashboardIndicator- :title="$t('dashboard.queue.indicator.pending')"- icon="tabler:clock"- color="orange"- :value="queueStats.pending"- />- <DashboardIndicator- :title="$t('dashboard.queue.indicator.processing')"- icon="tabler:loader"- color="blue"- :value="queueStats.processing"- />- <DashboardIndicator- :title="$t('dashboard.queue.indicator.completed')"- icon="tabler:check"- color="green"- :value="queueStats.completed"- />- <DashboardIndicator- :title="$t('dashboard.queue.indicator.failed')"- icon="tabler:alert-triangle"- color="red"- :value="queueStats.failed"- />- </div>-- <!-- 筛选器和表格 -->- <UCard>- <template #header>- <div class="flex items-center justify-between pb-2">- <h2 class="text-lg font-semibold">队列任务列表</h2>- <div class="flex items-center gap-2">- <USelectMenu- v-model="statusFilter"- :items="statusOptions"- value-key="value"- size="sm"- variant="soft"- class="w-32"- :search-input="false"- />- <USelectMenu- v-model="typeFilter"- :items="typeOptions"- value-key="value"- size="sm"- variant="soft"- class="w-32"- :search-input="false"- />- </div>+ <UDashboardPanel>+ <template #header>+ <UDashboardNavbar :title="$t('dashboard.queue.title')">+ <template #right>+ <UButton+ icon="tabler:refresh"+ variant="soft"+ :loading="isLoading"+ @click="refreshData"+ >+ {{ $t('dashboard.queue.actions.refresh') }}+ </UButton>+ <UButton+ icon="tabler:refresh"+ color="warning"+ variant="soft"+ :loading="isLoading"+ @click="retryAllFailedTasks"+ >+ {{ $t('dashboard.queue.actions.retryAll') }}+ </UButton>+ <UButton+ icon="tabler:trash"+ color="error"+ variant="soft"+ :loading="isLoading"+ @click="clearNonActiveTasks"+ >+ {{ $t('dashboard.queue.actions.clearNonActive') }}+ </UButton>+ </template>+ </UDashboardNavbar>+ </template>++ <template #body>+ <div class="flex flex-col gap-6">+ <!-- 状态指示器 -->+ <div class="grid grid-cols-2 lg:grid-cols-4 gap-4">+ <DashboardIndicator+ :title="$t('dashboard.queue.indicator.pending')"+ icon="tabler:clock"+ color="orange"+ :value="queueStats.pending"+ />+ <DashboardIndicator+ :title="$t('dashboard.queue.indicator.processing')"+ icon="tabler:loader"+ color="blue"+ :value="queueStats.processing"+ />+ <DashboardIndicator+ :title="$t('dashboard.queue.indicator.completed')"+ icon="tabler:check"+ color="green"+ :value="queueStats.completed"+ />+ <DashboardIndicator+ :title="$t('dashboard.queue.indicator.failed')"+ icon="tabler:alert-triangle"+ color="red"+ :value="queueStats.failed"+ /></div>- </template>-- <div class="space-y-4">- <!-- 任务表格 -->- <UTable- v-model:expanded="expanded"- :data="queueData?.data || []"- :columns="columns"- :loading="isLoading"- :empty-state="{- icon: 'tabler:inbox',- label: $t('dashboard.queue.messages.noTasks'),- }"- class="w-full"- >- <!-- 任务类型 -->- <template #type-cell="{ row }">- <UBadge- :label="$t(`dashboard.queue.types.${row.original.payload.type}`)"- variant="soft"- :color="- row.original.payload.type === 'photo' ? 'info' : 'secondary'- "- size="sm"- />- </template>-- <!-- 状态 -->- <template #status-cell="{ row }">- <UBadge- :label="$t(`dashboard.queue.status.${row.original.status}`)"- variant="soft"- :color="getStatusColor(row.original.status)"- size="sm"- />- </template>-- <!-- 尝试次数 -->- <template #attempts-cell="{ row }">- <span class="text-sm">- {{ row.original.attempts }}/{{ row.original.maxAttempts }}- </span>- </template>-- <!-- 处理阶段 -->- <template #statusStage-cell="{ row }">- <span- v-if="row.original.statusStage"- class="text-xs text-gray-500"- >- {{ $t(`dashboard.queue.stages.${row.original.statusStage}`) }}- </span>- <span- v-else- class="text-xs text-gray-400"- >-</span- >- </template>-- <!-- 创建时间 -->- <template #createdAt-cell="{ row }">- <span class="text-sm">{{- $dayjs(row.original.createdAt).format('MM-DD HH:mm:ss')- }}</span>- </template>- <!-- 操作按钮 -->- <template #actions-cell="{ row }">- <div class="flex items-center gap-1">- <UButton- v-if="row.original.status === 'failed'"- icon="tabler:refresh"- size="xs"- variant="soft"- color="warning"- @click="retryTask(row.original.id)"- >- {{ $t('dashboard.queue.buttons.retry') }}- </UButton>- <UButton- v-if="row.original.status !== 'in-stage'"- icon="tabler:trash"- size="xs"- variant="soft"- color="error"- @click="deleteTask(row.original.id)"- >- {{ $t('dashboard.queue.buttons.delete') }}- </UButton>- <span- v-if="- row.original.status === 'pending' ||- row.original.status === 'in-stages'- "- class="text-xs text-gray-400"- >- -- </span>+ <!-- 筛选器和表格 -->+ <UCard>+ <template #header>+ <div class="flex items-center justify-between pb-2">+ <h2 class="text-lg font-semibold">队列任务列表</h2>+ <div class="flex items-center gap-2">+ <USelectMenu+ v-model="statusFilter"+ :items="statusOptions"+ value-key="value"+ size="sm"+ variant="soft"+ class="w-32"+ :search-input="false"+ />+ <USelectMenu+ v-model="typeFilter"+ :items="typeOptions"+ value-key="value"+ size="sm"+ variant="soft"+ class="w-32"+ :search-input="false"+ />+ </div></div></template>- <!-- 展开行内容 -->- <template #expanded="{ row }">- <div class="px-2">- <div class="space-y-3">- <!-- 任务ID和类型 -->- <div class="flex gap-4">- <div>- <p class="text-xs text-neutral-500">PhotoId</p>- <p class="text-sm capitalize">{{ row.original.payload.photoId || '-' }}</p>- </div>- <div>- <p class="text-xs text-neutral-500">{{ $t('dashboard.queue.table.id') }}</p>- <p class="font-mono text-sm">{{ row.original.id }}</p>- </div>- <div>- <p class="text-xs text-neutral-500">{{ $t('dashboard.queue.table.type') }}</p>- <p class="text-sm capitalize">{{ row.original.payload.type }}</p>- </div>+ <div class="space-y-4">+ <!-- 任务表格 -->+ <UTable+ v-model:expanded="expanded"+ :data="queueData?.data || []"+ :columns="columns"+ :loading="isLoading"+ :empty-state="{+ icon: 'tabler:inbox',+ label: $t('dashboard.queue.messages.noTasks'),+ }"+ class="w-full"+ >+ <!-- 任务类型 -->+ <template #type-cell="{ row }">+ <UBadge+ :label="+ $t(`dashboard.queue.types.${row.original.payload.type}`)+ "+ variant="soft"+ :color="+ row.original.payload.type === 'photo' ? 'info' : 'secondary'+ "+ size="sm"+ />+ </template>++ <!-- 状态 -->+ <template #status-cell="{ row }">+ <UBadge+ :label="$t(`dashboard.queue.status.${row.original.status}`)"+ variant="soft"+ :color="getStatusColor(row.original.status)"+ size="sm"+ />+ </template>++ <!-- 尝试次数 -->+ <template #attempts-cell="{ row }">+ <span class="text-sm">+ {{ row.original.attempts }}/{{ row.original.maxAttempts }}+ </span>+ </template>++ <!-- 处理阶段 -->+ <template #statusStage-cell="{ row }">+ <span+ v-if="row.original.statusStage"+ class="text-xs text-gray-500"+ >+ {{ $t(`dashboard.queue.stages.${row.original.statusStage}`) }}+ </span>+ <span+ v-else+ class="text-xs text-gray-400"+ >-</span+ >+ </template>++ <!-- 创建时间 -->+ <template #createdAt-cell="{ row }">+ <span class="text-sm">{{+ $dayjs(row.original.createdAt).format('MM-DD HH:mm:ss')+ }}</span>+ </template>++ <!-- 操作按钮 -->+ <template #actions-cell="{ row }">+ <div class="flex items-center gap-1">+ <UButton+ v-if="row.original.status === 'failed'"+ icon="tabler:refresh"+ size="xs"+ variant="soft"+ color="warning"+ @click="retryTask(row.original.id)"+ >+ {{ $t('dashboard.queue.buttons.retry') }}+ </UButton>+ <UButton+ v-if="row.original.status !== 'in-stage'"+ icon="tabler:trash"+ size="xs"+ variant="soft"+ color="error"+ @click="deleteTask(row.original.id)"+ >+ {{ $t('dashboard.queue.buttons.delete') }}+ </UButton>+ <span+ v-if="+ row.original.status === 'pending' ||+ row.original.status === 'in-stages'+ "+ class="text-xs text-gray-400"+ >+ -+ </span></div>-- <!-- 错误信息(仅在失败状态显示) -->- <div v-if="row.original.status === 'failed' && row.original.errorMessage" class="mt-3">- <p class="text-xs text-neutral-500 mb-1">{{ $t('dashboard.queue.table.errorMessage') }}</p>- <div class="p-3 bg-red-50 dark:bg-red-950/20 rounded border border-red-100 dark:border-red-900/30">- <p class="text-sm text-red-700 dark:text-red-300 break-words font-mono">- {{ row.original.errorMessage }}- </p>+ </template>++ <!-- 展开行内容 -->+ <template #expanded="{ row }">+ <div class="px-2">+ <div class="space-y-3">+ <!-- 任务ID和类型 -->+ <div class="flex gap-4">+ <div>+ <p class="text-xs text-neutral-500">PhotoId</p>+ <p class="text-sm capitalize">+ {{ row.original.payload.photoId || '-' }}+ </p>+ </div>+ <div>+ <p class="text-xs text-neutral-500">+ {{ $t('dashboard.queue.table.id') }}+ </p>+ <p class="font-mono text-sm">{{ row.original.id }}</p>+ </div>+ <div>+ <p class="text-xs text-neutral-500">+ {{ $t('dashboard.queue.table.type') }}+ </p>+ <p class="text-sm capitalize">+ {{ row.original.payload.type }}+ </p>+ </div>+ </div>++ <!-- 错误信息(仅在失败状态显示) -->+ <div+ v-if="+ row.original.status === 'failed' &&+ row.original.errorMessage+ "+ class="mt-3"+ >+ <p class="text-xs text-neutral-500 mb-1">+ {{ $t('dashboard.queue.table.errorMessage') }}+ </p>+ <div+ class="p-3 bg-red-50 dark:bg-red-950/20 rounded border border-red-100 dark:border-red-900/30"+ >+ <p+ class="text-sm text-red-700 dark:text-red-300 wrap-break-word font-mono"+ >+ {{ row.original.errorMessage }}+ </p>+ </div>+ </div>++ <!-- Payload 信息 -->+ <div+ v-if="row.original.payload"+ class="mt-3"+ >+ <p class="text-xs text-gray-500 mb-1">Payload</p>+ <pre+ class="text-xs bg-neutral-100/50 dark:bg-neutral-800/50 p-2 rounded overflow-x-auto text-neutral-700 dark:text-neutral-300"+ >{{+ JSON.stringify(row.original.payload, null, 2)+ }}</pre+ >+ </div></div></div>-- <!-- Payload 信息 -->- <div v-if="row.original.payload" class="mt-3">- <p class="text-xs text-gray-500 mb-1">Payload</p>- <pre class="text-xs bg-neutral-100/50 dark:bg-neutral-800/50 p-2 rounded overflow-x-auto text-neutral-700 dark:text-neutral-300">{{ JSON.stringify(row.original.payload, null, 2) }}</pre>- </div>- </div>- </div>- </template>- </UTable>+ </template>+ </UTable>+ </div>+ </UCard></div>- </UCard>- </div>+ </template>+ </UDashboardPanel></template><style scoped>diff --git a/i18n/locales/en.json b/i18n/locales/en.jsonindex e4c35c2c..7a0a5121 100644--- a/i18n/locales/en.json+++ b/i18n/locales/en.json@@ -359,7 +359,8 @@"globe": "Photo Globe","queue": "Queue Management","logs": "System Logs",- "albums": "Albums"+ "albums": "Albums",+ "siteAdministration": "Site settings"},"auth": {"form": {diff --git a/i18n/locales/ja.json b/i18n/locales/ja.jsonindex b2348f35..0fc35f60 100644--- a/i18n/locales/ja.json+++ b/i18n/locales/ja.json@@ -358,7 +358,8 @@"globe": "写真グローブ","queue": "キュー管理","logs": "システムログ",- "albums": "アルバム"+ "albums": "アルバム",+ "siteAdministration": "サイト設定"},"auth": {"form": {diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.jsonindex f7f10c39..a158bb6f 100644--- a/i18n/locales/zh-Hans.json+++ b/i18n/locales/zh-Hans.json@@ -359,7 +359,8 @@"globe": "照片地球仪","queue": "队列管理","logs": "系统日志",- "albums": "相簿"+ "albums": "相簿",+ "siteAdministration": "站点设置"},"auth": {"form": {diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.jsonindex 070f46b6..8c6dad2b 100644--- a/i18n/locales/zh-Hant-HK.json+++ b/i18n/locales/zh-Hant-HK.json@@ -358,7 +358,8 @@"globe": "照片地球儀","queue": "佇列管理","logs": "系統日誌",- "albums": "相簿"+ "albums": "相簿",+ "siteAdministration": "站點設置"},"auth": {"form": {diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.jsonindex 5eab7a49..7c5680c0 100644--- a/i18n/locales/zh-Hant-TW.json+++ b/i18n/locales/zh-Hant-TW.json@@ -358,7 +358,8 @@"globe": "照片地球儀","queue": "佇列管理","logs": "系統日誌",- "albums": "相簿"+ "albums": "相簿",+ "siteAdministration": "站點設置"},"auth": {"form": {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 37d6e8b3..e2b1bcef 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -5729,12 +5729,6 @@ packages:'@vueuse/core': '>=10.0.0'vue: '>=3.0.0'- resolution: {integrity: sha512-YNDUAsany04wfI7YtHxQK3kxzNvh+OdFUk9GpA3+hMt7j6P+5WrVAAgr8kmPPoVza9EsJiAVhqoN3YYFN0Twrw==}- peerDependencies:- '@vueuse/core': '>=10.0.0'- vue: '>=3.0.0'-resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}engines: {node: '>=10'}@@ -13941,18 +13935,6 @@ snapshots:- [email protected](@vueuse/[email protected]([email protected]([email protected])))([email protected]([email protected])):- dependencies:- '@vueuse/core': 13.9.0([email protected]([email protected]))- framer-motion: 12.23.12- hey-listen: 1.0.8- motion-dom: 12.23.12- vue: 3.5.22([email protected])- transitivePeerDependencies:- - '@emotion/is-prop-valid'- - react- - react-dom-[email protected](@vueuse/[email protected]([email protected]([email protected])))([email protected]([email protected])):dependencies:'@vueuse/core': 13.9.0([email protected]([email protected]))