✨ feat: 重构管理后台并增强组件系统与回收站功能

* 新增自适应数值与窗口分析工具,提升交互体验
* 优化回收站模块逻辑,增加展示与选择功能
* 引入 Macaron 主题配置文件并更新 Tailwind 配置
* 精简基础组件代码,移除冗余样式与设置项
* 完善测试用例,覆盖 UI 系统与回收站工作流
* 更新多语言配置,支持功能变更后的文案需求
This commit is contained in:
orion committed 2026-09-18 10:18:07 +08:00
1 parent 614b9a2104
commit 9b22534e2b
61 files changed
+1624 -832

No files matched your search

+44 -47
View File
@@ -21,15 +21,13 @@
class="theme-2026-card theme-2026-card-hover group rounded-[24px] border p-3.5 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-4"
:class="[panelClass, cardHoverClass]"
>
<div class="flex items-start justify-between gap-3">
<div>
<p class="text-xs sm:text-sm" :class="[mutedTextClass]">{{ card.label }}</p>
<p class="mt-1.5 break-words text-xl font-semibold leading-tight tabular-nums sm:mt-2 sm:text-2xl" :title="String(card.value)" :class="[primaryTextClass]">
{{ card.value }}
</p>
<div class="relative">
<div class="min-w-0">
<p class="pr-8 text-xs sm:text-sm" :class="[mutedTextClass]">{{ card.label }}</p>
<AdaptiveValue :value="card.value" class="mt-3 font-semibold leading-tight sm:mt-3" :class="primaryTextClass" />
</div>
<div
class="rounded-lg p-2 transition-transform duration-200 group-max-sm:p-1.5"
class="absolute right-0 top-0 rounded-lg p-1.5 transition-transform duration-200"
:class="[card.iconClass]"
>
<component :is="card.icon" class="h-5 w-5" />
@@ -40,7 +38,7 @@
<section
v-if="!hasSelectedFiles"
class="theme-2026-card theme-2026-card-hover mb-4 rounded-[24px] border p-3 shadow-md transition-all duration-200 hover:shadow-lg sm:mb-6 sm:rounded-[30px] sm:p-4"
class="theme-2026-card mb-4 rounded-[24px] border p-3 shadow-md transition-all duration-200 hover:shadow-lg sm:mb-6 sm:rounded-[30px] sm:p-4"
:class="[panelClass, cardHoverClass]"
>
<div class="flex items-center justify-between gap-3 sm:flex-row">
@@ -272,7 +270,7 @@
</div>
<button
type="button"
class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border"
class="fcb-action fcb-icon-action flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border"
:class="detailActionClass"
:disabled="isLoading"
:aria-label="t('fileManage.refresh')"
@@ -285,7 +283,7 @@
<div
v-if="tableData.length > 0"
class="flex min-h-14 items-center justify-between gap-3 border-b px-4 py-2 md:hidden"
:class="[isDarkMode ? 'border-gray-700 bg-[#20323a]/70' : 'border-[#d9e4e6] bg-[#f4f8f8]']"
:class="[isDarkMode ? 'border-gray-700 bg-[#2c3440]/70' : 'border-[#d9e4e6] bg-[#f4f8f8]']"
>
<label class="flex min-h-11 min-w-0 cursor-pointer items-center gap-3 text-sm font-medium" :class="[primaryTextClass]">
<span class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl">
@@ -305,7 +303,7 @@
<button
v-if="hasSelectedFiles"
type="button"
class="min-h-11 shrink-0 rounded-xl px-3 text-sm font-medium"
class="fcb-action min-h-11 shrink-0 rounded-xl px-3 text-sm font-medium"
:class="detailActionClass"
:disabled="isBatchActionRunning"
@click="clearSelection"
@@ -333,7 +331,7 @@
v-for="file in tableData"
:key="file.id"
class="px-4 py-4"
:class="selectedFileIds.has(file.id) ? (isDarkMode ? 'bg-[#294047]/50' : 'bg-[#e5eeee]') : ''"
:class="selectedFileIds.has(file.id) ? (isDarkMode ? 'bg-[#333d49]/50' : 'bg-[#e5eeee]') : ''"
>
<div class="flex items-start gap-3">
<label class="flex h-11 w-11 shrink-0 cursor-pointer items-start justify-center pt-1">
@@ -346,7 +344,7 @@
@change="toggleFileSelection(file.id)"
/>
</label>
<button type="button" class="min-w-0 flex-1 text-left" @click="openFileDetail(file)">
<button type="button" class="fcb-action fcb-content-action min-w-0 flex-1 text-left" @click="openFileDetail(file)">
<p class="line-clamp-2 break-all text-sm font-semibold leading-5" :class="[primaryTextClass]">
{{ file.displayName }}
</p>
@@ -388,7 +386,7 @@
<aside
v-if="hasSelectedFiles"
class="pointer-events-auto fixed inset-x-0 bottom-0 z-[60] border-t px-3 pt-3 shadow-2xl backdrop-blur-xl md:hidden"
:class="isDarkMode ? 'border-[#40545c] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
:class="isDarkMode ? 'border-[#495765] bg-[#252b34]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
:style="{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))', touchAction: 'manipulation' }"
:aria-label="t('fileManage.mobileBatchActions')"
>
@@ -396,13 +394,13 @@
<div
v-if="showMobilePolicyActions"
class="grid grid-cols-2 gap-2 rounded-2xl border p-2"
:class="isDarkMode ? 'border-[#40545c] bg-[#20323a]' : 'border-[#c8d7da] bg-white'"
:class="isDarkMode ? 'border-[#495765] bg-[#2c3440]' : 'border-[#c8d7da] bg-white'"
>
<button
v-for="option in batchPolicyActionOptions"
:key="option.action"
type="button"
class="min-h-11 rounded-xl border px-2 py-2 text-xs font-medium"
class="fcb-action min-h-11 rounded-xl border px-2 py-2 text-xs font-medium"
:class="detailActionClass"
:title="option.description"
:disabled="option.disabled || isBatchDeleting || isBatchUpdating || isBatchPolicyActionRunning"
@@ -418,7 +416,7 @@
</p>
<button
type="button"
class="min-h-11 rounded-xl px-3 text-sm font-medium"
class="fcb-action min-h-11 rounded-xl px-3 text-sm font-medium"
:class="detailActionClass"
:disabled="isBatchActionRunning"
@click="clearSelection"
@@ -430,7 +428,7 @@
<div class="grid grid-cols-3 gap-2">
<button
type="button"
class="flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
class="fcb-action flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
:class="detailActionClass"
:disabled="isBatchDeleting || isBatchPolicyActionRunning"
@click="openBatchEditModal"
@@ -440,7 +438,7 @@
</button>
<button
type="button"
class="flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
class="fcb-action flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
:class="detailActionClass"
:aria-expanded="showMobilePolicyActions"
:disabled="isBatchDeleting || isBatchUpdating"
@@ -451,7 +449,7 @@
</button>
<button
type="button"
class="flex min-h-12 items-center justify-center rounded-xl bg-red-600 px-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
class="fcb-action flex min-h-12 items-center justify-center rounded-xl bg-red-600 px-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
:disabled="isBatchUpdating || isBatchPolicyActionRunning || isBatchDeleting"
@click="deleteSelectedFilesAndRefreshHistory"
>
@@ -701,10 +699,10 @@
<button
type="button"
:title="t('fileManage.detail')"
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
:class="[
isDarkMode
? 'bg-[#294047]/70 text-[#b8d4dc] hover:bg-[#34515a]'
? 'bg-[#333d49]/70 text-[#b8d4dc] hover:bg-[#34515a]'
: 'bg-[#dcebed] text-[#3f6a77] hover:bg-[#cfe1e4]'
]"
@click="openFileDetail(file)"
@@ -716,10 +714,10 @@
v-if="file.canPreviewText"
type="button"
:title="t('fileManage.viewText')"
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
:class="[
isDarkMode
? 'bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]'
? 'bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]'
: 'bg-[#edf4f5] text-[#506972] hover:bg-[#e2ecee]'
]"
@click="openTextPreview(file)"
@@ -733,7 +731,7 @@
file.isTextFile ? t('fileManage.exportText') : t('fileManage.downloadFile')
"
:disabled="Boolean(downloadingFileId)"
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
:class="[
isDarkMode
? 'bg-[#31564f]/70 text-[#c4dfd5] hover:bg-[#3c675e]'
@@ -750,7 +748,7 @@
</button>
<button
type="button"
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
:class="[
isDarkMode
? 'bg-[#2d4851]/70 text-[#bfd9df] hover:bg-[#365862]'
@@ -763,11 +761,9 @@
</button>
<button
type="button"
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
:class="[
isDarkMode
? 'bg-[#dc2626] text-white shadow-[#7f1d1d]/35 hover:bg-[#b91c1c]'
: 'bg-[#dc2626] text-white shadow-[#f87171]/35 hover:bg-[#b91c1c]'
'fcb-button-danger'
]"
@click="deleteFileAndRefreshHistory(file.id)"
>
@@ -793,7 +789,7 @@
</div>
<section
class="theme-2026-card theme-2026-card-hover mt-6 rounded-[30px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg"
class="theme-2026-card mt-6 rounded-[30px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg"
:class="[panelClass, cardHoverClass]"
>
<div class="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
@@ -801,7 +797,7 @@
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">历史文件</h3>
<p class="text-sm" :class="[mutedTextClass]">包含已删除、已过期和现存文件的下载统计</p>
</div>
<BaseButton class="fcb-refresh-button fcb-secondary-card" variant="secondary" :loading="isHistoryLoading" @click="loadHistoryFiles">
<BaseButton class="fcb-refresh-button" variant="secondary" :loading="isHistoryLoading" @click="loadHistoryFiles">
<template #icon>
<RefreshCwIcon class="mr-2 h-4 w-4" />
</template>
@@ -1045,7 +1041,7 @@
<div class="grid grid-cols-2 gap-2.5 xl:grid-cols-4">
<button
type="button"
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
:class="detailActionClass"
@click="openDetailEditModal"
>
@@ -1055,7 +1051,7 @@
<button
v-if="selectedFileDetail.canPreviewText"
type="button"
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors"
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors"
:class="detailActionClass"
@click="openDetailTextPreview"
>
@@ -1064,7 +1060,7 @@
</button>
<button
type="button"
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
:class="detailActionClass"
:disabled="!selectedFileDetail.canDownloadFile || Boolean(downloadingFileId)"
@click="downloadFile(selectedFileDetail)"
@@ -1082,7 +1078,7 @@
</button>
<button
type="button"
class="flex min-h-11 items-center justify-center rounded-lg bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-red-700"
class="fcb-action flex min-h-11 items-center justify-center rounded-lg bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-red-700"
@click="deleteDetailFileAndRefreshHistory"
>
<TrashIcon class="mr-2 h-4 w-4" aria-hidden="true" />
@@ -1091,7 +1087,7 @@
</div>
<section
class="theme-2026-card-hover rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
class="theme-2026-card rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
:class="getInsightPanelClass(selectedFileDetail.statusInsightSeverity)"
>
<div class="flex flex-col gap-2.5 md:flex-row md:items-start md:justify-between">
@@ -1206,7 +1202,7 @@
<button
v-if="detailTimelineRows.length > 3"
type="button"
class="inline-flex min-h-10 items-center self-start rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors sm:min-h-0 sm:self-auto"
class="fcb-action inline-flex min-h-10 items-center self-start rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors sm:min-h-0 sm:self-auto"
:class="detailActionClass"
@click="isLifecycleExpanded = !isLifecycleExpanded"
>
@@ -1265,7 +1261,7 @@
<div v-if="item.key === 'retrieved' && retrievalTimelineCount > 0" class="mt-2.5 border-t pt-2.5" :class="isDarkMode ? 'border-gray-700' : 'border-gray-200'">
<button
type="button"
class="inline-flex min-h-9 items-center rounded-[30px] border px-3 py-1.5 text-sm font-medium transition-colors"
class="fcb-action inline-flex min-h-9 items-center rounded-[30px] border px-3 py-1.5 text-sm font-medium transition-colors"
:class="detailActionClass"
@click="isRetrievalHistoryExpanded = !isRetrievalHistoryExpanded"
>
@@ -1310,7 +1306,7 @@
</section>
<section
class="theme-2026-card-hover space-y-2.5 rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
class="theme-2026-card space-y-2.5 rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
:class="[subtleSectionClass, cardHoverClass]"
>
<div class="flex flex-col gap-2.5 sm:flex-row sm:items-start sm:justify-between">
@@ -1531,7 +1527,7 @@
v-for="option in batchEditModeOptions"
:key="option.value"
type="button"
class="flex min-h-12 items-center justify-center rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors"
class="fcb-action flex min-h-12 items-center justify-center rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors"
:class="getBatchEditModeClass(option.value)"
:disabled="isBatchUpdating"
@click="batchEditForm.mode = option.value"
@@ -1751,6 +1747,7 @@ import FileEditField from '@/components/common/FileEditField.vue'
import NativeDateSelect from '@/components/common/NativeDateSelect.vue'
import BaseModal from '@/components/common/BaseModal.vue'
import BaseButton from '@/components/common/BaseButton.vue'
import AdaptiveValue from '@/components/common/AdaptiveValue.vue'
import { useAdminFiles, useInjectedDarkMode, useTransferAnalytics } from '@/composables'
import { formatFileSize, formatTimestamp } from '@/utils/common'
import { createDetailMotion } from '@/utils/detailMotion'
@@ -2071,31 +2068,31 @@ const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'text-gray-500'))
const panelClass = computed(() =>
isDarkMode.value
? 'border-[#40545c] bg-[#202f36]/90'
? 'border-[#495765] bg-[#252b34]/90'
: 'border-[#d7e3e5] bg-[#f8fbfb]'
)
const fieldClass = computed(() =>
isDarkMode.value
? 'border-[#50666f] bg-[#253941] text-white'
? 'border-[#50666f] bg-[#2c3440] text-white'
: 'border-[#c8d8dc] bg-[#fbfdfd] text-[#263f48]'
)
const detailActionClass = computed(() =>
isDarkMode.value
? 'border-[#3f535c] bg-[#263941]/70 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#2d4751]'
? 'border-[#3f535c] bg-[#2c3440]/70 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#384452]'
: 'border-[#c9d9dd] bg-[#fbfdfd] text-[#36515b] hover:border-[#8fb2bf] hover:bg-[#edf5f6]'
)
const cardHoverClass = computed(() =>
isDarkMode.value
? 'hover:border-[#7199a8] hover:bg-[#263941] hover:shadow-black/25'
? 'hover:border-[#7199a8] hover:bg-[#2c3440] hover:shadow-[#97aac8]/15'
: 'hover:border-[#8fb2bf] hover:shadow-[#a9bdc2]/70'
)
const detailPolicyActionClass = computed(() =>
isDarkMode.value
? 'border-[#40545c] bg-[#203039]/80 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#263941]'
? 'border-[#495765] bg-[#2c3440]/80 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#2c3440]'
: 'border-[#c9d9dd] bg-[#fbfdfd] text-[#36515b] hover:border-[#8fb2bf] hover:bg-[#edf5f6]'
)
const subtleSectionClass = computed(() =>
isDarkMode.value ? 'border-[#40545c] bg-[#17252c]/50' : 'border-[#d7e3e5] bg-[#f3f8f8]'
isDarkMode.value ? 'border-[#495765] bg-[#252b34]/50' : 'border-[#d7e3e5] bg-[#f3f8f8]'
)
type DetailInfoItem = {