⚡ 全面优化 2026 前端响应式体验与加载性能
完成 FileCodeBox 2026 全站桌面端、平板和移动端的视觉交互复核,补齐文件选择后的批量操作闭环,并降低公共首屏的字体与低频依赖成本。 - 为移动文件列表增加全选、已选数量、批量编辑、策略与删除固定栏,并补充详情删除和空筛选重置 - 优化设置保存栏、分区导航、发送过期控件、仪表盘日期与图表操作、分页和记录抽屉 - 为后台侧栏增加遮罩、滚动锁定、Escape 关闭和焦点返回,完善登录密码可见性与国际化 - 移除全站强制 DingTalk 字体,按需加载 JSZip、Marked 和 DOMPurify,并停止空闲提示定时器 - 已通过架构检查、Vue 类型检查、ESLint、生产构建、48 组多视口明暗模式矩阵及核心流程回归
This commit is contained in:
1 parent
fa6b484d17
commit
aa3743b42d
26 files changed
+488
-441
No files matched your search
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<div class="p-4 sm:p-6">
|
||||
<div
|
||||
class="p-4 sm:p-6"
|
||||
:class="hasSelectedFiles ? (showMobilePolicyActions ? 'pb-[22rem] md:pb-6' : 'pb-44 md:pb-6') : ''"
|
||||
>
|
||||
<div class="mb-6 flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold" :class="[primaryTextClass]">
|
||||
@@ -11,7 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 grid grid-cols-2 gap-3 sm:mb-6 sm:gap-4 xl:grid-cols-4">
|
||||
<div v-if="!hasSelectedFiles" class="mb-5 grid grid-cols-2 gap-3 sm:mb-6 sm:gap-4 xl:grid-cols-4">
|
||||
<div
|
||||
v-for="card in summaryCards"
|
||||
:key="card.label"
|
||||
@@ -36,6 +39,7 @@
|
||||
</div>
|
||||
|
||||
<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:-translate-y-0.5 hover:shadow-lg sm:mb-6 sm:rounded-[30px] sm:p-4"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
@@ -81,7 +85,7 @@
|
||||
v-model="params.keyword"
|
||||
type="text"
|
||||
:placeholder="t('fileManage.searchPlaceholder')"
|
||||
class="w-full rounded-lg border py-2.5 pl-10 pr-4 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border py-2.5 pl-10 pr-4 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'border-gray-600 bg-gray-700 text-white placeholder-gray-400'
|
||||
@@ -107,7 +111,7 @@
|
||||
</span>
|
||||
<select
|
||||
:value="params.status"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
@change="handleStatusFilterChange"
|
||||
>
|
||||
@@ -128,7 +132,7 @@
|
||||
</span>
|
||||
<select
|
||||
:value="params.health"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
@change="handleHealthFilterSelect"
|
||||
>
|
||||
@@ -149,7 +153,7 @@
|
||||
</span>
|
||||
<select
|
||||
:value="params.type"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
@change="handleTypeFilterChange"
|
||||
>
|
||||
@@ -166,7 +170,7 @@
|
||||
</span>
|
||||
<select
|
||||
v-model="params.sortBy"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
@change="handleSearch"
|
||||
>
|
||||
@@ -183,7 +187,7 @@
|
||||
</span>
|
||||
<select
|
||||
v-model="params.sortOrder"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
@change="handleSearch"
|
||||
>
|
||||
@@ -200,7 +204,7 @@
|
||||
</span>
|
||||
<select
|
||||
:value="selectedViewPresetId"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
:disabled="isViewPresetLoading"
|
||||
@change="handleViewPresetChange"
|
||||
@@ -277,6 +281,38 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<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]']"
|
||||
>
|
||||
<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">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
|
||||
:checked="isAllCurrentPageSelected"
|
||||
:disabled="isBatchActionRunning"
|
||||
:indeterminate="isCurrentPagePartiallySelected"
|
||||
@change="toggleCurrentPageSelection"
|
||||
/>
|
||||
</span>
|
||||
<span class="truncate">
|
||||
{{ hasSelectedFiles ? t('fileManage.selectedCount', { count: selectedCount }) : t('fileManage.selectCurrentPage') }}
|
||||
</span>
|
||||
</label>
|
||||
<button
|
||||
v-if="hasSelectedFiles"
|
||||
type="button"
|
||||
class="min-h-11 shrink-0 rounded-xl px-3 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:disabled="isBatchActionRunning"
|
||||
@click="clearSelection"
|
||||
>
|
||||
{{ t('fileManage.clearSelection') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex items-center justify-center px-4 py-10 text-sm" :class="[mutedTextClass]">
|
||||
<RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />
|
||||
{{ t('common.loading') }}
|
||||
@@ -286,7 +322,10 @@
|
||||
<BaseButton class="mt-3" variant="secondary" @click="refreshFileList">{{ t('fileManage.refresh') }}</BaseButton>
|
||||
</div>
|
||||
<div v-else-if="tableData.length === 0" class="px-4 py-10 text-center text-sm" :class="[mutedTextClass]">
|
||||
{{ hasActiveFilters ? t('fileManage.noMatches') : t('common.noData') }}
|
||||
<p>{{ hasActiveFilters ? t('fileManage.noMatches') : t('common.noData') }}</p>
|
||||
<BaseButton v-if="hasActiveFilters" class="mt-3" variant="secondary" @click="handleResetFilters">
|
||||
{{ t('fileManage.resetFilters') }}
|
||||
</BaseButton>
|
||||
</div>
|
||||
<div v-else class="divide-y" :class="[isDarkMode ? 'divide-gray-700' : 'divide-[#d9e4e6]']">
|
||||
<article
|
||||
@@ -331,11 +370,6 @@
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-3 pl-14">
|
||||
<button type="button" class="flex min-h-11 w-full items-center justify-center rounded-lg border text-sm font-medium" :class="detailActionClass" @click="openFileDetail(file)">
|
||||
<FileTextIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('fileManage.detail') }}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
@@ -350,6 +384,85 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<Transition name="fcb-expand-120">
|
||||
<aside
|
||||
v-if="hasSelectedFiles"
|
||||
class="fixed inset-x-0 bottom-0 z-40 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'"
|
||||
:style="{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))' }"
|
||||
:aria-label="t('fileManage.mobileBatchActions')"
|
||||
>
|
||||
<div class="mx-auto max-w-lg space-y-2">
|
||||
<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'"
|
||||
>
|
||||
<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="detailActionClass"
|
||||
:title="option.description"
|
||||
:disabled="option.disabled || isBatchDeleting || isBatchUpdating || isBatchPolicyActionRunning"
|
||||
@click="applySelectedPolicyActionAndRefreshHistory(option.action)"
|
||||
>
|
||||
{{ option.label }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between gap-3 px-1">
|
||||
<p class="text-sm font-semibold" :class="primaryTextClass">
|
||||
{{ t('fileManage.selectedCount', { count: selectedCount }) }}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="min-h-11 rounded-xl px-3 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:disabled="isBatchActionRunning"
|
||||
@click="clearSelection"
|
||||
>
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<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="detailActionClass"
|
||||
:disabled="isBatchDeleting || isBatchPolicyActionRunning"
|
||||
@click="openBatchEditModal"
|
||||
>
|
||||
<ClockIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
<span>{{ t('common.edit') }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="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"
|
||||
@click="showMobilePolicyActions = !showMobilePolicyActions"
|
||||
>
|
||||
<TimerResetIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
{{ t('fileManage.policyActionsLabel') }}
|
||||
</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"
|
||||
:disabled="isBatchUpdating || isBatchPolicyActionRunning"
|
||||
@click="deleteSelectedFilesAndRefreshHistory"
|
||||
>
|
||||
<TrashIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
{{ t('common.delete') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</Transition>
|
||||
|
||||
<div class="hidden md:block">
|
||||
<DataTable :title="t('fileManage.allFiles')" :headers="fileTableHeaders" table-class="min-w-[1120px]">
|
||||
<template #actions>
|
||||
@@ -968,6 +1081,14 @@
|
||||
: t('fileManage.downloadFile')
|
||||
}}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-12 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" />
|
||||
{{ t('common.delete') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<section
|
||||
@@ -1178,7 +1299,7 @@
|
||||
v-model="detailMetadataForm.note"
|
||||
rows="3"
|
||||
maxlength="2000"
|
||||
class="w-full resize-y rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
:placeholder="t('fileManage.metadataNotePlaceholder')"
|
||||
></textarea>
|
||||
@@ -1190,7 +1311,7 @@
|
||||
<input
|
||||
v-model="detailMetadataForm.tagsText"
|
||||
type="text"
|
||||
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
class="min-h-11 w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
|
||||
:class="[fieldClass]"
|
||||
:placeholder="t('fileManage.metadataTagsPlaceholder')"
|
||||
/>
|
||||
@@ -1688,12 +1809,17 @@ const {
|
||||
} = useAdminFiles()
|
||||
|
||||
const isFilterPanelOpen = ref(false)
|
||||
const showMobilePolicyActions = ref(false)
|
||||
const isLifecycleExpanded = ref(false)
|
||||
const visibleDetailTimeline = computed(() => {
|
||||
const rows = selectedFileDetail.value?.detailTimeline || []
|
||||
return isLifecycleExpanded.value ? rows : rows.slice(0, 3)
|
||||
})
|
||||
const filterBodyVisible = computed(() => isFilterPanelOpen.value || hasActiveFilters.value)
|
||||
|
||||
watch(hasSelectedFiles, (selected) => {
|
||||
if (!selected) showMobilePolicyActions.value = false
|
||||
})
|
||||
const isHistoryLoading = ref(false)
|
||||
const historyRows = ref<AnalyticsFileRow[]>([])
|
||||
const historyPage = ref(1)
|
||||
@@ -1721,6 +1847,12 @@ const handleBatchUpdateAndRefreshHistory = () =>
|
||||
runFileMutationAndRefreshHistory(handleBatchUpdateRaw)
|
||||
const deleteFileAndRefreshHistory = (id: number) =>
|
||||
runFileMutationAndRefreshHistory(() => deleteFileRaw(id))
|
||||
const deleteDetailFileAndRefreshHistory = async () => {
|
||||
if (!selectedFileDetail.value) return
|
||||
const id = selectedFileDetail.value.id
|
||||
await deleteFileAndRefreshHistory(id)
|
||||
closeFileDetail()
|
||||
}
|
||||
const deleteSelectedFilesAndRefreshHistory = () =>
|
||||
runFileMutationAndRefreshHistory(deleteSelectedFilesRaw)
|
||||
const applySelectedPolicyActionAndRefreshHistory = (action: AdminFilePolicyAction) =>
|
||||
|
||||
Reference in new issue
Block a user