🔀 merge: 合并管理后台优化与 2.7.0 前端

This commit is contained in:
orion committed 2026-09-18 10:29:49 +08:00
commit 7f9aaf8a4d
66 files changed
+2341 -917

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "filecodeboxfronted",
"version": "0.0.0",
"version": "2.7.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "filecodeboxfronted",
"version": "0.0.0",
"version": "2.7.0",
"dependencies": {
"@tailwindcss/typography": "^0.5.16",
"axios": "^1.13.2",
+6 -1
View File
@@ -1,10 +1,15 @@
{
"name": "filecodeboxfronted",
"version": "0.0.0",
"version": "2.7.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"test:ui": "node --test tests/uiSystem.test.mjs tests/uiSystem.integration.test.mjs",
"test:trash": "node --experimental-strip-types --test tests/trashPresentation.test.mjs tests/trashPresentation.integration.test.mjs",
"test:trash:coverage": "node --experimental-strip-types --test --experimental-test-coverage --test-coverage-include=src/utils/trashPresentation.ts tests/trashPresentation.test.mjs",
"test:motion": "node --experimental-strip-types --test tests/detailMotion.test.mjs",
"test:motion:coverage": "node --experimental-strip-types --test --experimental-test-coverage --test-coverage-include=src/utils/detailMotion.ts tests/detailMotion.test.mjs",
"build": "run-s check:architecture type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
+5 -8
View File
@@ -54,10 +54,8 @@ const {
linear-gradient(90deg, rgba(103, 135, 145, 0.12), rgba(162, 172, 154, 0.1));
}
.dark {
background:
linear-gradient(135deg, #10191e 0%, #17252b 48%, #223036 100%),
linear-gradient(90deg, rgba(113, 153, 168, 0.12), rgba(117, 143, 132, 0.08));
.app-container.dark {
background: var(--fcb-bg);
}
.fade-enter-active,
@@ -73,13 +71,12 @@ const {
.transfer-fade-enter-active,
.transfer-fade-leave-active {
transition:
opacity 0.2s ease,
transform 0.2s ease;
opacity 0.28s ease;
}
.transfer-fade-enter-from {
opacity: 0;
transform: translateY(8px);
}
.transfer-fade-leave-active {
@@ -91,7 +88,7 @@ const {
.transfer-fade-leave-to {
opacity: 0;
transform: translateY(-6px);
}
.loading-overlay {
+200
View File
@@ -0,0 +1,200 @@
/* Action motion is independent of transforms used for positioned icons. */
.fcb-action {
--fcb-action-bg: var(--fcb-button-secondary-bg);
--fcb-action-hover: var(--fcb-button-secondary-hover);
--fcb-action-text: var(--fcb-button-secondary-text);
--fcb-action-border: var(--fcb-button-secondary-border);
--fcb-action-shadow: -3px -3px 8px rgb(255 255 255 / 70%), 3px 4px 9px rgb(107 132 146 / 15%);
transition: translate 300ms ease, transform 300ms ease, box-shadow 300ms ease,
background-color 300ms ease, border-color 300ms ease, color 300ms ease, opacity 300ms ease !important;
touch-action: manipulation;
}
.dark .fcb-action { --fcb-action-shadow: -3px -3px 8px rgb(24 31 44 / 35%), 3px 4px 9px rgb(108 129 164 / 12%); }
@media (hover: hover) and (pointer: fine) {
.fcb-action:not(:disabled):not([aria-disabled="true"]):hover {
translate: 0 -2px;
box-shadow: var(--fcb-action-shadow) !important;
}
.fcb-action:not(:disabled):active { translate: 0 0; }
}
.fcb-action:disabled, .fcb-action[aria-disabled="true"] { translate: none; }
/* Only color roles override utility classes. Component spacing stays contextual. */
.fcb-button-primary, .fcb-action:is(.bg-indigo-500,.bg-indigo-600,.bg-blue-500,.bg-blue-600,[class*="from-indigo-"],[class*="from-purple-"],[class*="bg-[#7198a6]"],[class*="bg-[#5f8796]"]) {
--fcb-action-bg: var(--fcb-button-primary-bg); --fcb-action-hover: var(--fcb-button-primary-hover);
--fcb-action-text: var(--fcb-button-primary-text); --fcb-action-border: var(--fcb-button-primary-border);
}
.fcb-button-secondary {
--fcb-action-bg: var(--fcb-button-secondary-bg); --fcb-action-hover: var(--fcb-button-secondary-hover);
--fcb-action-text: var(--fcb-button-secondary-text); --fcb-action-border: var(--fcb-button-secondary-border);
}
.fcb-button-success, .fcb-action:is(.bg-green-50,.bg-green-100,.bg-green-500,.bg-green-600,[class*="bg-[#6f9688]"]) {
--fcb-action-bg: var(--fcb-button-success-bg); --fcb-action-hover: var(--fcb-button-success-hover);
--fcb-action-text: var(--fcb-button-success-text); --fcb-action-border: var(--fcb-button-success-border);
}
.fcb-button-danger, .fcb-action:is(.bg-red-50,.bg-red-100,.bg-red-500,.bg-red-600,.bg-red-700) {
--fcb-action-bg: var(--fcb-button-danger-bg); --fcb-action-hover: var(--fcb-button-danger-hover);
--fcb-action-text: var(--fcb-button-danger-text); --fcb-action-border: var(--fcb-button-danger-border);
}
.fcb-button-outline, .fcb-action:is(.bg-purple-50,.bg-purple-100) {
--fcb-action-bg: var(--fcb-button-outline-bg); --fcb-action-hover: var(--fcb-button-outline-hover);
--fcb-action-text: var(--fcb-button-outline-text); --fcb-action-border: var(--fcb-button-outline-border);
}
.fcb-action {
background-color: var(--fcb-action-bg) !important;
color: var(--fcb-action-text) !important;
border-color: var(--fcb-action-border) !important;
}
.fcb-action:is([class*="fcb-button-"],[class*="from-indigo-"],[class*="from-purple-"]) { background-image: none !important; }
.fcb-action:not(:disabled):hover { background-color: var(--fcb-action-hover) !important; }
.fcb-action svg { flex-shrink: 0; }
.fcb-icon-action { padding-inline: 0 !important; }
.fcb-icon-action > svg { margin-inline: 0 !important; }
@media (max-width: 639px) {
:root {
--fcb-control-size: clamp(36px, 9.5vw, 40px);
--fcb-control-font: clamp(12px, 3.35vw, 14px);
--fcb-control-px: clamp(8px, 2.5vw, 12px);
}
.fcb-action:not(.fcb-content-action) {
min-height: var(--fcb-control-size) !important;
height: auto;
padding-block: 6px !important;
padding-inline: var(--fcb-control-px) !important;
font-size: var(--fcb-control-font) !important;
line-height: 1.4;
border-radius: 14px;
}
.fcb-action:not(.fcb-content-action) svg {
width: clamp(14px, 4vw, 17px);
height: clamp(14px, 4vw, 17px);
}
.fcb-action:not(.fcb-content-action) svg[class*="mr-"] { margin-right: 5px; }
.fcb-action:not(.fcb-content-action) svg[class*="ml-"] { margin-left: 5px; }
.fcb-icon-action {
width: var(--fcb-control-size) !important;
height: var(--fcb-control-size) !important;
min-width: var(--fcb-control-size) !important;
padding: 0 !important;
}
.fcb-icon-action > svg { margin-inline: 0 !important; }
.fcb-pagination-controls { gap: 4px; }
.fcb-pagination-controls .fcb-action { min-width: 0; padding-inline: 7px !important; white-space: nowrap; }
.fcb-page-size {
min-height: var(--fcb-control-size) !important;
min-width: 0;
width: auto;
padding-inline: 5px !important;
font-size: var(--fcb-control-font);
}
.fcb-metric-card { min-width: 0; padding: 10px 8px !important; border-radius: 16px; }
.fcb-metric-card > div:first-child { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; }
.fcb-metric-card > p { font-size: 11px; overflow-wrap: anywhere; }
.fcb-summary-grid > div { border-radius: 16px; }
.fcb-summary-grid p { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
.fcb-action { transition-duration: .01ms !important; }
.fcb-action:not(:disabled):not([aria-disabled="true"]):hover { translate: none; }
}
.fcb-content-action { --fcb-action-bg: transparent; --fcb-action-hover: transparent; --fcb-action-text: inherit; }
/* Match the selected pagination item without requiring dark text on a dark fill. */
.fcb-action[aria-current="page"] { outline: 2px solid var(--fcb-button-primary-border); outline-offset: 1px; font-weight: 700; }
@media (max-width: 639px) {
.fcb-pagination-controls { column-gap: 6px; }
.fcb-page-size { justify-self: start; width: 5.1rem; border-radius: 12px; }
.fcb-pagination-controls .fcb-page-nav {
width: var(--fcb-control-size);
height: var(--fcb-control-size);
min-width: var(--fcb-control-size);
padding: 0 !important;
border: 1px solid var(--fcb-border);
border-radius: 12px;
}
.fcb-page-nav:disabled { opacity: .45; box-shadow: none; }
.fcb-page-counter { min-width: 3rem; font-size: 12px; color: var(--fcb-text); }
}
@media (max-width: 639px) {
.fcb-action:not(.fcb-content-action) :is(.text-sm, .text-base, .text-lg) { font-size: inherit; }
}
/* Button-like checkbox labels keep native multi-selection and keyboard access. */
.fcb-choice:has(input:focus-visible) .fcb-choice-face { outline: 3px solid var(--fcb-primary); outline-offset: 3px; }
.fcb-choice:has(input:disabled) .fcb-choice-face { translate: none !important; opacity: .5; cursor: not-allowed; }
/* Native semantics with theme-aware checkbox surfaces (including mixed state). */
input[type="checkbox"]:not(.sr-only) {
appearance: none;
-webkit-appearance: none;
display: inline-block;
width: 20px;
height: 20px;
min-width: 20px;
margin: 0;
vertical-align: middle;
border: 1px solid var(--fcb-button-secondary-border);
border-radius: 6px;
background-color: var(--fcb-surface);
background-position: center;
background-repeat: no-repeat;
background-size: 15px 15px;
box-shadow: inset 1px 1px 3px rgb(107 132 146 / 12%);
cursor: pointer;
transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
input[type="checkbox"]:not(.sr-only):is(:checked,:indeterminate) {
background-color: var(--fcb-button-primary-bg);
border-color: var(--fcb-button-primary-border);
box-shadow: none;
}
input[type="checkbox"]:not(.sr-only):checked {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m4 10 4 4 8-8' fill='none' stroke='%23304f60' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
input[type="checkbox"]:not(.sr-only):indeterminate {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10h12' stroke='%23304f60' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
.dark input[type="checkbox"]:not(.sr-only):checked {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m4 10 4 4 8-8' fill='none' stroke='%23dfedf4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.dark input[type="checkbox"]:not(.sr-only):indeterminate {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10h12' stroke='%23dfedf4' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
input[type="checkbox"]:not(.sr-only):disabled { cursor: not-allowed; opacity: .45; }
@media (forced-colors: active) { input[type="checkbox"]:not(.sr-only) { appearance: auto; background-image: none; } }
/* Input accessories stay inside the field and never act like floating cards. */
.fcb-action.fcb-input-action,
.fcb-action.fcb-input-action:not(:disabled):hover {
position: absolute;
inset-block: 4px;
right: 5px;
width: 36px;
min-width: 36px;
min-height: 0 !important;
height: auto;
padding: 0 !important;
border: 0;
border-radius: 10px;
background: transparent !important;
color: var(--fcb-text-muted) !important;
box-shadow: none !important;
translate: none !important;
transform: none !important;
}
.fcb-action.fcb-input-action:not(:disabled):hover { color: var(--fcb-text) !important; }
.fcb-filter-grid { align-items: end; }
.fcb-filter-grid :is(input,select) { height: 40px; min-height: 40px; font-size: 14px; }
.fcb-filter-grid .fcb-action { min-height: 40px; }
@media (max-width: 639px) {
.fcb-filter-grid :is(input,select), .fcb-filter-grid .fcb-action { height: var(--fcb-control-size); min-height: var(--fcb-control-size); font-size: var(--fcb-control-font); }
}
/* Clickable list content is not a floating action card. */
.fcb-action.fcb-content-action,
.fcb-action.fcb-content-action:not(:disabled):not([aria-disabled="true"]):hover {
translate: none !important;
transform: none !important;
box-shadow: none !important;
}
+166 -275
View File
@@ -1,8 +1,10 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
@import './controls.css';
html {
color-scheme: light;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
@@ -85,34 +87,15 @@ textarea {
box-shadow: 0 16px 34px rgba(114, 143, 150, 0.26);
}
.fcb-interactive-row {
position: relative;
z-index: 0;
transition:
background-color 180ms ease,
border-color 180ms ease,
box-shadow 180ms ease,
transform 180ms ease;
}
/* List rows use the same pastel highlight timing and palette as cards. */
.fcb-interactive-row:hover {
z-index: 1;
box-shadow: inset 3px 0 0 rgba(95, 135, 150, 0.7), 0 10px 22px rgba(86, 118, 126, 0.16);
transform: translateY(-1px);
}
.dark .theme-2026-card {
border-color: rgba(68, 86, 94, 0.82);
background:
linear-gradient(135deg, rgba(34, 49, 56, 0.96), rgba(24, 35, 42, 0.92)),
radial-gradient(circle at 14% 10%, rgba(102, 142, 156, 0.18), transparent 32%);
box-shadow: 0 16px 36px rgba(4, 10, 14, 0.34);
}
.dark .theme-2026-card-hover:hover {
border-color: rgba(113, 153, 168, 0.68);
box-shadow: 0 20px 44px rgba(4, 10, 14, 0.46);
}
.fcb-secondary-card { transition: all 300ms ease !important; box-shadow: -8px -8px 20px rgba(255,255,255,.8), 8px 8px 20px rgba(163,177,198,.5) !important; }
.fcb-secondary-card:hover { transform: translateY(-2px); background: #f0f4f8 !important; box-shadow: -10px -10px 25px rgba(255,255,255,.9), 10px 10px 25px rgba(163,177,198,.6) !important; }
.data-table-2026 thead th {
background: rgba(236, 244, 246, 0.76);
@@ -124,10 +107,6 @@ textarea {
opacity 180ms ease;
}
.data-table-2026 tbody tr:hover {
background: rgba(226, 236, 238, 0.46);
}
.data-table-2026 tbody tr.is-selected {
background: rgba(213, 228, 230, 0.72);
}
@@ -140,270 +119,182 @@ textarea {
background: rgba(31, 45, 52, 0.82);
}
.dark .data-table-2026 tbody tr:hover {
background: rgba(45, 71, 81, 0.42);
}
.dark .data-table-2026 tbody tr.is-selected-dark {
background: rgba(42, 64, 72, 0.68);
}
.bg-indigo-50,
.bg-blue-50 {
background-color: #dce8eb !important;
/* Serenity-inspired soft pastel motion and surfaces. */
:root {
--fcb-pastel-sage: #9fc9bd;
--fcb-pastel-blue: #a9c7d8;
--fcb-pastel-lavender: #c5bddb;
--fcb-surface: #f2f6f8;
--fcb-shadow-soft: 0 12px 28px rgba(112, 137, 151, 0.16), -8px -8px 20px rgba(255,255,255,.72);
}
body { background: var(--fcb-surface); }
.theme-2026-card,
.theme-2026-card-hover {
border-color: rgba(170, 194, 201, .62) !important;
box-shadow: var(--fcb-shadow-soft) !important;
}
.theme-2026-card-hover:hover {
transform: translateY(-2px);
box-shadow: 0 16px 34px rgba(112, 137, 151, .22), -8px -8px 20px rgba(255,255,255,.78) !important;
}
button, a { -webkit-tap-highlight-color: transparent; }
.fcb-lifecycle-list { overflow: visible; will-change: height; }
.fcb-lifecycle-row { will-change: opacity; }
.fcb-lifecycle-card { transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease !important; }
.fcb-lifecycle-card:hover { transform: translateY(-2px) !important; box-shadow: 0 12px 24px rgba(112, 137, 151, .2) !important; }
@media (prefers-reduced-motion: reduce) {
.theme-2026-card-hover:hover { transform: none; }
}
.bg-indigo-100,
.bg-blue-100 {
background-color: #d1e0e3 !important;
/* 2026 Serenity neumorphic system */
:root {
--fcb-bg: #edf3f5;
--fcb-surface: #f7fafb;
--fcb-surface-muted: #e7eef1;
--fcb-text: #405466;
--fcb-text-muted: #607580;
--fcb-border: #cbdde3;
--fcb-primary: #7198a6;
--fcb-primary-dark: #628b9b;
--fcb-mint: #a8d0c2;
--fcb-lilac: #c3bdd4;
--fcb-peach: #f0c9b8;
--fcb-shadow-out: 12px 14px 28px rgba(115, 139, 151, .18), -9px -9px 22px rgba(255,255,255,.88);
--fcb-shadow-in: inset 3px 3px 8px rgba(147, 165, 174, .2), inset -3px -3px 8px rgba(255,255,255,.9);
}
html, body, #app { background: var(--fcb-bg); color: var(--fcb-text); }
.app-container.light { background: radial-gradient(circle at 15% 10%, #f8fbfc 0, transparent 34%), linear-gradient(135deg,#e8f0f2,#f4f7f6 58%,#edf3f5); }
.theme-2026-card, .theme-2026-card-hover,
.fcb-lifecycle-card, .feature-card, .therapist-card, .resource-card {
background: var(--fcb-bg) !important;
border-color: transparent !important;
box-shadow: -8px -8px 20px rgba(255,255,255,.8), 8px 8px 20px rgba(163,177,198,.5) !important;
transition: all 300ms ease !important;
}
.theme-2026-card-hover:hover,
.fcb-lifecycle-card:hover, .feature-card:hover, .therapist-card:hover, .resource-card:hover {
transform: translateY(-4px) !important;
border-color: transparent !important;
box-shadow: -10px -10px 25px rgba(255,255,255,.9), 10px 10px 25px rgba(163,177,198,.6) !important;
}
/* Nested cards use the demo's lighter 2px lift; outer cards keep 4px. */
.theme-2026-card .theme-2026-card-hover:hover,
.theme-2026-card-hover.fcb-lifecycle-card:hover,
.theme-2026-card-hover .fcb-secondary-card:hover {
transform: translateY(-2px) !important;
}
.bg-indigo-500,
.bg-blue-500,
.bg-cyan-500 {
background-color: #6f98a6 !important;
/* Keep every dashboard card on the same 300ms pastel hover curve. */
.theme-2026-card-hover {
transition: all 300ms ease !important;
}
.theme-2026-card-hover:hover {
background: #f0f4f8 !important;
border-color: transparent !important;
box-shadow: -10px -10px 25px rgba(255,255,255,.9), 10px 10px 25px rgba(163,177,198,.6) !important;
}
.dark .theme-2026-card-hover:hover {
background: #2f414a !important;
box-shadow: -10px -10px 25px rgba(69,88,99,.45), 10px 10px 25px rgba(10,18,23,.55) !important;
}
input:not([type=file]):not([type=checkbox]):not([type=radio]), select:not(.native-date-part), textarea { background: var(--fcb-surface) !important; color: var(--fcb-text) !important; border-color: var(--fcb-border) !important; box-shadow: var(--fcb-shadow-in); }
button, a { border-radius: 14px; }
button:not(:disabled), a { cursor: pointer; }
.fcb-lifecycle-card { background: var(--fcb-bg) !important; }
.loading-overlay { background: rgba(225,235,238,.72) !important; backdrop-filter: blur(8px); }
.loading-spinner { border-color: #d5e5e7 !important; border-top-color: var(--fcb-primary) !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } .theme-2026-card-hover:hover, .fcb-lifecycle-card:hover { transform: none !important; } }
.fcb-lifecycle-row { transition: opacity 420ms cubic-bezier(.22,1,.36,1); }
.fcb-lifecycle-list, .fcb-expand-content { overflow: hidden; }
/* List highlighting stays inside the hovered row. */
/* Final specificity: health cards are inner cards, so they lift 2px. */
.theme-2026-card .fcb-health-card:hover,
.fcb-health-card:hover {
transform: translateY(-2px) !important;
}
.bg-indigo-600,
.bg-blue-600,
.bg-cyan-600 {
background-color: #5f8796 !important;
/* Health buttons inherit the same transition as adjacent cards. */
@media (prefers-reduced-motion: reduce) {
.theme-2026-card .fcb-health-card:hover {
transform: none !important;
}
}
.bg-indigo-700,
.bg-blue-700,
.bg-cyan-700 {
background-color: #527887 !important;
/* Matching dark surfaces retain the same pastel families with readable contrast. */
.dark {
color-scheme: dark;
--fcb-bg: #252b34;
--fcb-surface: #2c3440;
--fcb-surface-muted: #333d49;
--fcb-text: #dfebee;
--fcb-text-muted: #adbec6;
--fcb-border: #495765;
--fcb-shadow-in: inset 3px 3px 8px rgba(9,20,25,.28), inset -3px -3px 8px rgba(75,98,109,.12);
}
/* Dark neumorphism uses soft grey-blue light, not black rims. */
.dark .theme-2026-card, .dark .theme-2026-card-hover, .dark .fcb-lifecycle-card {
box-shadow: -8px -8px 20px rgba(102,119,146,.16), 8px 8px 20px rgba(24,31,44,.55) !important;
}
.dark .theme-2026-card::before { display: none; }
.dark .theme-2026-card-hover:hover, .dark .fcb-secondary-card:hover {
background: #2d3541 !important;
box-shadow: -10px -10px 25px rgba(102,119,146,.21), 10px 10px 25px rgba(24,31,44,.62) !important;
}
.fcb-summary-grid .fcb-secondary-card:hover { transform: translateY(-2px) !important; }
button.theme-2026-card-hover:disabled:hover { transform: none !important; }
@media (prefers-reduced-motion: reduce), (hover: none) {
.fcb-summary-grid .fcb-secondary-card:hover { transform: none !important; }
}
.dark :is(.shadow-sm, .shadow-md, .shadow-lg, .shadow-xl) {
--tw-shadow-color: rgba(35, 46, 65, .24);
--tw-shadow: var(--tw-shadow-colored);
}
.bg-green-50 {
background-color: #e1eee8 !important;
/* Light: upper-left light, lower-right shade. Dark reverses this direction. */
:root {
--fcb-card-shadow: -8px -8px 20px rgba(255,255,255,.85), 8px 8px 20px rgba(163,177,198,.38);
--fcb-card-shadow-hover: -10px -10px 25px rgba(255,255,255,.92), 10px 10px 25px rgba(163,177,198,.48);
}
.dark {
--fcb-card-shadow: -8px -8px 20px rgba(24,31,44,.55), 8px 8px 20px rgba(102,119,146,.16);
--fcb-card-shadow-hover: -10px -10px 25px rgba(24,31,44,.62), 10px 10px 25px rgba(102,119,146,.21);
}
:is(.fcb-surface, .theme-2026-card, .theme-2026-card-hover, .fcb-lifecycle-card, .fcb-secondary-card),
.dark :is(.fcb-surface, .theme-2026-card, .theme-2026-card-hover, .fcb-lifecycle-card, .fcb-secondary-card) {
box-shadow: var(--fcb-card-shadow) !important;
}
:is(.theme-2026-card-hover, .fcb-lifecycle-card, .fcb-secondary-card):hover,
.dark :is(.theme-2026-card-hover, .fcb-lifecycle-card, .fcb-secondary-card):hover {
box-shadow: var(--fcb-card-shadow-hover) !important;
}
/* Large content sections retain their position while their children animate. */
section.theme-2026-card:hover { transform: none !important; }
.fcb-surface { background: var(--fcb-bg) !important; border-color: var(--fcb-border) !important; }
/* Matte faces: directional shadows provide depth without a painted gradient. */
.theme-2026-card::before { display: none; }
.fcb-static-container:hover { transform: none !important; translate: none !important; }
.fcb-surface .theme-2026-card-hover:hover { transform: translateY(-2px) !important; }
@media (prefers-reduced-motion: reduce), (hover: none) {
.fcb-surface .theme-2026-card-hover:hover { transform: none !important; }
}
.bg-green-100 {
background-color: #d4e5dd !important;
/* Lists highlight without frames, elevation or movement. Keyboard focus stays visible. */
:root { --fcb-row-hover: #dcebef; }
.dark { --fcb-row-hover: #303d4a; }
.fcb-list-row, .fcb-interactive-row, .data-table-2026 tbody tr {
transition: background-color 300ms ease !important;
}
.bg-green-500,
.bg-green-600 {
background-color: #6f9688 !important;
}
.bg-green-700 {
background-color: #5f8377 !important;
}
.bg-red-50 {
background-color: #f1e2e5 !important;
}
.bg-red-100 {
background-color: #e8d3d7 !important;
}
.bg-red-500,
.bg-red-600 {
background-color: #9b6a72 !important;
}
.bg-red-700 {
background-color: #895c63 !important;
}
.bg-purple-50 {
background-color: #e7e2ea !important;
}
.bg-purple-100 {
background-color: #ddd6e2 !important;
}
.bg-purple-500,
.bg-pink-500 {
background-color: #8c8294 !important;
}
.bg-purple-600,
.bg-pink-600 {
background-color: #7b7284 !important;
}
.text-indigo-200,
.text-blue-200 {
color: #d8e8eb !important;
}
.text-indigo-300,
.text-blue-300 {
color: #b8d4dc !important;
}
.text-indigo-400,
.text-blue-400,
.text-cyan-400 {
color: #8fb2bf !important;
}
.text-indigo-500,
.text-blue-500,
.text-cyan-500 {
color: #6f98a6 !important;
}
.text-indigo-600,
.text-blue-600,
.text-cyan-600 {
color: #5f8796 !important;
}
.text-indigo-700,
.text-blue-700 {
color: #3f6a77 !important;
}
.text-green-300,
.text-green-400 {
color: #b6d6ca !important;
}
.text-green-500,
.text-green-600,
.text-green-700 {
color: #5f8377 !important;
}
.text-red-200,
.text-red-300,
.text-red-400 {
color: #e5c5ca !important;
}
.text-red-500,
.text-red-600,
.text-red-700 {
color: #8b5962 !important;
}
.text-purple-300,
.text-purple-400 {
color: #d4c8dc !important;
}
.text-purple-500,
.text-purple-600,
.text-purple-700 {
color: #6f6379 !important;
}
.border-indigo-100,
.border-blue-100 {
border-color: #cfe1e4 !important;
}
.border-indigo-300,
.border-blue-300 {
border-color: #9db6bd !important;
}
.border-indigo-400,
.border-indigo-500,
.border-blue-500 {
border-color: #8fb2bf !important;
}
.border-indigo-600 {
border-color: #5f8796 !important;
}
.border-red-100 {
border-color: #e8d3d7 !important;
}
.border-red-200,
.border-red-500 {
border-color: #c9a4aa !important;
}
.focus\:ring-indigo-500:focus,
.focus\:ring-blue-500:focus,
.focus\:ring-cyan-500:focus,
.focus\:ring-purple-500:focus {
--tw-ring-color: #8fb2bf !important;
}
.focus\:border-indigo-500:focus,
.focus\:border-cyan-500:focus {
border-color: #8fb2bf !important;
}
.hover\:bg-indigo-100:hover,
.hover\:bg-blue-100:hover {
background-color: #cfe1e4 !important;
}
.hover\:bg-indigo-500:hover,
.hover\:bg-blue-500:hover,
.hover\:bg-cyan-500:hover {
background-color: #6f98a6 !important;
}
.hover\:bg-indigo-600:hover,
.hover\:bg-blue-600:hover,
.hover\:bg-cyan-600:hover {
background-color: #527887 !important;
}
.hover\:bg-indigo-700:hover,
.hover\:bg-blue-700:hover,
.hover\:bg-cyan-700:hover {
background-color: #466b78 !important;
}
.hover\:bg-green-100:hover {
background-color: #d4e5dd !important;
}
.hover\:bg-green-400:hover,
.hover\:bg-green-600:hover,
.hover\:bg-green-700:hover {
background-color: #5f8377 !important;
}
.hover\:bg-red-100:hover {
background-color: #e8d3d7 !important;
}
.hover\:bg-red-400:hover,
.hover\:bg-red-600:hover,
.hover\:bg-red-700:hover {
background-color: #895c63 !important;
}
.hover\:border-indigo-500:hover {
border-color: #8fb2bf !important;
}
.from-indigo-500,
.from-indigo-600,
.from-cyan-500,
.from-cyan-600 {
--tw-gradient-from: #5f8796 var(--tw-gradient-from-position) !important;
--tw-gradient-to: rgba(95, 135, 150, 0) var(--tw-gradient-to-position) !important;
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.via-purple-500,
.via-purple-600 {
--tw-gradient-to: rgba(140, 130, 148, 0) var(--tw-gradient-to-position) !important;
--tw-gradient-stops:
var(--tw-gradient-from),
#8c8294 var(--tw-gradient-via-position),
var(--tw-gradient-to) !important;
}
.to-purple-500,
.to-purple-600,
.to-pink-500,
.to-pink-600 {
--tw-gradient-to: #6f9688 var(--tw-gradient-to-position) !important;
.fcb-list-row:hover, .fcb-interactive-row:hover, .data-table-2026 tbody tr:hover {
background-color: var(--fcb-row-hover) !important;
box-shadow: none !important;
transform: none !important;
}
+28
View File
@@ -0,0 +1,28 @@
<template>
<span ref="container" class="fcb-adaptive-value block min-w-0 tabular-nums" :title="String(value)" :style="{ fontSize: `${fontSize}px` }"><span class="whitespace-nowrap">{{ value }}</span></span>
</template>
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { fitValueFontSize } from '@/utils/adaptiveValue'
const props = withDefaults(defineProps<{ value: string | number; maximum?: number; minimum?: number }>(), { maximum: 24, minimum: 14 })
const container = ref<HTMLElement | null>(null)
const fontSize = ref(props.maximum)
let observer: ResizeObserver | undefined
const measure = () => {
const element = container.value
const text = element?.firstElementChild as HTMLElement | null
if (!element || !text) return
text.style.fontSize = `${props.maximum}px`
const width = text.getBoundingClientRect().width
text.style.fontSize = ''
fontSize.value = fitValueFontSize(element.clientWidth, width, props.maximum, props.minimum)
}
onMounted(() => {
observer = new ResizeObserver(measure)
if (container.value) observer.observe(container.value)
measure()
void document.fonts.ready.then(measure)
})
watch(() => [props.value, props.maximum, props.minimum], () => { void nextTick(measure) })
onBeforeUnmount(() => observer?.disconnect())
</script>
+15 -9
View File
@@ -18,16 +18,16 @@
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<component :is="alertIcons[alert.type]" class="h-6 w-6 text-white" />
<component :is="alertIcons[alert.type]" class="h-6 w-6 text-inherit" />
</div>
<div class="ml-3 flex-1 pt-0.5">
<p class="text-sm font-medium text-white">{{ alert.message }}</p>
<p class="text-sm font-medium text-inherit">{{ alert.message }}</p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button
type="button"
@click="removeAlert(alert.id)"
class="inline-flex h-11 w-11 items-center justify-center rounded-lg text-white transition-colors duration-200 hover:bg-white/10 hover:text-gray-100 focus:outline-none focus:ring-2 focus:ring-white"
class="fcb-action fcb-icon-action inline-flex h-11 w-11 items-center justify-center rounded-lg text-inherit transition-colors duration-200 hover:bg-white/10 hover:text-gray-100 focus:outline-none focus:ring-2 focus:ring-white"
>
<span class="sr-only">{{ t('common.close') }}</span>
<X class="h-5 w-5" />
@@ -59,10 +59,10 @@ const { alerts } = storeToRefs(alertStore)
const { removeAlert } = alertStore
const gradientClasses = {
success: 'from-[#6f9688] to-[#5f8377]',
error: 'from-[#9b6a72] to-[#895c63]',
warning: 'from-[#b2a16f] to-[#9b8b5e]',
info: 'from-[#5f8796] to-[#527887]'
success: 'fcb-alert-success',
error: 'fcb-alert-error',
warning: 'fcb-alert-warning',
info: 'fcb-alert-info'
}
const alertIcons = {
@@ -76,13 +76,19 @@ const alertIcons = {
</script>
<style scoped>
.fcb-alert-success { background: var(--fcb-button-success-bg); color: var(--fcb-button-success-text); }
.fcb-alert-error { background: var(--fcb-button-danger-bg); color: var(--fcb-button-danger-text); }
.fcb-alert-info { background: var(--fcb-button-primary-bg); color: var(--fcb-button-primary-text); }
.fcb-alert-warning { background: #f4e6cb; color: #70532e; }
.dark .fcb-alert-warning { background: #51452f; color: #f2e4ca; }
.alert-fade-enter-active,
.alert-fade-leave-active {
transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1), transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.alert-fade-enter-from,
.alert-fade-leave-to {
opacity: 0;
transform: translateX(-50px) scale(0.95);
transform: translateY(-6px);
}
</style>
+2 -33
View File
@@ -3,7 +3,7 @@
:type="type"
:disabled="disabled || loading"
@click="$emit('click', $event)"
class="inline-flex items-center justify-center rounded-[30px] px-4 py-2 font-medium shadow-sm transition-all duration-200 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:shadow-sm"
class="fcb-action border border-transparent inline-flex items-center justify-center rounded-[30px] px-4 py-2 font-medium shadow-sm transition-all duration-200 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:shadow-sm"
:class="[
sizeClasses,
variantClasses,
@@ -19,7 +19,6 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useInjectedDarkMode } from '@/composables'
interface Props {
variant?: 'primary' | 'secondary' | 'danger' | 'success' | 'outline'
@@ -41,8 +40,6 @@ defineEmits<{
click: [event: MouseEvent]
}>()
const isDarkMode = useInjectedDarkMode()
const sizeClasses = computed(() => {
const sizes = {
sm: 'min-h-11 px-3 py-2 text-sm sm:min-h-0 sm:py-1.5',
@@ -52,33 +49,5 @@ const sizeClasses = computed(() => {
return sizes[props.size]
})
const variantClasses = computed(() => {
const baseClasses = 'focus:ring-2 focus:ring-offset-2'
if (props.variant === 'primary') {
return `${baseClasses} bg-[#5f8796] text-white shadow-[#9fb8bf]/35 hover:bg-[#527887] focus:ring-[#8fb2bf]`
}
if (props.variant === 'secondary') {
return isDarkMode.value
? `${baseClasses} border border-[#40545c] bg-[#263941] text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#2d4751] focus:ring-[#7199a8]`
: `${baseClasses} border border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:border-[#9db6bd] hover:bg-[#e2ecee] focus:ring-[#8fb2bf]`
}
if (props.variant === 'danger') {
return `${baseClasses} bg-[#dc2626] text-white shadow-[#f87171]/35 hover:bg-[#b91c1c] focus:ring-[#ef4444]`
}
if (props.variant === 'success') {
return `${baseClasses} bg-[#6f9688] text-white shadow-[#aac4ba]/35 hover:bg-[#5f8377] focus:ring-[#92b3a7]`
}
if (props.variant === 'outline') {
return isDarkMode.value
? `${baseClasses} border border-[#40545c] text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#263941] focus:ring-[#7199a8]`
: `${baseClasses} border border-[#c8d8dc] text-[#415d66] hover:border-[#9db6bd] hover:bg-[#edf4f5] focus:ring-[#8fb2bf]`
}
return ''
})
const variantClasses = computed(() => `fcb-button-${props.variant}`)
</script>
+2 -2
View File
@@ -15,7 +15,7 @@
aria-modal="true"
:aria-label="title || t('common.dialog')"
tabindex="-1"
class="relative flex max-h-[calc(100dvh-1.5rem)] transform flex-col overflow-hidden rounded-[24px] shadow-xl transition-all sm:max-h-[calc(100dvh-2rem)] sm:rounded-[30px]"
class="fcb-surface relative flex max-h-[calc(100dvh-1.5rem)] transform flex-col overflow-hidden rounded-[24px] shadow-xl transition-all sm:max-h-[calc(100dvh-2rem)] sm:rounded-[30px]"
:class="[sizeClasses, isDarkMode ? 'bg-gray-800' : 'bg-white']"
@click.stop
@keydown="handleKeydown"
@@ -33,7 +33,7 @@
<button
v-if="closable"
type="button"
class="flex h-11 w-11 shrink-0 items-center justify-center rounded-[30px] transition-colors"
class="fcb-action fcb-icon-action flex h-11 w-11 shrink-0 items-center justify-center rounded-[30px] transition-colors"
:class="[
isDarkMode
? 'text-gray-300 hover:bg-gray-700 hover:text-white'
@@ -6,7 +6,7 @@
@click.self="$emit('close')"
>
<div
class="flex max-h-[88vh] w-full max-w-3xl flex-col overflow-hidden rounded-[24px] bg-opacity-70 p-4 shadow-2xl transform transition-all duration-200 ease-out backdrop-filter backdrop-blur-lg sm:mx-4 sm:rounded-[30px] sm:p-6"
class="fcb-surface flex max-h-[88vh] w-full max-w-3xl flex-col overflow-hidden rounded-[24px] bg-opacity-70 p-4 shadow-2xl transform transition-all duration-200 ease-out backdrop-filter backdrop-blur-lg sm:mx-4 sm:rounded-[30px] sm:p-6"
:class="[isDarkMode ? 'bg-gray-800' : 'bg-white']"
>
<div class="flex justify-between items-center mb-4 flex-shrink-0">
@@ -16,7 +16,7 @@
<div class="flex items-center gap-3">
<button
@click="$emit('copy-content')"
class="inline-flex items-center gap-2 rounded-[30px] px-3 py-1.5 text-sm font-medium transition duration-200 sm:px-4"
class="fcb-action inline-flex items-center gap-2 rounded-[30px] px-3 py-1.5 text-sm font-medium transition duration-200 sm:px-4"
:class="[
isDarkMode
? 'bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white'
@@ -28,7 +28,7 @@
</button>
<button
@click="$emit('close')"
class="rounded-[30px] p-1.5 transition duration-200 hover:bg-opacity-10"
class="fcb-action rounded-[30px] p-1.5 transition duration-200 hover:bg-opacity-10"
:class="[
isDarkMode
? 'text-gray-400 hover:text-white hover:bg-white'
+14 -14
View File
@@ -1,20 +1,20 @@
<template>
<nav
class="mt-4 flex flex-col gap-3 border-t px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6"
:class="[isDarkMode ? 'border-[#31454d]' : 'border-[#c8d7da]']"
class="fcb-pagination mt-3 flex flex-col gap-2 border-t px-3 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-6"
:class="[isDarkMode ? 'border-[#495765]' : 'border-[#c8d7da]']"
:aria-label="t('components.pagination.navigation')"
>
<div class="text-sm" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']">
<div class="text-xs sm:text-sm" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']">
{{ t('components.pagination.range', { start: rangeStart, end: rangeEnd, total }) }}
</div>
<div class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 sm:flex sm:flex-wrap">
<div class="fcb-pagination-controls grid grid-cols-[minmax(0,1fr)_auto_auto_auto] items-center gap-2 sm:flex sm:flex-wrap">
<select
:value="pageSize"
class="col-span-3 min-h-11 rounded-[30px] border px-3 text-sm shadow-sm transition-colors sm:col-auto lg:min-h-9"
class="fcb-page-size min-h-9 rounded-2xl border px-3 text-sm shadow-sm transition-colors lg:min-h-9"
:class="[
isDarkMode
? 'border-[#40545c] bg-[#263941] text-[#d8e3e5] hover:border-[#7199a8]'
? 'border-[#495765] bg-[#2c3440] text-[#d8e3e5] hover:border-[#7199a8]'
: 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:border-[#9db6bd]'
]"
:aria-label="t('components.pagination.pageSize')"
@@ -28,15 +28,15 @@
<button
type="button"
:disabled="currentPage === 1"
class="inline-flex min-h-11 items-center justify-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9"
class="fcb-action fcb-page-nav inline-flex min-h-11 items-center justify-center rounded-2xl px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9"
:class="buttonClass(currentPage === 1)"
@click="$emit('page-change', currentPage - 1)"
>
<ChevronLeftIcon class="h-4 w-4" aria-hidden="true" />
<span class="max-[359px]:sr-only">{{ t('common.previous') }}</span>
<span class="sr-only sm:not-sr-only">{{ t('common.previous') }}</span>
</button>
<span class="text-center text-sm font-medium sm:hidden" :class="[isDarkMode ? 'text-gray-200' : 'text-gray-700']">
<span class="fcb-page-counter text-center text-sm font-medium tabular-nums sm:hidden" :class="[isDarkMode ? 'text-gray-200' : 'text-gray-700']">
{{ currentPage }} / {{ totalPages }}
</span>
@@ -45,12 +45,12 @@
<button
v-if="pageNum !== '...'"
type="button"
class="inline-flex min-h-11 min-w-11 items-center justify-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9 lg:min-w-9"
class="fcb-action inline-flex min-h-11 min-w-11 items-center justify-center rounded-2xl px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9 lg:min-w-9"
:class="[
currentPage === pageNum
? 'bg-[#5f8796] text-white shadow-[#9fb8bf]/35'
: isDarkMode
? 'bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]'
? 'bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]'
: 'bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]'
]"
:aria-label="t('components.pagination.goToPage', { page: pageNum })"
@@ -66,11 +66,11 @@
<button
type="button"
:disabled="currentPage >= totalPages"
class="inline-flex min-h-11 items-center justify-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9"
class="fcb-action fcb-page-nav inline-flex min-h-11 items-center justify-center rounded-2xl px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md lg:min-h-9"
:class="buttonClass(currentPage >= totalPages)"
@click="$emit('page-change', currentPage + 1)"
>
<span class="max-[359px]:sr-only">{{ t('common.next') }}</span>
<span class="sr-only sm:not-sr-only">{{ t('common.next') }}</span>
<ChevronRightIcon class="h-4 w-4" aria-hidden="true" />
</button>
</div>
@@ -121,7 +121,7 @@ const buttonClass = (disabled: boolean) => {
if (isDarkMode.value) {
return disabled
? 'cursor-not-allowed bg-[#223039] text-[#71878d]'
: 'bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]'
: 'bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]'
}
return disabled
? 'cursor-not-allowed bg-[#e8eeee] text-[#7d8d91]'
+3 -3
View File
@@ -1,6 +1,6 @@
<template>
<div
class="data-table-2026 theme-2026-card theme-2026-card-hover overflow-hidden rounded-[30px] shadow-md transition-all duration-300 hover:-translate-y-0.5 hover:shadow-lg"
class="data-table-2026 theme-2026-card fcb-static-container overflow-hidden rounded-[30px] shadow-md transition-all duration-300 hover:shadow-lg"
>
<div
class="border-b px-6 py-4"
@@ -21,7 +21,7 @@
<div class="overflow-x-auto" tabindex="0" role="region" :aria-label="title">
<table
class="divide-y"
:class="[tableClass, isDarkMode ? 'divide-[#31454d]' : 'divide-[#d7e3e5]']"
:class="[tableClass, isDarkMode ? 'divide-[#495765]' : 'divide-[#d7e3e5]']"
>
<caption class="sr-only">{{ title }}</caption>
<thead>
@@ -39,7 +39,7 @@
</thead>
<tbody
class="divide-y"
:class="[isDarkMode ? 'divide-[#31454d]/70' : 'divide-[#d7e3e5]/80']"
:class="[isDarkMode ? 'divide-[#495765]/70' : 'divide-[#d7e3e5]/80']"
>
<slot name="body"></slot>
</tbody>
+6 -6
View File
@@ -1,13 +1,13 @@
<template>
<div class="space-y-3">
<label for="send-expiration-value" class="block text-sm font-medium" :class="isDarkMode ? 'text-gray-300' : 'text-gray-700'">
<div class="space-y-3 fcb-expiration">
<label for="send-expiration-value" class="block text-sm font-semibold" :class="isDarkMode ? 'text-gray-300' : 'text-gray-700'">
{{ t('send.expiration.label') }}
</label>
<div v-if="expirationMethod !== 'forever'" class="grid grid-cols-[2.75rem_minmax(0,1fr)_2.75rem] gap-2">
<button
type="button"
class="flex h-11 w-11 items-center justify-center rounded-xl border text-xl font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-40"
class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-xl border text-xl font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-40"
:class="controlClass"
:disabled="numericValue <= 1"
:aria-label="t('send.expiration.decrement')"
@@ -30,7 +30,7 @@
<button
type="button"
class="flex h-11 w-11 items-center justify-center rounded-xl border text-xl font-semibold transition-colors"
class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-xl border text-xl font-semibold transition-colors"
:class="controlClass"
:aria-label="t('send.expiration.increment')"
@click="incrementValue(1)"
@@ -84,8 +84,8 @@ const isDarkMode = inject('isDarkMode')
const numericValue = computed(() => Math.max(1, Number.parseInt(props.expirationValue) || 1))
const controlClass = computed(() =>
isDarkMode
? 'border-gray-600 bg-gray-800/70 text-gray-100 hover:border-gray-500'
: 'border-gray-300 bg-white text-gray-900 hover:border-gray-400'
? 'border-gray-600 bg-gray-800/70 text-gray-100 hover:border-[#9fc9bd]'
: 'border-[#d7e0e4] bg-[#eef3f5] text-[#405466] shadow-[inset_2px_2px_5px_rgba(167,183,191,.22),inset_-2px_-2px_5px_rgba(255,255,255,.9)] hover:border-[#9fc9bd]'
)
const updateMethod = (event: Event) => {
+3 -3
View File
@@ -6,7 +6,7 @@
@click.self="$emit('close')"
>
<div
class="w-full max-w-md mx-3 overflow-hidden rounded-[24px] shadow-2xl transform transition-all duration-200 ease-out backdrop-filter backdrop-blur-lg sm:mx-4 sm:rounded-[30px]"
class="fcb-surface w-full max-w-md mx-3 overflow-hidden rounded-[24px] shadow-2xl transform transition-all duration-200 ease-out backdrop-filter backdrop-blur-lg sm:mx-4 sm:rounded-[30px]"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white bg-opacity-95']"
>
<h3
@@ -63,7 +63,7 @@
<div v-if="record.filename === 'Text'" class="ml-2">
<button
@click="$emit('preview-content')"
class="rounded-[30px] bg-indigo-600 px-4 py-2 text-white transition duration-200 hover:bg-indigo-700"
class="fcb-action rounded-[30px] bg-indigo-600 px-4 py-2 text-white transition duration-200 hover:bg-indigo-700"
>
{{ t('fileDetail.previewContent') }}
</button>
@@ -98,7 +98,7 @@
<button
@click="$emit('close')"
class="mt-6 w-full rounded-[30px] bg-gradient-to-r from-indigo-500 to-purple-600 px-5 py-3 font-medium text-white transition duration-200 transform hover:scale-[1.01] hover:from-indigo-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 sm:mt-8 sm:px-6"
class="fcb-action mt-6 w-full rounded-[30px] bg-gradient-to-r from-indigo-500 to-purple-600 px-5 py-3 font-medium text-white transition duration-200 transform hover:from-indigo-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 sm:mt-8 sm:px-6"
>
{{ t('common.close') }}
</button>
+6 -6
View File
@@ -7,7 +7,7 @@
<article
v-for="record in records"
:key="record.id"
class="rounded-xl bg-opacity-50 p-4 shadow-md transition duration-200 hover:shadow-lg"
class="fcb-secondary-card rounded-xl bg-opacity-50 p-4 shadow-md transition duration-300 hover:shadow-lg"
:class="[isDarkMode ? 'bg-gray-800 hover:bg-gray-700' : 'bg-gray-100 hover:bg-white']"
>
<div class="flex min-w-0 items-center gap-3">
@@ -18,13 +18,13 @@
</div>
</div>
<div class="mt-3 grid grid-cols-3 gap-2">
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('view-details', record)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('view-details', record)">
<EyeIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('common.fileDetails') }}
</button>
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('download-record', record)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('download-record', record)">
<DownloadIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('fileRecord.download') }}
</button>
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl bg-red-600 px-2 text-xs font-medium text-white hover:bg-red-700" @click="$emit('delete-record', record.id)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl bg-red-600 px-2 text-xs font-medium text-white hover:bg-red-700" @click="$emit('delete-record', record.id)">
<TrashIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('common.delete') }}
</button>
</div>
@@ -47,6 +47,6 @@ const actionClass = computed(() => isDarkMode ? 'bg-gray-700 text-gray-200 hover
</script>
<style scoped>
.list-enter-active, .list-leave-active, .list-move { transition: all 0.24s ease; }
.list-enter-from, .list-leave-to { opacity: 0; transform: translateX(20px); }
.list-enter-active, .list-leave-active, .list-move { transition: opacity 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1); }
.list-enter-from, .list-leave-to { opacity: 0; transform: translateY(-4px); }
</style>
+3 -3
View File
@@ -3,8 +3,8 @@
class="rounded-2xl p-8 flex flex-col items-center justify-center border-2 border-dashed transition-all duration-300 group cursor-pointer relative min-h-72 overflow-hidden"
:class="[
isDarkMode
? 'bg-gray-800/60 border-gray-600 hover:border-indigo-400'
: 'bg-white/80 border-gray-300 hover:border-indigo-500',
? 'bg-gray-800/60 border-gray-600 hover:border-[#9fc9bd]'
: 'bg-[#eef3f5] border-[#cbd7dc] hover:border-[#9fc9bd] shadow-[inset_3px_3px_8px_rgba(167,183,191,.18),inset_-3px_-3px_8px_rgba(255,255,255,.85)]',
isDragActive
? isDarkMode
? 'border-indigo-400 bg-indigo-500/10 shadow-lg shadow-indigo-900/30'
@@ -113,7 +113,7 @@
v-if="hasError && allowRetry"
type="button"
@click.stop="handleRetry"
class="mt-3 min-h-11 rounded-lg px-4 py-2 text-sm transition-colors duration-200"
class="fcb-action mt-3 min-h-11 rounded-lg px-4 py-2 text-sm transition-colors duration-200"
:class="[
isDarkMode
? 'bg-indigo-600 hover:bg-indigo-500 text-white'
+2 -2
View File
@@ -1,6 +1,6 @@
<template>
<div ref="switcherRef" class="relative">
<button
<button class="fcb-action"
type="button"
@click="toggleDropdown"
:class="[
@@ -42,7 +42,7 @@
]"
>
<div class="py-1">
<button
<button class="fcb-action"
v-for="language in availableLocales"
:key="language.code"
type="button"
+39 -126
View File
@@ -1,5 +1,7 @@
<template>
<div class="native-date-strip" :class="fieldClass" :aria-label="ariaLabel">
<div class="native-date-field" :class="fieldClass" role="group" :aria-label="ariaLabel">
<span class="native-date-label"><CalendarDaysIcon aria-hidden="true" />{{ ariaLabel }}</span>
<div class="native-date-strip">
<select
:value="parts.year"
class="native-date-part native-date-year"
@@ -55,10 +57,12 @@
</select>
</template>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { CalendarDaysIcon } from 'lucide-vue-next'
const props = withDefaults(
defineProps<{
@@ -132,140 +136,49 @@ const updatePart = (part: DatePart, value: string) => {
</script>
<style scoped>
.native-date-strip {
display: inline-flex;
width: var(--native-date-width, max-content);
.native-date-field {
min-width: 0;
max-width: 100%;
min-height: 2.75rem;
align-items: center;
display: inline-flex;
flex-direction: column;
justify-content: center;
gap: 0;
padding-inline: 0.65ch;
border: 1px solid transparent;
border-radius: 30px;
background: rgba(237, 244, 245, 0.52);
color: #2d4650;
font-variant-numeric: tabular-nums;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
transition:
background 180ms ease,
border-color 180ms ease,
box-shadow 180ms ease,
transform 180ms ease;
gap: 3px;
padding: 8px 10px;
border: 1px solid var(--fcb-border);
border-radius: 16px;
background: var(--fcb-surface);
color: var(--fcb-text);
box-shadow: 0 3px 9px rgb(107 132 146 / 10%);
transition: border-color 300ms ease, box-shadow 300ms ease;
}
.native-date-strip:hover,
.native-date-strip:focus-within {
border-color: rgba(143, 178, 191, 0.7);
background: rgba(226, 236, 238, 0.78);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.72),
0 10px 24px rgba(126, 149, 154, 0.16);
}
.native-date-strip:focus-within {
transform: translateY(-1px);
}
.native-date-field:focus-within { border-color: var(--fcb-primary); box-shadow: 0 0 0 2px rgb(143 175 191 / 25%); }
.native-date-label { display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 1.4; color: var(--fcb-text-muted); }
.native-date-label svg { width: 13px; height: 13px; }
.native-date-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-variant-numeric: tabular-nums; }
.native-date-part {
height: 2.65rem;
appearance: none;
border: 0;
border-radius: 0;
background: transparent;
color: inherit;
cursor: pointer;
min-width: 0;
min-height: 28px;
border: 0 !important;
border-radius: 6px;
background: transparent !important;
color: inherit !important;
box-shadow: none !important;
padding: 0;
cursor: pointer;
text-align: center;
font-size: 0.95rem;
font-size: 14px;
font-weight: 600;
line-height: 1;
outline: none;
line-height: 1.4;
}
.native-date-part:focus-visible {
border-radius: 999px;
box-shadow: 0 0 0 2px rgba(143, 178, 191, 0.58);
}
.native-date-year {
width: 4.2ch;
}
.native-date-month,
.native-date-day,
.native-date-time {
width: 2.2ch;
}
.native-date-time-spacer {
width: 0.9ch;
flex: 0 0 auto;
}
.native-date-separator {
margin-inline: 0.35ch;
color: #789096;
font-size: 0.95rem;
line-height: 1;
opacity: 0.78;
pointer-events: none;
}
.native-date-part:focus-visible { outline: 2px solid var(--fcb-primary); outline-offset: 1px; }
.native-date-year { width: 4.5ch; }
.native-date-month, .native-date-day, .native-date-time { width: 2.6ch; }
.native-date-separator { color: var(--fcb-text-muted); font-size: 12px; }
.native-date-time-spacer { width: 6px; }
@media (max-width: 639px) {
:global(.analytics-date-range) {
--native-date-width: auto;
display: flex !important;
width: 100%;
flex-wrap: nowrap !important;
gap: 0.2rem !important;
}
.native-date-strip {
width: min-content;
min-width: 0;
flex: 1 1 0;
min-height: 2.75rem;
padding-inline: 0.2rem;
}
.native-date-part {
height: 2.75rem;
min-width: 0;
font-size: clamp(0.75rem, 3.4vw, 0.9rem);
}
.native-date-year {
width: clamp(3.35rem, 15vw, 4rem);
}
.native-date-month,
.native-date-day {
width: clamp(1.7rem, 8vw, 2.2rem);
}
.native-date-separator {
margin-inline: 0;
font-size: clamp(0.72rem, 3vw, 0.85rem);
}
}
.dark .native-date-strip {
background: rgba(38, 57, 65, 0.62);
color: #d8e3e5;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.dark .native-date-strip:hover,
.dark .native-date-strip:focus-within {
border-color: rgba(113, 153, 168, 0.72);
background: rgba(45, 71, 81, 0.76);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.1),
0 10px 24px rgba(4, 10, 14, 0.28);
}
.dark .native-date-separator {
color: #aabdc2;
.native-date-field { padding: 7px 8px; border-radius: 14px; }
.native-date-strip { gap: 1px; }
.native-date-part { font-size: clamp(12px, 3.2vw, 14px); }
}
</style>
+3 -3
View File
@@ -3,7 +3,7 @@
<div class="mb-6 text-center" v-if="linkText && linkTo">
<router-link
:to="linkTo"
class="inline-flex min-h-11 items-center rounded-lg px-3 text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#294047]"
class="fcb-action inline-flex min-h-11 items-center rounded-lg px-3 text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#333d49]"
>
{{ linkText }}
</router-link>
@@ -23,7 +23,7 @@
<div class="flex items-center gap-2 sm:gap-4">
<router-link
to="/login"
class="flex h-11 w-11 items-center justify-center rounded-lg text-sm transition duration-200 hover:bg-[#dcebed] dark:hover:bg-[#294047]"
class="flex h-11 w-11 items-center justify-center rounded-lg text-sm transition duration-200 hover:bg-[#dcebed] dark:hover:bg-[#333d49]"
:aria-label="t('manage.login.title')"
:title="t('manage.login.title')"
:class="[
@@ -37,7 +37,7 @@
<button
type="button"
@click="$emit('toggle-drawer')"
class="flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-[#dcebed] dark:hover:bg-[#294047]"
class="fcb-action flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-[#dcebed] dark:hover:bg-[#333d49]"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
>
{{ drawerText }}
+1 -1
View File
@@ -12,7 +12,7 @@
<button
type="button"
@click="$emit('title-click')"
class="mb-6 min-h-11 rounded-lg px-2 text-center text-3xl font-extrabold focus:outline-none focus:ring-2 focus:ring-indigo-500"
class="fcb-action fcb-content-action mb-6 min-h-11 rounded-lg px-2 text-center text-xl sm:text-3xl font-extrabold focus:outline-none focus:ring-2 focus:ring-indigo-500"
:class="[
isDarkMode
? 'text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300'
+1 -4
View File
@@ -45,7 +45,7 @@
</div>
<button
type="submit"
class="group relative w-full overflow-hidden rounded-lg bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 px-4 py-3 font-bold text-white transition duration-300 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-50 motion-safe:hover:scale-[1.02] disabled:hover:scale-100"
class="fcb-action fcb-button-primary group relative w-full overflow-hidden rounded-lg bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 px-4 py-3 font-bold text-white transition duration-300 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-50 motion-safe:disabled:hover:scale-100"
:disabled="inputStatus.loading || code.trim().length !== 5"
>
<span class="flex items-center justify-center relative z-10">
@@ -54,9 +54,6 @@
class="w-5 h-5 ml-2 transition-transform duration-300 transform group-hover:translate-x-1"
/>
</span>
<span
class="absolute top-0 left-0 w-full h-full bg-gradient-to-r from-pink-500 via-purple-500 to-indigo-500 opacity-0 group-hover:opacity-100 transition-opacity duration-300"
></span>
</button>
</form>
</template>
+8 -8
View File
@@ -1,29 +1,29 @@
<template>
<div class="flex justify-center space-x-4 mb-6">
<button
<button class="fcb-action"
type="button"
@click="selectType('file')"
:class="[
'min-h-11 px-4 py-2 rounded-lg transition-colors duration-300',
'min-h-11 px-4 py-2 rounded-xl transition-colors duration-300',
selectedType === 'file'
? 'bg-indigo-600 text-white'
? 'bg-[#7198a6] text-white shadow-[inset_2px_2px_5px_rgba(255,255,255,.22),0_8px_16px_rgba(113,152,166,.24)]'
: isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
: 'bg-[#e8eef0] text-[#405466] shadow-[inset_2px_2px_5px_rgba(167,183,191,.18),inset_-2px_-2px_5px_rgba(255,255,255,.9)] hover:bg-[#dfe9eb]'
]"
>
{{ t('nav.sendFile') }}
</button>
<button
<button class="fcb-action"
type="button"
@click="selectType('text')"
:class="[
'min-h-11 px-4 py-2 rounded-lg transition-colors duration-300',
'min-h-11 px-4 py-2 rounded-xl transition-colors duration-300',
selectedType === 'text'
? 'bg-indigo-600 text-white'
? 'bg-[#7198a6] text-white shadow-[inset_2px_2px_5px_rgba(255,255,255,.22),0_8px_16px_rgba(113,152,166,.24)]'
: isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
: 'bg-[#e8eef0] text-[#405466] shadow-[inset_2px_2px_5px_rgba(167,183,191,.18),inset_-2px_-2px_5px_rgba(255,255,255,.9)] hover:bg-[#dfe9eb]'
]"
>
{{ t('send.sendText') }}
@@ -5,7 +5,7 @@
class="fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-3 backdrop-blur-sm sm:p-4"
>
<div
class="w-full max-w-2xl overflow-hidden rounded-[24px] shadow-2xl transform transition-all duration-200 ease-out sm:rounded-[30px]"
class="fcb-surface w-full max-w-2xl overflow-hidden rounded-[24px] shadow-2xl transform transition-all duration-200 ease-out sm:rounded-[30px]"
:class="[isDarkMode ? 'bg-gray-900 bg-opacity-70' : 'bg-white bg-opacity-95']"
>
<div
@@ -21,7 +21,7 @@
</h3>
<button
@click="$emit('close')"
class="rounded-[30px] p-1.5 transition-colors hover:bg-gray-100 dark:hover:bg-gray-800 sm:p-2"
class="fcb-action rounded-[30px] p-1.5 transition-colors hover:bg-gray-100 dark:hover:bg-gray-800 sm:p-2"
>
<XIcon
class="w-4 h-4 sm:w-5 sm:h-5"
@@ -93,7 +93,7 @@
<h4 class="font-medium text-sm sm:text-base">取件码</h4>
<button
@click="$emit('copy-code', record)"
class="p-1.5 sm:p-2 rounded-full hover:bg-white/10 transition-colors"
class="fcb-action p-1.5 sm:p-2 rounded-full hover:bg-white/10 transition-colors"
>
<ClipboardCopyIcon class="w-4 h-4 sm:w-5 sm:h-5" />
</button>
@@ -117,7 +117,7 @@
</h4>
<button
@click="$emit('copy-wget', record)"
class="p-1.5 sm:p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex-shrink-0"
class="fcb-action p-1.5 sm:p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex-shrink-0"
>
<ClipboardCopyIcon
class="w-4 h-4 sm:w-5 sm:h-5"
@@ -157,7 +157,7 @@
>
<button
@click="$emit('copy-link', record)"
class="w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 sm:px-6 py-2 sm:py-3 rounded-lg text-sm sm:text-base font-medium transition-colors"
class="fcb-action w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 sm:px-6 py-2 sm:py-3 rounded-lg text-sm sm:text-base font-medium transition-colors"
>
复制取件链接
</button>
+6 -6
View File
@@ -7,7 +7,7 @@
<article
v-for="record in records"
:key="record.id"
class="rounded-xl bg-opacity-50 p-4 shadow-md transition duration-200 hover:shadow-lg"
class="fcb-secondary-card rounded-xl bg-opacity-50 p-4 shadow-md transition duration-300 hover:shadow-lg"
:class="[isDarkMode ? 'bg-gray-800 hover:bg-gray-700' : 'bg-gray-100 hover:bg-white']"
>
<div class="flex min-w-0 items-center gap-3">
@@ -22,13 +22,13 @@
</div>
</div>
<div class="mt-3 grid grid-cols-3 gap-2">
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('copy-link', record)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('copy-link', record)">
<ClipboardCopyIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('common.copy') }}
</button>
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('view-details', record)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl px-2 text-xs font-medium" :class="actionClass" @click="$emit('view-details', record)">
<EyeIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('common.fileDetails') }}
</button>
<button type="button" class="flex min-h-11 items-center justify-center rounded-xl bg-red-600 px-2 text-xs font-medium text-white hover:bg-red-700" @click="$emit('delete-record', record.id)">
<button type="button" class="fcb-action flex min-h-11 items-center justify-center rounded-xl bg-red-600 px-2 text-xs font-medium text-white hover:bg-red-700" @click="$emit('delete-record', record.id)">
<TrashIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />{{ t('common.delete') }}
</button>
</div>
@@ -51,6 +51,6 @@ const actionClass = computed(() => isDarkMode ? 'bg-gray-700 text-gray-200 hover
</script>
<style scoped>
.list-enter-active, .list-leave-active { transition: all 0.24s ease; }
.list-enter-from, .list-leave-to { opacity: 0; transform: translateX(20px); }
.list-enter-active, .list-leave-active { transition: opacity 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1); }
.list-enter-from, .list-leave-to { opacity: 0; transform: translateY(-4px); }
</style>
+1 -1
View File
@@ -14,7 +14,7 @@
>
<span
class="relative inline-flex h-6 w-11 rounded-full border-2 border-transparent shadow-sm transition-colors duration-200"
:class="modelValue === 1 ? 'bg-[#6f9688]' : isDarkMode ? 'bg-[#40545c]' : 'bg-[#cfdadc]'"
:class="modelValue === 1 ? 'bg-[#6f9688]' : isDarkMode ? 'bg-[#495765]' : 'bg-[#cfdadc]'"
aria-hidden="true"
>
<span
+1 -1
View File
@@ -27,7 +27,7 @@
</h3>
<button
type="button"
class="flex h-11 w-11 items-center justify-center rounded-lg transition duration-200"
class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-lg transition duration-200"
:class="[isDarkMode ? 'text-gray-300 hover:bg-gray-800 hover:text-white' : 'text-gray-700 hover:bg-gray-100']"
:aria-label="t('common.close')"
:title="t('common.close')"
+10 -4
View File
@@ -31,8 +31,12 @@
</template>
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import type { AnalyticsDailyRow } from '@/types'
import { summarizeAnalyticsWindow, type AnalyticsWindowTotals } from '@/utils/analyticsWindow'
const { t } = useI18n()
const props = defineProps<{
rows: AnalyticsDailyRow[]
@@ -41,6 +45,7 @@ const props = defineProps<{
const emit = defineEmits<{
windowChange: [text: string]
windowStats: [stats: AnalyticsWindowTotals]
}>()
type DragState = {
@@ -115,12 +120,12 @@ const formatAxisTick = (value: number) => {
const panelClass = computed(() =>
props.isDarkMode
? 'border-[#40545c] bg-[linear-gradient(135deg,rgba(34,49,56,0.96),rgba(24,35,42,0.92))] shadow-md shadow-black/25'
? 'border-[#495765] bg-[#2c3440] shadow-md shadow-[#97aac8]/15'
: 'border-[#d4e0e3] bg-[linear-gradient(135deg,#f8fbfb,#edf5f6)] shadow-md shadow-[#a9bdc2]/35'
)
const tooltipClass = computed(() =>
props.isDarkMode
? 'border-[#40545c] bg-[#203039] text-[#eef5f5]'
? 'border-[#495765] bg-[#2c3440] text-[#eef5f5]'
: 'border-[#c9d9dd] bg-[#fbfdfd] text-[#263f48]'
)
@@ -310,9 +315,10 @@ const draw = (timestamp = performance.now()) => {
emit(
'windowChange',
total
? `${Math.floor(offset.value) + 1}-${Math.min(total, Math.ceil(offset.value + windowSize.value))} / ${total}`
: '无数据'
? t('admin.dashboard.trend.windowDays', { start: Math.floor(offset.value) + 1, end: Math.min(total, Math.ceil(offset.value + windowSize.value)), total })
: t('admin.dashboard.trend.noData')
)
emit('windowStats', summarizeAnalyticsWindow(props.rows, offset.value, windowSize.value))
if (hoverX.value !== null && points.length && total) {
const hoverRatio = clamp((hoverX.value - padLeft) / width, 0, 1)
+9 -10
View File
@@ -1,26 +1,24 @@
<template>
<div
class="theme-2026-card theme-2026-card-hover group rounded-[24px] p-4 shadow-md transition-all duration-300 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-6"
class="theme-2026-card theme-2026-card-hover fcb-stat-card group rounded-[24px] p-3 sm:p-4 shadow-md transition-all duration-300 hover:shadow-lg sm:rounded-[30px] sm:p-6"
:class="[
isDarkMode
? 'hover:bg-gray-800 hover:shadow-black/20'
? 'hover:bg-gray-800 hover:shadow-[#97aac8]/15'
: 'hover:shadow-gray-200/80'
]"
>
<div class="flex items-center justify-between gap-3">
<div class="relative">
<div class="min-w-0">
<p class="line-clamp-2 text-xs leading-tight sm:text-sm" :title="title" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']">
<p class="line-clamp-2 pr-9 text-xs leading-tight sm:text-sm" :title="title" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']">
{{ title }}
</p>
<h3 class="mt-1 whitespace-nowrap text-lg font-bold leading-tight tabular-nums sm:text-2xl" :title="String(value)" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
{{ value }}
</h3>
<AdaptiveValue :value="value" class="mt-3 font-bold leading-tight" :class="isDarkMode ? 'text-white' : 'text-gray-800'" />
</div>
<div
class="shrink-0 rounded-full p-2.5 transition-transform duration-300 group-hover:scale-105 sm:p-3"
class="absolute right-0 top-0 rounded-full p-1.5 transition-transform duration-300"
:class="iconBgClass"
>
<component :is="icon" class="h-5 w-5 sm:h-6 sm:w-6" :class="iconClass" aria-hidden="true" />
<component :is="icon" class="h-4 w-4 sm:h-5 sm:w-5" :class="iconClass" aria-hidden="true" />
</div>
</div>
<p class="mt-2 line-clamp-2 text-xs sm:text-sm" :class="descriptionClass">
@@ -31,6 +29,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import AdaptiveValue from './AdaptiveValue.vue'
import type { Component } from 'vue'
import { useInjectedDarkMode } from '@/composables'
@@ -50,7 +49,7 @@ const isDarkMode = useInjectedDarkMode()
const iconBgClass = computed(() => {
const colorMap = {
indigo: isDarkMode.value ? 'bg-[#294047]' : 'bg-[#dcebed]',
indigo: isDarkMode.value ? 'bg-[#333d49]' : 'bg-[#dcebed]',
purple: isDarkMode.value ? 'bg-[#443d4b]' : 'bg-[#e7e2ea]',
green: isDarkMode.value ? 'bg-[#31564f]' : 'bg-[#e1eee8]',
blue: isDarkMode.value ? 'bg-[#2d4851]' : 'bg-[#dce8eb]'
+2 -2
View File
@@ -16,12 +16,12 @@ const toggleColorMode = () => {
<button
type="button"
@click="toggleColorMode"
class="flex h-11 w-11 items-center justify-center rounded-full shadow-sm transition-all duration-200 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-[#8fb2bf] focus:ring-offset-2 motion-safe:hover:rotate-180"
class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-full shadow-sm transition-all duration-200 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-[#8fb2bf] focus:ring-offset-2 motion-safe:hover:rotate-180"
:aria-label="isDarkMode ? t('common.switchToLight') : t('common.switchToDark')"
:title="isDarkMode ? t('common.switchToLight') : t('common.switchToDark')"
:class="
isDarkMode
? 'bg-[#263941] text-[#d8c98e]'
? 'bg-[#2c3440] text-[#d8c98e]'
: 'bg-[#edf4f5] text-[#4f6c75]'
"
>
+79
View File
@@ -0,0 +1,79 @@
<template>
<div class="trash-item-info min-w-0" :class="{ 'trash-item-info--dark': isDarkMode }">
<div class="flex min-w-0 items-start gap-3">
<div class="trash-file-icon flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl" :class="`trash-tone-${info.tone}`">
<component :is="item.isTrashPurged ? FileX2Icon : item.text != null ? FileTextIcon : FileIcon" class="h-5 w-5" aria-hidden="true" />
</div>
<div class="min-w-0 flex-1">
<div class="flex flex-wrap items-center gap-x-2.5 gap-y-1.5">
<p class="trash-file-name min-w-0 text-sm font-semibold leading-6 sm:text-base">{{ name }}</p>
<span class="trash-state shrink-0 rounded-full border px-2.5 py-0.5 text-xs font-medium" :class="`trash-tone-${info.tone}`">{{ info.state }}</span>
<span class="trash-reason-tag shrink-0 rounded-full px-2.5 py-0.5 text-xs" :class="item.trashReason === 'manual' ? 'trash-reason-manual' : item.trashReason === 'batch_delete' ? 'trash-tone-permanent' : 'trash-tone-warning'" :title="`移入原因:${info.reason}`">{{ info.reason }}</span>
</div>
</div>
</div>
<div class="trash-detail-grid mt-3">
<dl v-for="field in fields" :key="field.label" class="trash-detail-card theme-2026-card-hover fcb-secondary-card min-w-0 rounded-2xl border px-3 py-2.5">
<dt class="trash-time-label text-xs leading-5">{{ field.label }}</dt>
<dd class="mt-1 break-words text-xs font-medium leading-5 tabular-nums" :class="field.mono ? 'font-mono tracking-wide' : ''" :title="field.title">{{ field.value }}</dd>
<span v-if="field.reminder" class="trash-remaining mt-1 inline-block rounded-full px-2 py-0.5 text-[11px]" :class="`trash-tone-${info.tone}`">{{ field.reminder }}</span>
</dl>
<div v-if="$slots.actions" class="trash-item-actions"><slot name="actions" /></div>
</div>
<p v-if="info.note" class="trash-time-label mt-3 text-xs leading-5">{{ info.note }}</p>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { FileIcon, FileTextIcon, FileX2Icon } from 'lucide-vue-next'
import type { TrashFileItem } from '@/types'
import { formatFileSize } from '@/utils/common'
import { formatTrashTime, getTrashPresentation } from '@/utils/trashPresentation'
const props = defineProps<{ item: TrashFileItem; isDarkMode: boolean; now: number }>()
const info = computed(() => getTrashPresentation(props.item, props.now))
const name = computed(() => props.item.name || `${props.item.prefix || ''}${props.item.suffix || ''}` || '未命名文件')
const sizeText = computed(() => {
const size = Number(props.item.size)
return Number.isFinite(size) && size >= 0 ? formatFileSize(size, 1) : '未记录'
})
const fields = computed(() => [
{ label: '原取件码', value: props.item.code || '未记录', mono: true },
{ label: '文件大小', value: sizeText.value },
{ label: '移入时间', value: formatTrashTime(props.item.trashedAt, props.now), title: formatTrashTime(props.item.trashedAt) },
{ label: info.value.timeLabel, value: info.value.timeText, reminder: info.value.reminder,
title: props.item.isTrashPermanent && !props.item.isTrashPurged ? undefined : formatTrashTime(props.item.isTrashPurged ? props.item.trashPurgedAt : props.item.trashExpiresAt) }
])
</script>
<style scoped>
.trash-item-info { container-type: inline-size; container-name: trash-record; color: #294851; --trash-muted: #617980; --trash-line: #d7e3e5; --trash-surface: #edf3f6; }
.trash-item-info--dark { color: #dbe9ee; --trash-muted: #a9bdc2; --trash-line: #495765; --trash-surface: #303946; }
.trash-file-name { overflow-wrap: anywhere; }
.trash-file-meta dt, .trash-time-label { color: var(--trash-muted); }
.trash-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trash-detail-card { margin: 0; min-height: 72px; background: var(--trash-surface) !important; border-color: var(--trash-line) !important; }
.trash-item-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: center; grid-column: 1 / -1; }
@container trash-record (min-width: 620px) {
.trash-detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trash-item-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; grid-column: 1 / -1; }
}
@container trash-record (min-width: 1000px) {
.trash-detail-grid { grid-template-columns: minmax(100px,125px) minmax(90px,110px) minmax(100px,130px) minmax(140px,180px) minmax(400px,1fr); align-items: center; gap: 10px; }
.trash-item-actions { grid-column: auto; align-items: center; }
}
.trash-item-actions :deep(button) { white-space: nowrap; }
.trash-detail-grid .trash-detail-card:hover { transform: translateY(-2px) !important; }
@media (prefers-reduced-motion: reduce), (hover: none) { .trash-detail-grid .trash-detail-card:hover { transform: none !important; } }
.trash-state { border-color: var(--trash-line); }
.trash-tone-normal { background: #e4f0ed; color: #355e56; }
.trash-tone-warning { background: #fff0d8; color: #885512; }
.trash-tone-permanent { background: #eeebf8; color: #62528e; }
.trash-tone-muted { background: #e8edef; color: #596b73; }
.trash-item-info--dark .trash-tone-normal { background: #29473f; color: #c0e5d8; }
.trash-item-info--dark .trash-tone-warning { background: #514026; color: #f5d599; }
.trash-item-info--dark .trash-tone-permanent { background: #3e3556; color: #ddd2f6; }
.trash-item-info--dark .trash-tone-muted { background: #344249; color: #bbc9cf; }
.trash-reason-manual { background: var(--fcb-button-primary-bg); color: var(--fcb-button-primary-text); }
</style>
+6 -4
View File
@@ -1,5 +1,5 @@
import { TrashService } from '@/services'
import type { TrashListParams, TrashListResponse } from '@/types'
import type { TrashListParams, TrashListResponse, TrashRetentionRequest, TrashBatchRequest } from '@/types'
export function useAdminTrash() {
const fetchTrash = async (params: TrashListParams): Promise<TrashListResponse | null> => {
@@ -9,8 +9,10 @@ export function useAdminTrash() {
const restoreTrashItem = async (id: number) => TrashService.restore(id)
const purgeTrashItem = async (id: number) => TrashService.purge(id)
const updateTrashRetention = async (id: number, retentionDays: number) =>
TrashService.updateRetention(id, retentionDays)
const updateTrashRetention = async (id: number, retention: TrashRetentionRequest) =>
TrashService.updateRetention(id, retention)
return { fetchTrash, restoreTrashItem, purgeTrashItem, updateTrashRetention }
const batchTrash = (request: TrashBatchRequest) => TrashService.batch(request)
return { batchTrash, fetchTrash, restoreTrashItem, purgeTrashItem, updateTrashRetention }
}
+6 -2
View File
@@ -135,6 +135,10 @@ export default {
history: 'Historical'
},
trend: {
windowDays: 'Days {start}–{end} of {total}',
downloadTotal: 'Period downloads',
uploadTotal: 'Period uploads',
times: '{count} times',
title: 'Download / Upload Trend',
mobileHint: 'Tap or slide to inspect; drag the bottom date axis to pan',
startDate: 'Start date',
@@ -519,7 +523,7 @@ export default {
selectFile: 'Select {name}',
clearSelection: 'Clear Selection',
batchDelete: 'Batch Delete',
batchDeleteConfirm: 'Delete the selected {count} files? This action cannot be undone.',
batchDeleteConfirm: 'Move the selected {count} files to the recycle bin? You can restore them from the recycle bin.',
batchDeleteSuccess: 'Deleted {count} files',
batchDeletePartialSuccess: 'Deleted {count} files, {failed} failed',
batchDeleteFailed: 'Batch delete failed',
@@ -919,7 +923,7 @@ export default {
},
updateFailed: 'Update failed',
deleteFailed: 'Delete failed',
deleteConfirm: 'Delete this file? This action cannot be undone.',
deleteConfirm: 'Move this file to the recycle bin? You can restore it from the recycle bin.',
loadFileListFailed: 'Failed to load file list'
},
login: {
+8 -4
View File
@@ -135,6 +135,10 @@ export default {
history: '历史'
},
trend: {
windowDays: '显示第 {start}–{end} 天,共 {total} 天',
downloadTotal: '期间下载',
uploadTotal: '期间上传',
times: '{count} 次',
title: '下载/上传趋势',
mobileHint: '轻触或滑动查看数据;拖动底部日期轴平移图表',
startDate: '开始日期',
@@ -244,14 +248,14 @@ export default {
retrieve: {
title: '文件取件',
codeInput: {
placeholder: '请输入5位取件码',
placeholder: '请输入取件码',
label: '取件码'
},
submit: '取件',
needSendFile: '需要发送文件?点击这里',
recordsDrawer: '取件记录',
messages: {
invalidCode: '请输入5位取件码',
invalidCode: '请输入取件码',
retrieveSuccess: '文件获取成功',
invalidCodeError: '无效的取件码',
retrieveFailure: '获取文件失败:',
@@ -516,7 +520,7 @@ export default {
selectFile: '选择 {name}',
clearSelection: '清空选择',
batchDelete: '批量删除',
batchDeleteConfirm: '确认删除选中的 {count} 个文件?此操作不可撤销。',
batchDeleteConfirm: '确认将选中的 {count} 个文件移入回收站?移入后可在回收站中恢复。',
batchDeleteSuccess: '已删除 {count} 个文件',
batchDeletePartialSuccess: '已删除 {count} 个文件,{failed} 个失败',
batchDeleteFailed: '批量删除失败',
@@ -879,7 +883,7 @@ export default {
},
updateFailed: '更新失败',
deleteFailed: '删除失败',
deleteConfirm: '确认删除这个文件?此操作不可撤销。',
deleteConfirm: '确认将这个文件移入回收站?移入后可在回收站中恢复。',
loadFileListFailed: '加载文件列表失败'
},
systemSettings: {
+10 -10
View File
@@ -1,7 +1,7 @@
<template>
<div
class="flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
:class="[isDarkMode ? 'bg-[#10191e]' : 'bg-[#dfe9eb]']"
:class="[isDarkMode ? 'bg-[#252b34]' : 'bg-[#dfe9eb]']"
>
<button
v-if="isSidebarOpen"
@@ -17,7 +17,7 @@
class="fixed inset-y-0 left-0 z-50 flex h-full w-64 shrink-0 transform flex-col border-r shadow-2xl lg:relative lg:h-screen lg:translate-x-0 lg:shadow-none"
:class="[
isDarkMode
? 'border-[#3d555f] bg-[#18282f]'
? 'border-[#495765] bg-[#272e38]'
: 'border-[#b8cbd0] bg-[#f9fcfc]',
isSidebarOpen ? 'translate-x-0' : '-translate-x-full',
'transition-transform duration-300 ease-in-out lg:transition-none'
@@ -26,13 +26,13 @@
<!-- Logo区域 -->
<div
class="flex items-center justify-between h-16 px-4 border-b"
:class="[isDarkMode ? 'border-[#3d555f]' : 'border-[#c8d7da]']"
:class="[isDarkMode ? 'border-[#495765]' : 'border-[#c8d7da]']"
>
<div class="flex items-center">
<div
class="rounded-full bg-gradient-to-r from-[#6f98a6] via-[#8eaaa8] to-[#b7b2a1] p-1 animate-spin-slow"
>
<div class="rounded-full p-1" :class="[isDarkMode ? 'bg-[#18282f]' : 'bg-white']">
<div class="rounded-full p-1" :class="[isDarkMode ? 'bg-[#272e38]' : 'bg-white']">
<BoxIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-[#b9dbe2]' : 'text-[#356b7d]']"
@@ -47,7 +47,7 @@
{{ t('common.appName') }}
</h1>
</div>
<button type="button" :aria-label="t('common.closeMenu')" :title="t('common.closeMenu')" @click="closeSidebar" class="flex h-11 w-11 items-center justify-center rounded-lg transition-colors lg:hidden" :class="[isDarkMode ? 'hover:bg-[#294047]' : 'hover:bg-[#e5eff1]']">
<button type="button" :aria-label="t('common.closeMenu')" :title="t('common.closeMenu')" @click="closeSidebar" class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-lg transition-colors lg:hidden" :class="[isDarkMode ? 'hover:bg-[#333d49]' : 'hover:bg-[#e5eff1]']">
<XIcon class="w-6 h-6" :class="[isDarkMode ? 'text-[#d7e6e9]' : 'text-[#294b56]']" />
</button>
</div>
@@ -78,10 +78,10 @@
</nav>
<!-- 退出登录按钮 -->
<div class="p-4 border-t" :class="[isDarkMode ? 'border-[#3d555f]' : 'border-[#c8d7da]']">
<div class="p-4 border-t" :class="[isDarkMode ? 'border-[#495765]' : 'border-[#c8d7da]']">
<button
@click="handleLogout"
class="flex min-h-11 w-full items-center rounded-lg p-2 transition-colors duration-200"
class="fcb-action flex min-h-11 w-full items-center rounded-lg p-2 transition-colors duration-200"
:class="[
isDarkMode
? 'text-[#d0dee1] hover:bg-[#223942] hover:text-white'
@@ -99,10 +99,10 @@
<!-- Header -->
<header
class="h-14 border-b shadow-md transition-colors duration-300 lg:hidden"
:class="[isDarkMode ? 'bg-[#1a2930] border-[#31454d]' : 'bg-[#f2f6f5] border-[#c8d7da]']"
:class="[isDarkMode ? 'bg-[#2c3440] border-[#495765]' : 'bg-[#f2f6f5] border-[#c8d7da]']"
>
<div class="flex h-14 items-center justify-between px-4">
<button ref="menuButtonRef" type="button" :aria-label="t('common.openMenu')" :title="t('common.openMenu')" :aria-expanded="isSidebarOpen" @click="openSidebar" class="flex h-11 w-11 items-center justify-center rounded-lg lg:hidden">
<button ref="menuButtonRef" type="button" :aria-label="t('common.openMenu')" :title="t('common.openMenu')" :aria-expanded="isSidebarOpen" @click="openSidebar" class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center rounded-lg lg:hidden">
<MenuIcon class="w-6 h-6" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
</button>
</div>
@@ -111,7 +111,7 @@
<!-- Content -->
<main
class="min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
:class="[isDarkMode ? 'bg-[#10191e]' : 'bg-[#dfe9eb]']"
:class="[isDarkMode ? 'bg-[#252b34]' : 'bg-[#dfe9eb]']"
>
<router-view />
</main>
+6 -3
View File
@@ -1,5 +1,5 @@
import api from './client'
import type { ApiResponse, TrashListParams, TrashListResponse } from '@/types'
import type { ApiResponse, TrashListParams, TrashListResponse, TrashRetentionRequest, TrashBatchRequest, TrashBatchResult } from '@/types'
export class TrashService {
static async list(params: TrashListParams): Promise<ApiResponse<TrashListResponse>> {
@@ -14,7 +14,10 @@ export class TrashService {
return api.delete('/admin/trash/purge', { data: { id } })
}
static async updateRetention(id: number, retentionDays: number): Promise<ApiResponse> {
return api.post('/admin/trash/retention', { id, retentionDays })
static async updateRetention(id: number, retention: TrashRetentionRequest): Promise<ApiResponse> {
return api.post('/admin/trash/retention', { id, ...retention })
}
static async batch(request: TrashBatchRequest): Promise<ApiResponse<TrashBatchResult>> {
return api.post('/admin/trash/batch', request)
}
}
+356
View File
@@ -0,0 +1,356 @@
{
"colors": {
"blue": {
"50": "#f5f8fa",
"100": "#e7eff3",
"200": "#d0dee7",
"300": "#b3c9d6",
"400": "#8facbc",
"500": "#5b798b",
"600": "#49616e",
"700": "#3c4e58",
"800": "#303d45",
"900": "#263036",
"950": "#1a2023"
},
"indigo": {
"50": "#f5f8fa",
"100": "#e7eff3",
"200": "#d0dee7",
"300": "#b3c9d6",
"400": "#8facbc",
"500": "#5b798b",
"600": "#49616e",
"700": "#3c4e58",
"800": "#303d45",
"900": "#263036",
"950": "#1a2023"
},
"sky": {
"50": "#f5f8fa",
"100": "#e7eff3",
"200": "#d0dee7",
"300": "#b3c9d6",
"400": "#8facbc",
"500": "#5b798b",
"600": "#49616e",
"700": "#3c4e58",
"800": "#303d45",
"900": "#263036",
"950": "#1a2023"
},
"cyan": {
"50": "#f5f8fa",
"100": "#e7eff3",
"200": "#d0dee7",
"300": "#b3c9d6",
"400": "#8facbc",
"500": "#5b798b",
"600": "#49616e",
"700": "#3c4e58",
"800": "#303d45",
"900": "#263036",
"950": "#1a2023"
},
"green": {
"50": "#f5faf8",
"100": "#e7f3ee",
"200": "#d0e7dc",
"300": "#b3d6c6",
"400": "#8fbca8",
"500": "#5b8b75",
"600": "#496e5e",
"700": "#3c584b",
"800": "#30453c",
"900": "#26362f",
"950": "#1a231f"
},
"emerald": {
"50": "#f5faf8",
"100": "#e7f3ee",
"200": "#d0e7dc",
"300": "#b3d6c6",
"400": "#8fbca8",
"500": "#5b8b75",
"600": "#496e5e",
"700": "#3c584b",
"800": "#30453c",
"900": "#26362f",
"950": "#1a231f"
},
"teal": {
"50": "#f5faf8",
"100": "#e7f3ee",
"200": "#d0e7dc",
"300": "#b3d6c6",
"400": "#8fbca8",
"500": "#5b8b75",
"600": "#496e5e",
"700": "#3c584b",
"800": "#30453c",
"900": "#26362f",
"950": "#1a231f"
},
"red": {
"50": "#faf5f5",
"100": "#f3e7e8",
"200": "#e7d0d2",
"300": "#d6b3b6",
"400": "#bc8f94",
"500": "#8b5b5f",
"600": "#6e494d",
"700": "#583c3f",
"800": "#453032",
"900": "#362628",
"950": "#231a1b"
},
"rose": {
"50": "#faf5f5",
"100": "#f3e7e8",
"200": "#e7d0d2",
"300": "#d6b3b6",
"400": "#bc8f94",
"500": "#8b5b5f",
"600": "#6e494d",
"700": "#583c3f",
"800": "#453032",
"900": "#362628",
"950": "#231a1b"
},
"purple": {
"50": "#f7f5fa",
"100": "#ede7f3",
"200": "#dbd0e7",
"300": "#c3b3d6",
"400": "#a48fbc",
"500": "#715b8b",
"600": "#5b496e",
"700": "#493c58",
"800": "#3a3045",
"900": "#2d2636",
"950": "#1e1a23"
},
"violet": {
"50": "#f7f5fa",
"100": "#ede7f3",
"200": "#dbd0e7",
"300": "#c3b3d6",
"400": "#a48fbc",
"500": "#715b8b",
"600": "#5b496e",
"700": "#493c58",
"800": "#3a3045",
"900": "#2d2636",
"950": "#1e1a23"
},
"fuchsia": {
"50": "#f7f5fa",
"100": "#ede7f3",
"200": "#dbd0e7",
"300": "#c3b3d6",
"400": "#a48fbc",
"500": "#715b8b",
"600": "#5b496e",
"700": "#493c58",
"800": "#3a3045",
"900": "#2d2636",
"950": "#1e1a23"
},
"pink": {
"50": "#faf5f7",
"100": "#f3e7ec",
"200": "#e7d0da",
"300": "#d6b3c2",
"400": "#bc8fa3",
"500": "#8b5b70",
"600": "#6e4959",
"700": "#583c48",
"800": "#453039",
"900": "#36262d",
"950": "#231a1e"
},
"amber": {
"50": "#faf8f5",
"100": "#f3efe7",
"200": "#e7ded0",
"300": "#d6c8b3",
"400": "#bcab8f",
"500": "#8b785b",
"600": "#6e6049",
"700": "#584d3c",
"800": "#453d30",
"900": "#363026",
"950": "#23201a"
},
"yellow": {
"50": "#faf8f5",
"100": "#f3efe7",
"200": "#e7ded0",
"300": "#d6c8b3",
"400": "#bcab8f",
"500": "#8b785b",
"600": "#6e6049",
"700": "#584d3c",
"800": "#453d30",
"900": "#363026",
"950": "#23201a"
},
"orange": {
"50": "#faf8f5",
"100": "#f3efe7",
"200": "#e7ded0",
"300": "#d6c8b3",
"400": "#bcab8f",
"500": "#8b785b",
"600": "#6e6049",
"700": "#584d3c",
"800": "#453d30",
"900": "#363026",
"950": "#23201a"
},
"lime": {
"50": "#f8faf5",
"100": "#eef3e7",
"200": "#dce7d0",
"300": "#c6d6b3",
"400": "#a7bc8f",
"500": "#748b5b",
"600": "#5d6e49",
"700": "#4b583c",
"800": "#3b4530",
"900": "#2e3626",
"950": "#1f231a"
},
"gray": {
"50": "#f7fafb",
"100": "#edf3f5",
"200": "#dce6e9",
"300": "#bfced4",
"400": "#93a7b0",
"500": "#6a818c",
"600": "#536b76",
"700": "#435365",
"800": "#333d49",
"900": "#252b34",
"950": "#1c222c"
},
"slate": {
"50": "#f7fafb",
"100": "#edf3f5",
"200": "#dce6e9",
"300": "#bfced4",
"400": "#93a7b0",
"500": "#6a818c",
"600": "#536b76",
"700": "#435365",
"800": "#333d49",
"900": "#252b34",
"950": "#1c222c"
},
"zinc": {
"50": "#f7fafb",
"100": "#edf3f5",
"200": "#dce6e9",
"300": "#bfced4",
"400": "#93a7b0",
"500": "#6a818c",
"600": "#536b76",
"700": "#435365",
"800": "#333d49",
"900": "#252b34",
"950": "#1c222c"
},
"neutral": {
"50": "#f7fafb",
"100": "#edf3f5",
"200": "#dce6e9",
"300": "#bfced4",
"400": "#93a7b0",
"500": "#6a818c",
"600": "#536b76",
"700": "#435365",
"800": "#333d49",
"900": "#252b34",
"950": "#1c222c"
},
"stone": {
"50": "#f7fafb",
"100": "#edf3f5",
"200": "#dce6e9",
"300": "#bfced4",
"400": "#93a7b0",
"500": "#6a818c",
"600": "#536b76",
"700": "#435365",
"800": "#333d49",
"900": "#252b34",
"950": "#1c222c"
}
},
"buttons": {
"light": {
"primary": {
"bg": "#c8dfe9",
"hover": "#b8d3e0",
"text": "#304f60",
"border": "#a8c7d6"
},
"secondary": {
"bg": "#edf3f5",
"hover": "#dde9ed",
"text": "#3f5b66",
"border": "#c1d3da"
},
"success": {
"bg": "#d3e9de",
"hover": "#c1dfd0",
"text": "#305a49",
"border": "#aacdbc"
},
"danger": {
"bg": "#f1d9de",
"hover": "#e9c5cd",
"text": "#7a3544",
"border": "#dcb4bf"
},
"outline": {
"bg": "#f7fafb",
"hover": "#e9e4f2",
"text": "#5a4e70",
"border": "#d0c7dd"
}
},
"dark": {
"primary": {
"bg": "#304d5a",
"hover": "#3b5c6b",
"text": "#dfedf4",
"border": "#577784"
},
"secondary": {
"bg": "#303946",
"hover": "#3a4655",
"text": "#dfebee",
"border": "#556477"
},
"success": {
"bg": "#2e4b40",
"hover": "#3b5c4e",
"text": "#e1f1e9",
"border": "#577e6d"
},
"danger": {
"bg": "#51343e",
"hover": "#65434e",
"text": "#f7e3e8",
"border": "#8a6170"
},
"outline": {
"bg": "#393448",
"hover": "#4b435d",
"text": "#eae4f6",
"border": "#726683"
}
}
}
}
+13
View File
@@ -19,9 +19,22 @@ export interface TrashListResponse {
size: number
total: number
data: TrashFileItem[]
summary?: { total: number; recoverable: number; purged: number }
capabilities?: { filters: boolean; batch: boolean; customRetention: boolean }
}
export interface TrashListParams {
page: number
size: number
keyword?: string
state?: 'all' | 'recoverable' | 'permanent' | 'scheduled' | 'purged'
reason?: '' | 'manual' | 'batch_delete' | 'expired_time' | 'expired_count' | 'expired_both' | 'expired'
}
export interface TrashRetentionRequest { retentionDays?: number; expiresAt?: string }
export interface TrashBatchRequest extends TrashRetentionRequest { ids: number[]; action: 'restore' | 'purge' | 'retention' }
export interface TrashBatchResult {
requestedCount: number
succeeded: { id: number; code?: string; trashExpiresAt?: string | null }[]
failed: { id: number; reason: string }[]
}
+4
View File
@@ -0,0 +1,4 @@
export function fitValueFontSize(available: number, measured: number, maximum: number, minimum: number): number {
if (available <= 0 || measured <= 0) return maximum
return Math.max(minimum, Math.min(maximum, Math.floor(maximum * available / measured * 10) / 10))
}
+27
View File
@@ -0,0 +1,27 @@
import type { AnalyticsDailyRow } from '@/types'
export interface AnalyticsWindowTotals {
downloads: number
uploads: number
downloadTraffic: number
uploadTraffic: number
}
export function summarizeAnalyticsWindow(
rows: AnalyticsDailyRow[],
offset: number,
windowSize: number
): AnalyticsWindowTotals {
const start = Math.max(0, Math.floor(offset))
const end = Math.min(rows.length, Math.ceil(offset + windowSize))
return rows.slice(start, end).reduce(
(totals, row) => {
totals.downloads += Number(row.downloads || 0)
totals.uploads += Number(row.uploads || 0)
totals.downloadTraffic += Number(row.downloadTraffic || 0)
totals.uploadTraffic += Number(row.uploadTraffic || 0)
return totals
},
{ downloads: 0, uploads: 0, downloadTraffic: 0, uploadTraffic: 0 }
)
}
+30
View File
@@ -0,0 +1,30 @@
/** Own only detail animations; release filled effects before returning to auto layout. */
export function createDetailMotion(reducedMotion: () => boolean) {
const active = new Map<HTMLElement, () => void>()
const cancel = (element: HTMLElement) => active.get(element)?.()
const play = (
element: HTMLElement,
keyframes: Keyframe[],
options: KeyframeAnimationOptions,
done: () => void
) => {
cancel(element)
if (reducedMotion()) {
done()
return
}
const animation = element.animate(keyframes, { fill: 'both', ...options })
const settle = () => {
animation.removeEventListener('finish', settle)
animation.removeEventListener('cancel', settle)
active.delete(element)
animation.cancel()
done()
}
active.set(element, settle)
animation.addEventListener('finish', settle, { once: true })
animation.addEventListener('cancel', settle, { once: true })
}
const dispose = () => [...active.values()].forEach(settle => settle())
return { play, cancel, dispose }
}
+47
View File
@@ -0,0 +1,47 @@
import type { TrashFileItem } from '../types/trash'
const parseTime = (value?: string | null) => value ? new Date(value).getTime() : NaN
export function formatTrashTime(value?: string | null, now?: number): string {
const timestamp = parseTime(value)
if (!Number.isFinite(timestamp)) return '未记录'
const delta = now === undefined ? Infinity : timestamp - now
const distance = Math.abs(delta)
if (distance <= 7 * 86400000) {
if (distance < 60000) return delta <= 0 ? '刚刚' : '即将到达'
const unit = distance >= 86400000 ? '天' : distance >= 3600000 ? '小时' : '分钟'
const divisor = distance >= 86400000 ? 86400000 : distance >= 3600000 ? 3600000 : 60000
return `${Math.floor(distance / divisor)} ${unit}${delta < 0 ? '前' : '后'}`
}
const date = new Date(timestamp)
const pad = (n: number) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
}
export function getTrashPresentation(item: TrashFileItem, now: number) {
const reasons: Record<string, string> = {
manual: '手动删除', batch_delete: '批量删除', expired_time: '保存到期',
expired_count: '次数用尽', expired_both: '到期且次数用尽', expired: '历史自动回收'
}
const reason = item.trashReason ? reasons[item.trashReason] || '其他原因' : '未记录'
if (item.isTrashPurged) return {
state: '已清理', tone: 'muted', reason, reminder: '',
timeLabel: '清理时间', timeText: formatTrashTime(item.trashPurgedAt, now),
note: '文件不可恢复,审计记录和取件历史仍保留。'
}
if (item.isTrashPermanent) return {
state: '永久保留', tone: 'permanent', reason, reminder: '',
timeLabel: '清理计划', timeText: '不自动清理', note: ''
}
const deadline = parseTime(item.trashExpiresAt)
const valid = Number.isFinite(deadline)
const remainingMs = deadline - now
const reminder = !valid || remainingMs > 3 * 86400000 ? '' : remainingMs <= 0 ? '等待清理' : '即将清理'
return {
state: '可恢复', tone: valid && remainingMs <= 3 * 86400000 ? 'warning' : 'normal',
reason, reminder, timeLabel: '自动清理时间',
timeText: valid ? formatTrashTime(item.trashExpiresAt, now) : '待确认',
note: valid && remainingMs <= 0 ? '已到清理时间,等待后台处理。' : ''
}
}
+16
View File
@@ -0,0 +1,16 @@
import type { TrashFileItem, TrashRetentionRequest, TrashBatchResult } from '../types/trash'
export function selectableTrashIds(items: Pick<TrashFileItem, 'id' | 'isTrashPurged'>[]) {
return [...new Set(items.filter(item => !item.isTrashPurged).map(item => item.id))]
}
export function buildTrashRetention(permanent: boolean, value: string, now: number): TrashRetentionRequest {
if (permanent) return { retentionDays: 0 }
const timestamp = new Date(value).getTime()
if (!Number.isFinite(timestamp) || timestamp <= now || timestamp > now + 365 * 86400000) {
throw new Error('请选择未来 365 天内的自动清理时间')
}
return { expiresAt: new Date(timestamp).toISOString() }
}
export function summarizeTrashBatch(result: Pick<TrashBatchResult, 'succeeded' | 'failed'>) {
return result.failed.length ? `成功 ${result.succeeded.length} 项,失败 ${result.failed.length} 项` : `已完成 ${result.succeeded.length} 项`
}
+2 -2
View File
@@ -4,14 +4,14 @@
>
<div class="w-full max-w-md relative z-10">
<div
class="rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300"
class="fcb-surface rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300"
:class="[
isDarkMode
? 'bg-gray-800 bg-opacity-50 backdrop-filter backdrop-blur-xl border-gray-700'
: 'bg-white border-gray-200'
]"
>
<div class="p-8">
<div class="p-5 sm:p-8">
<PageHeader :title="config.name" @title-click="toSend" />
<RetrieveForm
v-model="code"
+17 -24
View File
@@ -4,16 +4,16 @@
@paste.prevent="handlePaste"
>
<div
class="rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
class="fcb-surface rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
:class="[
isDarkMode
? 'bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl border-gray-700'
: 'bg-white border-gray-200'
: 'bg-[#f5f8f9] border-[#dce5e8] shadow-[12px_16px_34px_rgba(112,137,151,.16),-8px_-8px_20px_rgba(255,255,255,.8)]'
]"
>
<div class="p-6 sm:p-8">
<div class="p-5 sm:p-8">
<PageHeader :title="config.name" @title-click="toRetrieve" />
<form @submit.prevent="handleSubmit" class="space-y-8">
<form @submit.prevent="handleSubmit" class="space-y-5 sm:space-y-8">
<SendTypeSelector
:selected-type="sendType"
@update:selected-type="sendType = $event"
@@ -49,12 +49,9 @@
<button
type="submit"
:disabled="isSubmitting"
class="w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:scale-105 hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
class="fcb-action fcb-button-primary w-full bg-[#7198a6] text-white font-bold shadow-[0_10px_20px_rgba(113,152,166,.24)] py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
>
<span
class="absolute top-0 left-0 w-full h-full bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"
></span>
<span class="relative z-10 flex items-center justify-center text-lg">
<span class="relative z-10 flex items-center justify-center text-sm sm:text-lg">
<svg
v-if="isSubmitting"
class="w-6 h-6 mr-2 animate-spin"
@@ -82,7 +79,7 @@
</button>
</form>
<div class="mt-6 text-center">
<router-link to="/" class="inline-flex min-h-11 items-center rounded-lg px-2 text-sm text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#294047] sm:px-3 sm:text-base">
<router-link to="/" class="fcb-action inline-flex min-h-11 items-center rounded-lg px-2 text-sm text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#333d49] sm:px-3 sm:text-base">
{{ t('send.needRetrieveFile') }}
</router-link>
</div>
@@ -102,7 +99,7 @@
<button
type="button"
@click="toggleDrawer"
class="flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-indigo-50 dark:hover:bg-gray-700"
class="fcb-action flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-indigo-50 dark:hover:bg-gray-700"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
>
{{ t('send.sendRecords') }}
@@ -191,21 +188,17 @@ const toRetrieve = () => {
<style scoped>
.fade-enter-active,
.fade-leave-active {
transition:
opacity 0.3s ease,
transform 0.3s ease;
transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
transform: translateY(10px);
}
.fade-enter-to,
.fade-leave-from {
opacity: 1;
transform: translateY(0);
}
:deep(.payload-panel) {
@@ -224,20 +217,20 @@ select option {
}
select option:checked {
background: linear-gradient(to right, rgb(99 102 241 / 0.5), rgb(168 85 247 / 0.5)) !important;
background: linear-gradient(to right, rgb(143 175 191 / 0.5), rgb(182 168 201 / 0.5)) !important;
color: white !important;
}
.dark select option:checked {
background: linear-gradient(to right, rgb(99 102 241 / 0.7), rgb(168 85 247 / 0.7)) !important;
background: linear-gradient(to right, rgb(143 175 191 / 0.7), rgb(182 168 201 / 0.7)) !important;
}
select option:hover {
background-color: rgb(99 102 241 / 0.1);
background-color: rgb(143 175 191 / 0.1);
}
.dark select option:hover {
background-color: rgb(99 102 241 / 0.2);
background-color: rgb(143 175 191 / 0.2);
}
/* 自定义滚动条样式 */
@@ -258,14 +251,14 @@ select option:hover {
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.6), rgba(168, 85, 247, 0.6));
background: linear-gradient(135deg, rgba(143, 175, 191, 0.6), rgba(182, 168, 201, 0.6));
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(168, 85, 247, 0.8));
background: linear-gradient(135deg, rgba(143, 175, 191, 0.8), rgba(182, 168, 201, 0.8));
transform: scale(1.1);
}
@@ -283,11 +276,11 @@ select option:hover {
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.7), rgba(168, 85, 247, 0.7));
background: linear-gradient(135deg, rgba(143, 175, 191, 0.7), rgba(182, 168, 201, 0.7));
border: 1px solid rgba(255, 255, 255, 0.1);
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
background: linear-gradient(135deg, rgba(143, 175, 191, 0.9), rgba(182, 168, 201, 0.9));
}
</style>
+20 -19
View File
@@ -2,22 +2,22 @@
<div class="p-4 sm:p-6">
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
<div>
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">ADMIN AUDIT</p>
<p class="hidden text-xs font-medium tracking-[0.16em] sm:block" :class="mutedTextClass">ADMIN AUDIT</p>
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">操作记录</h2>
<p class="mt-1 text-sm" :class="mutedTextClass">查看后台管理、回收站和配置变更的可追溯记录。</p>
</div>
<BaseButton variant="secondary" :loading="isLoading" @click="loadActivities">
<BaseButton class="fcb-refresh-button" variant="secondary" :loading="isLoading" @click="loadActivities">
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
刷新记录
</BaseButton>
</header>
<section class="theme-2026-card theme-2026-card-hover mb-5 rounded-[24px] border p-3 shadow-md sm:mb-6 sm:rounded-[30px] sm:p-4" :class="panelClass">
<div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-[minmax(0,1fr)_220px_220px_auto]">
<label class="min-w-0">
<span class="sr-only">搜索操作、对象或文件名</span>
<section class="theme-2026-card mb-5 rounded-[24px] border p-3 shadow-md sm:mb-6 sm:rounded-[30px] sm:p-4" :class="panelClass">
<div class="fcb-filter-grid grid grid-cols-2 gap-3 xl:grid-cols-[minmax(0,1fr)_180px_180px_auto]">
<label class="col-span-2 min-w-0 xl:col-span-1">
<span class="mb-1 block text-xs font-medium" :class="mutedTextClass">关键词</span>
<span class="relative block">
<SearchIcon class="absolute left-3 top-3 h-4 w-4" :class="mutedTextClass" />
<SearchIcon class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2" :class="mutedTextClass" />
<input v-model="filters.keyword" class="min-h-11 w-full rounded-xl border py-2.5 pl-10 pr-3 text-sm outline-none focus:ring-2 focus:ring-[#8fb2bf]" :class="fieldClass" placeholder="搜索操作、对象或文件名" @keyup.enter="applyFilters" />
</span>
</label>
@@ -35,9 +35,9 @@
<option v-for="option in targetTypeOptions" :key="option.value" :value="option.value">{{ targetTypeLabel(option.label) }} · {{ option.count }}</option>
</select>
</label>
<div class="flex items-end gap-2">
<BaseButton class="flex-1" :loading="isLoading" @click="applyFilters">筛选</BaseButton>
<button type="button" class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors" :class="actionClass" aria-label="重置筛选" title="重置筛选" @click="resetFilters">
<div class="col-span-2 flex items-end justify-end gap-2 xl:col-span-1">
<BaseButton class="min-w-20" :loading="isLoading" @click="applyFilters">筛选</BaseButton>
<button type="button" class="fcb-action fcb-icon-action flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors" :class="actionClass" aria-label="重置筛选" title="重置筛选" @click="resetFilters">
<RotateCcwIcon class="h-4 w-4" />
</button>
</div>
@@ -50,7 +50,7 @@
<h3 class="text-base font-semibold" :class="primaryTextClass">审计事件</h3>
<p class="mt-0.5 text-xs" :class="mutedTextClass">筛选结果 {{ total }} 条 · 已保存 {{ storedTotal }} 条</p>
</div>
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'">
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#2c3440] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'">
<ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" /> 审计留痕
</span>
</div>
@@ -64,7 +64,7 @@
v-for="activity in activities"
:key="activity.id"
class="fcb-interactive-row group grid gap-3 px-4 py-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-start sm:px-6"
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
:class="isDarkMode ? 'hover:bg-[#2c3440]/60' : 'hover:bg-[#f2f8f8]'"
>
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl" :class="activityToneClass(activity.action)">
<component :is="activityIcon(activity.action)" class="h-5 w-5" aria-hidden="true" />
@@ -109,19 +109,20 @@ const filters = ref({ page: 1, size: 20, keyword: '', action: '', targetType: ''
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
const fieldClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#253941] text-white placeholder:text-[#9fb2b7]' : 'border-[#c8d8dc] bg-white text-[#263f48] placeholder:text-[#84969a]')
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
const actionClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]')
const panelClass = computed(() => isDarkMode.value ? 'border-[#495765] bg-[#252b34]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
const fieldClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#2c3440] text-white placeholder:text-[#9fb2b7]' : 'border-[#c8d8dc] bg-white text-[#263f48] placeholder:text-[#84969a]')
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#495765] border-[#495765]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
const actionClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]')
const badgeClass = computed(() => isDarkMode.value ? 'border-[#50666f] text-[#b8d6de]' : 'border-[#c8d8dc] text-[#4e6c75]')
const actionLabel = (action: string) => ({
'file.delete': '移入回收站', 'files.batch_delete': '批量移入回收站', 'trash.restore': '从回收站恢复', 'trash.purge': '永久清理文件本体', 'file.update': '更新文件信息', 'files.batch_update': '批量更新文件', 'file.metadata_update': '更新文件备注', 'file.policy_action': '调整文件策略', 'files.batch_policy_action': '批量调整策略', 'config.update': '更新系统设置', 'local_file.delete': '删除本地文件', 'local_file.share': '分享本地文件'
'file.delete': '移入回收站', 'files.batch_delete': '批量移入回收站', 'trash.restore': '从回收站恢复', 'trash.purge': '彻底删除文件', 'trash.retention': '设置清理时间', 'trash.batch_restore': '批量恢复', 'trash.batch_purge': '批量彻底删除', 'trash.batch_retention': '批量设置清理时间', 'file.update': '更新文件信息', 'files.batch_update': '批量更新文件', 'file.metadata_update': '更新文件备注', 'file.policy_action': '调整文件策略', 'files.batch_policy_action': '批量调整策略', 'config.update': '更新系统设置', 'local_file.delete': '删除本地文件', 'local_file.share': '分享本地文件'
}[action] || action)
const targetTypeLabel = (targetType: string) => ({ file: '文件', config: '系统配置', local_file: '本地文件', view_preset: '视图预设', system: '系统' }[targetType] || targetType || '系统')
const activityIcon = (action: string): Component => action.includes('trash') || action.includes('delete') ? Trash2Icon : action.includes('config') ? CogIcon : action.includes('update') || action.includes('policy') ? FilePenLineIcon : action.includes('share') ? UploadIcon : ActivityIcon
const activityIcon = (action: string): Component => action.includes('restore') ? RotateCcwIcon : action.includes('trash') || action.includes('delete') ? Trash2Icon : action.includes('config') ? CogIcon : action.includes('update') || action.includes('policy') ? FilePenLineIcon : action.includes('share') ? UploadIcon : ActivityIcon
const activityToneClass = (action: string) => {
if (action === 'trash.purge') return isDarkMode.value ? 'bg-red-950/50 text-red-300' : 'bg-red-50 text-red-600'
if (action.includes('restore')) return isDarkMode.value ? 'bg-emerald-950/45 text-emerald-300' : 'bg-emerald-50 text-emerald-700'
if (action === 'trash.purge' || action === 'trash.batch_purge') return isDarkMode.value ? 'bg-red-950/50 text-red-300' : 'bg-red-50 text-red-600'
if (action.includes('trash') || action.includes('delete')) return isDarkMode.value ? 'bg-amber-950/45 text-amber-300' : 'bg-amber-50 text-amber-700'
if (action.includes('restore') || action.includes('share')) return isDarkMode.value ? 'bg-emerald-950/45 text-emerald-300' : 'bg-emerald-50 text-emerald-700'
return isDarkMode.value ? 'bg-[#263f48] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#397084]'
+33 -38
View File
@@ -15,7 +15,7 @@
:loading="isDashboardRefreshing"
:title="t('admin.dashboard.refresh')"
:aria-label="t('admin.dashboard.refresh')"
class="shrink-0 max-sm:h-11 max-sm:w-11 max-sm:!px-0"
class="fcb-icon-action shrink-0 max-sm:h-11 max-sm:w-11 max-sm:!px-0"
@click="refreshDashboardPage"
>
<template #icon>
@@ -85,7 +85,7 @@
<div v-if="dashboardData.hasExtendedStats" class="mt-6 grid grid-cols-1 gap-6 2xl:grid-cols-3">
<section
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-5 2xl:col-span-2"
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5 2xl:col-span-2"
:class="[panelClass, cardHoverClass]"
>
<div class="mb-4 flex items-center justify-between sm:mb-5">
@@ -103,7 +103,7 @@
/>
</div>
<div class="grid grid-cols-1 gap-2 sm:grid-cols-3 sm:gap-4">
<div class="fcb-metric-grid grid grid-cols-3 gap-2 sm:gap-4">
<MetricProgress
:label="t('admin.dashboard.activeFileRatio')"
:value="dashboardData.activeRatio"
@@ -129,7 +129,7 @@
v-for="action in healthActions"
:key="action.key"
type="button"
class="theme-2026-card-hover group flex min-h-20 flex-col justify-between rounded-[20px] border p-3 text-left shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md sm:min-h-24 sm:rounded-[30px] sm:p-4"
class="fcb-health-card theme-2026-card-hover group flex min-h-20 flex-col justify-between rounded-[20px] border p-3 text-left shadow-sm transition-all duration-300 hover:shadow-md sm:min-h-24 sm:rounded-[30px] sm:p-4"
:class="getHealthActionClass(action.tone)"
@click="openHealthQueue(action.health)"
>
@@ -151,7 +151,7 @@
<div class="mt-4 grid grid-cols-2 gap-2 sm:mt-6 sm:gap-4">
<div
class="theme-2026-card-hover rounded-[20px] border p-3 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md"
class="theme-2026-card-hover rounded-[20px] border p-3 shadow-sm transition-all duration-200 hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md"
:class="[subtlePanelClass, cardHoverClass]"
>
<p class="text-sm" :class="[mutedTextClass]">
@@ -168,7 +168,7 @@
</div>
<div
class="theme-2026-card-hover rounded-[20px] border p-3 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md"
class="theme-2026-card-hover rounded-[20px] border p-3 shadow-sm transition-all duration-200 hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md"
:class="[subtlePanelClass, cardHoverClass]"
>
<p class="text-sm" :class="[mutedTextClass]">
@@ -187,7 +187,7 @@
</section>
<section
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-5"
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
:class="[panelClass, cardHoverClass]"
>
<div class="mb-5">
@@ -235,32 +235,28 @@
<div class="mt-6 grid grid-cols-1 gap-6 xl:grid-cols-2">
<section
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-5"
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
:class="[panelClass, cardHoverClass]"
>
<div class="mb-5 flex flex-col gap-4">
<div class="flex min-w-0 flex-col gap-3 xl:flex-row xl:items-start xl:justify-between">
<div class="min-w-0">
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">{{ t('admin.dashboard.trend.title') }}</h3>
<p class="break-words text-sm leading-5" :class="[mutedTextClass]">
{{ analyticsSummaryText }}
</p>
<p class="mt-1 text-xs leading-5" :class="mutedTextClass">{{ analyticsWindowText }}</p>
<div class="mt-2 grid grid-cols-2 gap-3 text-xs sm:flex sm:flex-wrap" :class="mutedTextClass">
<div><p>{{ t('admin.dashboard.trend.downloadTotal') }}</p><p class="mt-1 flex flex-wrap gap-x-2 gap-y-1 font-medium tabular-nums" :class="primaryTextClass"><span class="whitespace-nowrap">{{ t('admin.dashboard.trend.times', { count: analyticsWindowStats.downloads }) }}</span><span class="whitespace-nowrap">{{ analyticsDownloadTrafficText }}</span></p></div>
<div><p>{{ t('admin.dashboard.trend.uploadTotal') }}</p><p class="mt-1 flex flex-wrap gap-x-2 gap-y-1 font-medium tabular-nums" :class="primaryTextClass"><span class="whitespace-nowrap">{{ t('admin.dashboard.trend.times', { count: analyticsWindowStats.uploads }) }}</span><span class="whitespace-nowrap">{{ analyticsUploadTrafficText }}</span></p></div>
</div>
<p class="mt-1 text-xs sm:hidden" :class="[mutedTextClass]">{{ t('admin.dashboard.trend.mobileHint') }}</p>
</div>
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2 xl:flex-nowrap">
<div class="analytics-date-range flex min-w-0 items-center justify-center gap-1.5 sm:gap-2">
<div class="analytics-date-range grid w-full min-w-0 grid-cols-2 gap-2 sm:w-auto">
<NativeDateSelect
v-model="analyticsStart"
:field-class="fieldClass"
:aria-label="t('admin.dashboard.trend.startDate')"
@change="fetchAnalyticsData"
/>
<span
class="shrink-0 text-sm font-semibold"
:class="[isDarkMode ? 'text-[#aabdc2]' : 'text-[#789096]']"
>
-
</span>
<NativeDateSelect
v-model="analyticsEnd"
:field-class="fieldClass"
@@ -313,11 +309,12 @@
:rows="analyticsDailyRows"
:is-dark-mode="isDarkMode"
@window-change="analyticsWindowText = $event"
@window-stats="analyticsWindowStats = $event"
/>
</section>
<section
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-5"
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
:class="[panelClass, cardHoverClass]"
>
<div class="mb-5 flex items-center justify-between">
@@ -372,7 +369,7 @@
<tr
v-for="file in analyticsTopFiles"
:key="file.code"
:class="[isDarkMode ? 'hover:bg-gray-700/60' : 'hover:bg-gray-50']"
class="fcb-list-row"
>
<td
class="max-w-xs truncate px-4 py-3 text-sm font-medium"
@@ -408,7 +405,7 @@
class="rounded-[30px] border px-2.5 py-0.5 font-medium shadow-sm"
:class="[
isDarkMode
? 'border-[#40545c] bg-[#263941]/80 text-[#d8e3e5]'
? 'border-[#495765] bg-[#2c3440]/80 text-[#d8e3e5]'
: 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66]'
]"
>
@@ -446,6 +443,7 @@ import { ROUTES } from '@/constants'
import { useConfigStore } from '@/stores/configStore'
import { formatFileSize } from '@/utils/common'
import type { AnalyticsData, AnalyticsFileRow, DashboardHealthAction } from '@/types'
import type { AnalyticsWindowTotals } from '@/utils/analyticsWindow'
const isDarkMode = useInjectedDarkMode()
const { t } = useI18n()
@@ -463,22 +461,22 @@ const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'tex
const versionText = computed(() => appVersion.value || t('admin.dashboard.versionPending'))
const panelClass = computed(() =>
isDarkMode.value
? 'bg-[#202f36]/90 border border-[#40545c]'
? 'bg-[#252b34]/90 border border-[#495765]'
: 'bg-[#f8fbfb] border border-[#d7e3e5]'
)
const fieldClass = computed(() =>
isDarkMode.value
? 'border-[#50666f] bg-[#253941] text-white'
? 'border-[#50666f] bg-[#2c3440] text-white'
: 'border-[#c8d8dc] bg-[#fbfdfd] text-[#263f48]'
)
const subtlePanelClass = computed(() =>
isDarkMode.value
? 'border-[#3d5159] bg-[#17252c]/50'
? 'border-[#3d5159] bg-[#252b34]/50'
: 'border-[#d4e0e3] bg-[linear-gradient(135deg,#f7faf9,#eaf3f4)]'
)
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 maxSaveTimeText = computed(() => {
@@ -503,22 +501,19 @@ const analyticsData = ref<AnalyticsData | null>(null)
const analyticsError = ref('')
const isAnalyticsLoading = ref(false)
const analyticsWindowText = ref(t('admin.dashboard.trend.noData'))
const analyticsWindowStats = ref<AnalyticsWindowTotals>({
downloads: 0,
uploads: 0,
downloadTraffic: 0,
uploadTraffic: 0
})
const analyticsDailyRows = computed(() => analyticsData.value?.daily || [])
const analyticsTopFiles = computed<AnalyticsFileRow[]>(() => analyticsData.value?.topFiles || [])
const analyticsUploadTrafficText = computed(() =>
formatBytes(analyticsData.value?.totals?.uploadTraffic || 0)
formatBytes(analyticsWindowStats.value.uploadTraffic)
)
const analyticsDownloadTrafficText = computed(() =>
formatBytes(analyticsData.value?.totals?.downloadTraffic || 0)
)
const analyticsSummaryText = computed(() =>
t('admin.dashboard.trend.summary', {
window: analyticsWindowText.value,
downloads: analyticsData.value?.totals?.totalDownloads || 0,
downloadTraffic: analyticsDownloadTrafficText.value,
uploads: analyticsData.value?.totals?.totalUploads || 0,
uploadTraffic: analyticsUploadTrafficText.value
})
formatBytes(analyticsWindowStats.value.downloadTraffic)
)
const formatBytes = (value: number | string | undefined) => formatFileSize(Number(value || 0), 1)
@@ -595,7 +590,7 @@ const getHealthActionClass = (tone: DashboardHealthAction['tone']) => {
danger: 'border-[#7c5f64]/40 bg-[#5f383f]/24 text-[#f0d8dc] hover:border-[#b1878f]',
warning: 'border-[#8b7a57]/40 bg-[#665733]/24 text-[#efe3c6] hover:border-[#b8a775]',
success: 'border-[#58766d]/40 bg-[#31564f]/24 text-[#d2e7df] hover:border-[#7fa69a]',
neutral: 'border-[#40545c] bg-[#17252c]/50 text-[#d8e3e5] hover:border-[#7199a8]'
neutral: 'border-[#495765] bg-[#252b34]/50 text-[#d8e3e5] hover:border-[#7199a8]'
}
const lightClasses: Record<DashboardHealthAction['tone'], string> = {
danger: 'border-[#ead8dc] bg-[#f7ecee] text-[#8b5962] hover:border-[#d8b8bf]',
@@ -640,7 +635,7 @@ const MetricProgress = defineComponent({
'div',
{
class:
'theme-2026-card-hover rounded-[18px] border border-[#d4e0e3] bg-[#f6faf9] p-2.5 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:border-[#8fb2bf] hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md dark:border-[#40545c] dark:bg-[#17252c]/50 dark:hover:border-[#7199a8] dark:hover:bg-[#263941] dark:hover:shadow-black/25'
'fcb-metric-card theme-2026-card-hover rounded-[18px] border border-[#d4e0e3] bg-[#f6faf9] p-2.5 shadow-sm transition-all duration-200 hover:border-[#8fb2bf] hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md dark:border-[#495765] dark:bg-[#252b34]/50 dark:hover:border-[#7199a8] dark:hover:bg-[#2c3440] dark:hover:shadow-[#97aac8]/15'
},
[
h('div', { class: 'mb-2 flex items-center justify-between gap-3 text-sm' }, [
+166 -165
View File
@@ -18,18 +18,16 @@
<div
v-for="card in summaryCards"
:key="card.label"
class="theme-2026-card theme-2026-card-hover group rounded-[24px] border p-3.5 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[30px] sm:p-4"
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-hover:scale-105 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:-translate-y-0.5 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">
@@ -71,8 +69,8 @@
</div>
</div>
<Transition name="fcb-expand-120">
<div id="file-filter-panel" v-if="filterBodyVisible" class="fcb-expand-content mt-4 grid gap-4">
<Transition :css="false" @before-enter="beforeExpandPanelEnter" @enter="enterExpandPanel" @after-enter="afterExpandPanelEnter" @before-leave="beforeExpandPanelLeave" @leave="leaveExpandPanel">
<div id="file-filter-panel" v-show="filterBodyVisible" class="fcb-expand-content mt-4 grid gap-4">
<div class="flex flex-col gap-3 lg:flex-row lg:items-center">
<label class="min-w-0 flex-1">
<span class="sr-only">{{ t('fileManage.searchPlaceholder') }}</span>
@@ -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"
@@ -320,7 +318,7 @@
</div>
<div v-else-if="hasLoadError" class="px-4 py-10 text-center">
<p class="text-sm font-medium" :class="[primaryTextClass]">{{ t('fileManage.loadError') }}</p>
<BaseButton class="mt-3" variant="secondary" @click="refreshFileList">{{ t('fileManage.refresh') }}</BaseButton>
<BaseButton class="fcb-refresh-button 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]">
<p>{{ hasActiveFilters ? t('fileManage.noMatches') : t('common.noData') }}</p>
@@ -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"
>
@@ -465,7 +463,7 @@
<div v-if="!isMobileViewport" class="hidden md:block">
<DataTable :title="t('fileManage.allFiles')" :headers="fileTableHeaders" table-class="min-w-[1120px]">
<template #actions>
<BaseButton variant="secondary" :loading="isLoading" @click="refreshFileList">
<BaseButton class="fcb-refresh-button" variant="secondary" :loading="isLoading" @click="refreshFileList">
<template #icon>
<RefreshCwIcon class="mr-2 h-4 w-4" />
</template>
@@ -567,7 +565,7 @@
<p class="font-medium" :class="[primaryTextClass]">
{{ t('fileManage.loadError') }}
</p>
<BaseButton class="mt-4" variant="secondary" @click="refreshFileList">
<BaseButton class="fcb-refresh-button mt-4" variant="secondary" @click="refreshFileList">
<template #icon>
<RefreshCwIcon class="mr-2 h-4 w-4" />
</template>
@@ -602,7 +600,7 @@
<tr
v-for="file in tableData"
:key="file.id"
class="transition-colors duration-200"
class="fcb-list-row transition-colors duration-300"
:class="[
selectedFileIds.has(file.id)
? isDarkMode
@@ -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:-translate-y-0.5 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 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>
@@ -881,9 +877,9 @@
<tr
v-for="file in historyPageRows"
:key="file.code"
class="fcb-list-row"
:class="[
file.current ? '' : 'opacity-70',
isDarkMode ? 'hover:bg-gray-700/60' : 'hover:bg-gray-50'
]"
>
<td
@@ -1010,7 +1006,7 @@
</div>
<div
class="theme-2026-card-hover rounded-[24px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:px-4 sm:py-3"
class="theme-2026-card-hover rounded-[24px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-3"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-gray-50']"
>
<div class="grid gap-2.5 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-center">
@@ -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:-translate-y-0.5 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">
@@ -1135,7 +1131,7 @@
v-for="action in detailPolicyActionOptions"
:key="action.action"
type="button"
class="theme-2026-card-hover flex min-h-14 items-start gap-2 rounded-[22px] border px-3 py-2 text-left shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:shadow-md"
class="theme-2026-card-hover flex min-h-14 items-start gap-2 rounded-[22px] border px-3 py-2 text-left shadow-md transition-all duration-200 hover:shadow-lg disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:shadow-md"
:class="[detailPolicyActionClass, cardHoverClass]"
:disabled="isDetailPolicyActionRunning || isDetailLoading || action.disabled"
:title="action.description"
@@ -1168,7 +1164,7 @@
<div
v-for="item in detailOverviewItems"
:key="item.label"
class="theme-2026-card-hover rounded-[18px] border px-3 py-2 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[22px] sm:px-3.5 sm:py-2.5"
class="theme-2026-card-hover rounded-[18px] border px-3 py-2 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[22px] sm:px-3.5 sm:py-2.5"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
>
<p class="text-xs leading-4" :class="[mutedTextClass]">{{ item.label }}</p>
@@ -1187,7 +1183,7 @@
<div
v-for="item in detailPolicyItems"
:key="item.label"
class="theme-2026-card-hover rounded-[18px] border px-3 py-2 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:rounded-[22px] sm:px-3.5 sm:py-2.5"
class="theme-2026-card-hover rounded-[18px] border px-3 py-2 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[22px] sm:px-3.5 sm:py-2.5"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
>
<p class="text-xs leading-4" :class="[mutedTextClass]">{{ item.label }}</p>
@@ -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"
>
@@ -1223,6 +1219,7 @@
class="rounded-[24px] border px-3 py-3 shadow-md sm:px-4 sm:py-4"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
>
<div ref="lifecycleViewportRef" class="fcb-lifecycle-viewport">
<TransitionGroup
:css="false"
tag="div"
@@ -1245,7 +1242,7 @@
/>
</div>
<div
class="fcb-lifecycle-card theme-2026-card-hover mb-2.5 rounded-[16px] border px-3 py-2 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md last:mb-0 sm:rounded-[20px]"
class="fcb-lifecycle-card theme-2026-card-hover rounded-[16px] border px-3 py-2 shadow-sm transition-all duration-200 hover:shadow-md sm:rounded-[20px]"
:class="[
isDarkMode ? 'border-gray-700 bg-gray-800/60' : 'border-gray-100 bg-gray-50'
]"
@@ -1264,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"
>
@@ -1275,14 +1272,15 @@
}}
</button>
<Transition
name="fcb-retrieval-panel"
:css="false"
@before-enter="beforeRetrievalPanelEnter"
@enter="enterRetrievalPanel"
@after-enter="afterRetrievalPanelEnter"
@before-leave="beforeRetrievalPanelLeave"
@leave="leaveRetrievalPanel"
>
<div v-if="isRetrievalHistoryExpanded" class="mt-2.5 space-y-1.5">
<div v-show="isRetrievalHistoryExpanded" class="fcb-retrieval-panel">
<div class="space-y-1.5 pt-2.5">
<div
v-for="(event, eventIndex) in retrievalTimelineEvents"
:key="`${event.key}-${eventIndex}-${event.displayMeta}`"
@@ -1296,6 +1294,7 @@
<p class="mt-1 leading-5" :class="mutedTextClass">{{ event.displayDescription }}</p>
</div>
</div>
</div>
</Transition>
</div>
</div>
@@ -1303,10 +1302,11 @@
</template>
</TransitionGroup>
</div>
</div>
</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:-translate-y-0.5 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">
@@ -1377,7 +1377,7 @@
<div
v-for="item in detailStorageItems"
:key="item.label"
class="theme-2026-card-hover grid gap-1 rounded-[22px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center"
class="theme-2026-card-hover grid gap-1 rounded-[22px] border px-3 py-2.5 shadow-md transition-all duration-200 hover:shadow-lg sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
>
<p class="text-xs leading-4" :class="[mutedTextClass]">{{ item.label }}</p>
@@ -1527,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"
@@ -1704,7 +1704,7 @@
</template>
<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref, watch, type Component } from 'vue'
import { computed, nextTick, onMounted, onUnmounted, ref, watch, type Component } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import type {
@@ -1747,8 +1747,10 @@ 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'
const { t } = useI18n()
const isDarkMode = useInjectedDarkMode()
@@ -1857,6 +1859,8 @@ const syncMobileViewport = (event: MediaQueryListEvent) => {
isMobileViewport.value = event.matches
}
const isLifecycleExpanded = ref(false)
const lifecycleViewportRef = ref<HTMLElement | null>(null)
let lifecycleHeightRevision = 0
const isRetrievalHistoryExpanded = ref(false)
const retrievalTimelineEvents = computed(() =>
(selectedFileDetail.value?.detailTimeline || []).filter((item) => item.key === 'retrieved_event')
@@ -1870,49 +1874,51 @@ const visibleDetailTimeline = computed(() =>
isLifecycleExpanded.value ? detailTimelineRows.value : detailTimelineRows.value.slice(0, 3)
)
const LIFECYCLE_ENTER_MS = 160
const LIFECYCLE_LEAVE_MS = 120
const lifecycleEasing = 'cubic-bezier(0.22, 1, 0.36, 1)'
const lifecycleExitEasing = 'cubic-bezier(0.4, 0, 1, 1)'
const reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)')
const detailMotion = createDetailMotion(() => reducedMotionQuery.matches)
const playDetailAnimation = detailMotion.play
const PANEL_DURATION_MS = 420
const lifecycleEasing = 'cubic-bezier(0.32, 0.72, 0, 1)'
const LIFECYCLE_ENTER_MS = 180
const LIFECYCLE_LEAVE_MS = 120
const getAnimationDelay = (element: Element) => {
const row = element as HTMLElement
const siblingIndex = Array.from(row.parentElement?.children || []).indexOf(row)
return Math.min(Math.max(siblingIndex, 0) * 12, 36)
}
const playDetailAnimation = (
element: HTMLElement,
keyframes: Keyframe[],
options: KeyframeAnimationOptions,
done: () => void
) => {
if (reducedMotionQuery.matches) {
done()
return
// This watcher runs before Vue patches the rows: capture the visible starting
// height now, then measure the natural list height after leaving rows exit flow.
watch(isLifecycleExpanded, async () => {
const revision = ++lifecycleHeightRevision
const viewport = lifecycleViewportRef.value
if (!viewport) return
const from = viewport.getBoundingClientRect().height
detailMotion.cancel(viewport)
viewport.style.height = `${from}px`
viewport.style.overflow = 'hidden'
await nextTick()
if (revision !== lifecycleHeightRevision || !viewport.isConnected) return
const to = viewport.firstElementChild?.getBoundingClientRect().height ?? 0
playDetailAnimation(
viewport,
[{ height: `${from}px` }, { height: `${to}px` }],
{ duration: PANEL_DURATION_MS, easing: lifecycleEasing },
() => {
viewport.style.height = ''
viewport.style.overflow = ''
}
element.getAnimations().forEach((animation) => animation.cancel())
const animation = element.animate(keyframes, { fill: 'both', ...options })
const finish = () => done()
animation.addEventListener('finish', finish, { once: true })
animation.addEventListener('cancel', finish, { once: true })
}
)
})
const beforeLifecycleRowEnter = (element: Element) => {
const row = element as HTMLElement
row.style.willChange = 'transform, opacity'
row.style.willChange = 'opacity'
}
const enterLifecycleRow = (element: Element, done: () => void) => {
const row = element as HTMLElement
playDetailAnimation(
row,
[
{ opacity: 0, transform: 'translate3d(0, -6px, 0) scale(0.985)' },
{ opacity: 1, transform: 'translate3d(0, 0, 0) scale(1)' }
{ opacity: 0 },
{ opacity: 1 }
],
{ duration: LIFECYCLE_ENTER_MS, delay: getAnimationDelay(row), easing: lifecycleEasing },
{ duration: LIFECYCLE_ENTER_MS, delay: 0, easing: lifecycleEasing },
() => {
row.style.willChange = ''
done()
@@ -1921,67 +1927,78 @@ const enterLifecycleRow = (element: Element, done: () => void) => {
}
const leaveLifecycleRow = (element: Element, done: () => void) => {
const row = element as HTMLElement
row.style.willChange = 'transform, opacity'
const width = row.getBoundingClientRect().width
const top = row.offsetTop
row.style.position = 'absolute'
row.style.top = `${top}px`
row.style.width = `${width}px`
row.style.willChange = 'opacity'
playDetailAnimation(
row,
[
{ opacity: 1, transform: 'translate3d(0, 0, 0) scale(1)' },
{ opacity: 0, transform: 'translate3d(0, -4px, 0) scale(0.99)' }
{ opacity: 1 },
{ opacity: 0 }
],
{ duration: LIFECYCLE_LEAVE_MS, easing: lifecycleExitEasing },
{ duration: LIFECYCLE_LEAVE_MS, easing: lifecycleEasing },
() => {
row.style.willChange = ''
done()
}
)
}
const beforeRetrievalPanelEnter = (element: Element) => {
const panel = element as HTMLElement
panel.style.height = '0px'
panel.style.overflow = 'clip'
panel.style.willChange = 'height, opacity, transform'
}
const enterRetrievalPanel = (element: Element, done: () => void) => {
const panel = element as HTMLElement
const height = panel.scrollHeight
playDetailAnimation(
panel,
[
{ height: '0px', opacity: 0, transform: 'translate3d(0, -4px, 0)' },
{ height: `${height}px`, opacity: 1, transform: 'translate3d(0, 0, 0)' }
],
{ duration: LIFECYCLE_ENTER_MS, easing: lifecycleEasing },
done
)
}
const afterRetrievalPanelEnter = (element: Element) => {
const clearPanelStyles = (element: Element) => {
const panel = element as HTMLElement
panel.style.height = ''
panel.style.overflow = ''
panel.style.willChange = ''
}
const beforeRetrievalPanelLeave = (element: Element) => {
const beforeExpandPanelEnter = (element: Element) => {
const panel = element as HTMLElement
panel.style.height = `${panel.scrollHeight}px`
panel.style.overflow = 'clip'
panel.style.willChange = 'height, opacity, transform'
// v-show briefly sets display:none while reversing leave; computed height
// still includes the running effect, whereas the bounding box is then zero.
const from = panel.style.height ? Number.parseFloat(getComputedStyle(panel).height) : 0
detailMotion.cancel(panel)
panel.style.height = `${from}px`
panel.style.overflow = 'hidden'
panel.style.willChange = 'height, opacity'
}
const leaveRetrievalPanel = (element: Element, done: () => void) => {
const enterExpandPanel = (element: Element, done: () => void) => {
const panel = element as HTMLElement
const height = panel.scrollHeight
playDetailAnimation(
panel,
[
{ height: `${height}px`, opacity: 1, transform: 'translate3d(0, 0, 0)' },
{ height: '0px', opacity: 0, transform: 'translate3d(0, -4px, 0)' }
],
{ duration: LIFECYCLE_LEAVE_MS, easing: lifecycleExitEasing },
() => {
panel.style.willChange = ''
done()
}
// Remove the frozen height while measuring: scrollHeight cannot measure a
// smaller destination when the element still has a larger explicit height.
const from = panel.getBoundingClientRect().height
panel.style.height = ''
const to = panel.getBoundingClientRect().height
panel.style.height = `${from}px`
playDetailAnimation(panel,
[{ height: `${from}px`, opacity: from > 0 ? 1 : 0 }, { height: `${to}px`, opacity: 1 }],
{ duration: PANEL_DURATION_MS, easing: lifecycleEasing },
() => { clearPanelStyles(panel); done() }
)
}
const afterExpandPanelEnter = clearPanelStyles
const beforeExpandPanelLeave = (element: Element) => {
const panel = element as HTMLElement
const from = panel.getBoundingClientRect().height
detailMotion.cancel(panel)
panel.style.height = `${from}px`
panel.style.overflow = 'hidden'
panel.style.willChange = 'height, opacity'
}
const leaveExpandPanel = (element: Element, done: () => void) => {
const panel = element as HTMLElement
const from = panel.getBoundingClientRect().height
playDetailAnimation(panel,
[{ height: `${from}px`, opacity: 1 }, { height: '0px', opacity: 0 }],
{ duration: PANEL_DURATION_MS, easing: lifecycleEasing },
() => { clearPanelStyles(panel); done() }
)
}
const beforeRetrievalPanelEnter = beforeExpandPanelEnter
const enterRetrievalPanel = enterExpandPanel
const afterRetrievalPanelEnter = afterExpandPanelEnter
const beforeRetrievalPanelLeave = beforeExpandPanelLeave
const leaveRetrievalPanel = leaveExpandPanel
watch(
() => selectedFileDetail.value?.id,
() => {
@@ -2051,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 = {
@@ -2503,20 +2520,31 @@ onMounted(() => {
})
onUnmounted(() => {
lifecycleHeightRevision++
detailMotion.dispose()
mobileMediaQuery.removeEventListener('change', syncMobileViewport)
})
</script>
<style scoped>
.fcb-lifecycle-list {
.fcb-lifecycle-viewport {
overflow: visible;
}
.fcb-lifecycle-viewport > .fcb-lifecycle-list {
position: relative;
display: flex;
flex-direction: column;
gap: 10px;
overflow: visible;
}
.fcb-lifecycle-row {
position: relative;
overflow: visible;
contain: layout paint;
will-change: opacity, transform;
/* Keep transformed lifecycle cards from being clipped at their top border. */
contain: layout;
will-change: opacity;
}
.fcb-lifecycle-card {
@@ -2530,31 +2558,4 @@ onUnmounted(() => {
will-change: grid-template-rows, opacity, transform;
}
.fcb-expand-120-enter-active,
.fcb-expand-120-leave-active {
overflow: clip;
will-change: opacity, transform;
transition:
opacity 180ms cubic-bezier(0.22, 1, 0.36, 1),
transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.fcb-expand-120-enter-from,
.fcb-expand-120-leave-to {
opacity: 0;
transform: translate3d(0, -0.35rem, 0) scale(0.985);
}
.fcb-expand-120-enter-to,
.fcb-expand-120-leave-from {
opacity: 1;
transform: translate3d(0, 0, 0) scale(1);
}
@media (prefers-reduced-motion: reduce) {
.fcb-expand-120-enter-active,
.fcb-expand-120-leave-active {
transition-duration: 1ms;
}
}
</style>
+10 -9
View File
@@ -2,7 +2,7 @@
<div
:class="[
'min-h-[100dvh] flex items-center justify-center px-4 pb-6 pt-24 sm:px-6 sm:py-12 lg:px-8 transition-colors duration-200 relative overflow-x-hidden overflow-y-auto',
isDarkMode ? 'bg-[#10191e]' : 'bg-[#dfe9eb]'
isDarkMode ? 'bg-[#252b34]' : 'bg-[#dfe9eb]'
]"
>
<div class="absolute inset-0 z-0">
@@ -11,7 +11,7 @@
</div>
<div
class="max-w-md w-full space-y-8 backdrop-blur-lg p-8 rounded-[30px] border shadow-xl"
:class="[isDarkMode ? 'bg-[#1a2930]/82 border-[#31454d]' : 'bg-[#f2f6f5]/82 border-[#c8d7da]']"
:class="[isDarkMode ? 'bg-[#2c3440]/82 border-[#495765]' : 'bg-[#f2f6f5]/82 border-[#c8d7da]']"
>
<div>
<div class="mx-auto h-16 w-16 relative">
@@ -24,7 +24,7 @@
<div
:class="[
'absolute inset-1 rounded-full flex items-center justify-center',
isDarkMode ? 'bg-[#1a2930]' : 'bg-[#f2f6f5]'
isDarkMode ? 'bg-[#2c3440]' : 'bg-[#f2f6f5]'
]"
>
<BoxIcon :class="['h-8 w-8', isDarkMode ? 'text-[#a5c8d0]' : 'text-[#5f8796]']" />
@@ -68,29 +68,30 @@
:class="[
'appearance-none rounded-[30px] relative block w-full py-3 pl-4 pr-14 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-[#8fb2bf] focus:border-[#8fb2bf] focus:z-10 sm:text-sm backdrop-blur-sm',
isDarkMode
? 'bg-[#263941]/60 border-[#40545c] text-white placeholder-gray-400 hover:border-[#7199a8]'
? 'bg-[#2c3440]/60 border-[#495765] text-white placeholder-gray-400 hover:border-[#7199a8]'
: 'bg-[#edf4f5]/70 border-[#c8d8dc] text-[#2d4650] hover:border-[#9db6bd]'
]"
:placeholder="t('manage.login.passwordPlaceholder')"
/>
<button
type="button"
class="absolute inset-y-0 right-1 z-20 flex w-11 items-center justify-center rounded-full"
class="fcb-action fcb-input-action absolute inset-y-0 right-1 z-20 flex w-11 items-center justify-center rounded-full"
:aria-label="showPassword ? t('common.hidePassword') : t('common.showPassword')"
:title="showPassword ? t('common.hidePassword') : t('common.showPassword')"
:aria-pressed="showPassword"
@click="showPassword = !showPassword"
>
<EyeOffIcon v-if="showPassword" class="h-5 w-5" aria-hidden="true" />
<EyeIcon v-else class="h-5 w-5" aria-hidden="true" />
<EyeIcon v-if="showPassword" class="h-5 w-5" aria-hidden="true" />
<EyeOffIcon v-else class="h-5 w-5" aria-hidden="true" />
</button>
</div>
</div>
</div>
<div>
<button
<button class="fcb-action"
type="submit"
:class="[
'group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-[30px] text-white transition-all duration-300 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#8fb2bf] shadow-lg',
'fcb-button-primary group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-[30px] text-white transition-all duration-300 transform focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#8fb2bf] shadow-lg',
isDarkMode
? 'bg-gradient-to-r from-[#5f8796] to-[#6f9688] hover:from-[#527887] hover:to-[#5f8377] hover:shadow-[#6f98a6]/35'
: 'bg-gradient-to-r from-[#5f8796] to-[#6f9688] hover:from-[#527887] hover:to-[#5f8377] hover:shadow-[#9fb8bf]/45',
+12 -19
View File
@@ -96,11 +96,11 @@ onMounted(() => {
]"
:key="section[0]"
type="button"
class="inline-flex min-h-11 shrink-0 items-center justify-center rounded-full border px-3 text-center text-sm font-medium sm:px-4"
class="fcb-action inline-flex min-h-11 shrink-0 items-center justify-center rounded-full border px-3 text-center text-sm font-medium sm:px-4"
:class="activeSection === section[0]
? 'border-[#5f8796] bg-[#5f8796] text-white'
: isDarkMode
? 'border-[#40545c] bg-[#263941] text-[#d8e3e5]'
? 'border-[#495765] bg-[#2c3440] text-[#d8e3e5]'
: 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66]'"
:aria-current="activeSection === section[0] ? 'true' : undefined"
@click="scrollToSection(section[0])"
@@ -110,10 +110,10 @@ onMounted(() => {
</nav>
<div
class="theme-2026-card theme-2026-card-hover mx-auto max-w-6xl space-y-8 rounded-[24px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-6"
class="theme-2026-card fcb-static-container mx-auto max-w-6xl space-y-8 rounded-[24px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-6"
:class="[
isDarkMode
? 'border-[#40545c] bg-[#202f36]/90 hover:border-[#7199a8] hover:bg-[#263941] hover:shadow-black/25'
? 'border-[#495765] bg-[#252b34]/90 hover:border-[#7199a8] hover:bg-[#2c3440] hover:shadow-[#97aac8]/15'
: 'border-[#d7e3e5] bg-[#f8fbfb] hover:border-[#8fb2bf] hover:shadow-[#a9bdc2]/70'
]"
>
@@ -193,13 +193,14 @@ onMounted(() => {
/>
<button
type="button"
class="absolute inset-y-0 right-1 flex w-11 items-center justify-center rounded-lg"
class="fcb-action fcb-input-action absolute inset-y-0 right-1 flex w-11 items-center justify-center rounded-lg"
:aria-label="showAdminPassword ? t('common.hidePassword') : t('common.showPassword')"
:title="showAdminPassword ? t('common.hidePassword') : t('common.showPassword')"
:aria-pressed="showAdminPassword"
@click="showAdminPassword = !showAdminPassword"
>
<EyeOffIcon v-if="showAdminPassword" class="h-5 w-5" aria-hidden="true" />
<EyeIcon v-else class="h-5 w-5" aria-hidden="true" />
<EyeIcon v-if="showAdminPassword" class="h-5 w-5" aria-hidden="true" />
<EyeOffIcon v-else class="h-5 w-5" aria-hidden="true" />
</button>
</div>
<p id="settings-admin-password-note" class="text-xs" :class="isDarkMode ? 'text-gray-300' : 'text-gray-600'">
@@ -685,7 +686,7 @@ onMounted(() => {
<label
v-for="style in ['day', 'hour', 'minute', 'forever', 'count']"
:key="style"
class="relative inline-flex items-center group cursor-pointer"
class="fcb-choice relative inline-flex items-center group cursor-pointer"
>
<input
type="checkbox"
@@ -694,16 +695,8 @@ onMounted(() => {
class="peer sr-only"
/>
<div
class="px-4 py-2 rounded-full border-2 transition-all duration-200 select-none"
:class="[
config.expireStyle.includes(style)
? isDarkMode
? 'bg-indigo-600 border-indigo-600 text-white'
: 'bg-indigo-600 border-indigo-600 text-white'
: isDarkMode
? 'bg-gray-700 border-gray-600 text-gray-300 hover:border-indigo-500'
: 'bg-white border-gray-300 text-gray-700 hover:border-indigo-500'
]"
class="fcb-action fcb-choice-face inline-flex min-h-11 items-center justify-center px-4 py-2 rounded-full border transition-all duration-200 select-none"
:class="config.expireStyle.includes(style) ? 'fcb-button-primary' : 'fcb-button-secondary'"
>
{{ t(`manage.settings.expiration.${style}`) }}
</div>
@@ -797,7 +790,7 @@ onMounted(() => {
<div
class="fixed inset-x-0 bottom-0 z-40 border-t px-4 pt-3 backdrop-blur-xl lg:left-64"
:class="isDarkMode ? 'border-[#31454d] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
:class="isDarkMode ? 'border-[#495765] bg-[#252b34]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
role="status"
aria-live="polite"
>
+176 -76
View File
@@ -2,109 +2,209 @@
<div class="p-4 sm:p-6">
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
<div>
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">RECYCLE BIN</p>
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">回收站</h2>
<p class="mt-1 text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
<p class="hidden text-xs font-medium tracking-[0.16em] sm:block" :class="mutedTextClass">RECYCLE BIN</p>
<h2 class="mt-1 text-xl font-bold sm:text-2xl" :class="primaryTextClass">回收站</h2>
<p class="mt-1 text-xs leading-5 sm:text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后沿用原取件码。</p>
</div>
<div class="flex flex-wrap items-center gap-2">
<BaseButton variant="secondary" @click="openRetentionSettings">
<template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>
配置默认清理时间
</BaseButton>
<BaseButton variant="secondary" :loading="isLoading" @click="loadTrash">
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
刷新回收站
</BaseButton>
<div class="grid grid-cols-2 items-center gap-2 sm:flex">
<BaseButton variant="secondary" :disabled="busy" @click="openRetentionSettings"><template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>清理设置</BaseButton>
<BaseButton variant="secondary" :loading="isLoading" :disabled="busy" @click="loadTrash"><template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>刷新回收站</BaseButton>
</div>
</header>
<section class="mb-5 grid gap-3 sm:mb-6 sm:grid-cols-3">
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
<p class="text-xs" :class="mutedTextClass">回收站记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ total }}</strong>
</div>
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
<p class="text-xs" :class="mutedTextClass">可恢复</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ recoverableCount }}</strong>
</div>
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
<p class="text-xs" :class="mutedTextClass">仅审计记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ purgedCount }}</strong>
<section class="fcb-summary-grid mb-5 grid grid-cols-3 gap-2 sm:mb-6 sm:gap-3">
<div v-for="stat in stats" :key="stat.label" class="theme-2026-card theme-2026-card-hover fcb-secondary-card min-w-0 rounded-[20px] border p-2.5 shadow-sm sm:p-4" :class="panelClass">
<p class="text-xs" :class="mutedTextClass">{{ stat.label }}</p><strong class="mt-1 block text-xl sm:text-2xl" :class="primaryTextClass">{{ stat.value }}</strong>
</div>
</section>
<section class="theme-2026-card overflow-hidden rounded-[24px] border shadow-md sm:rounded-[30px]" :class="panelClass">
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6 sm:py-4" :class="dividerClass">
<div><h3 class="text-base font-semibold" :class="primaryTextClass">已删除文件</h3><p class="mt-0.5 text-xs" :class="mutedTextClass">物理清理只释放文件本体,文件记录和取件历史会持续保留。</p></div>
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'"><ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" />审计保留</span>
<section class="theme-2026-card mb-5 rounded-[24px] border p-3 sm:p-4" :class="panelClass" aria-label="回收站筛选">
<form class="fcb-filter-grid grid grid-cols-2 gap-3 xl:grid-cols-[minmax(0,1fr)_180px_180px_auto]" @submit.prevent="applyFilters">
<label class="col-span-2 min-w-0 xl:col-span-1"><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">关键词</span><input v-model="draft.keyword" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3" placeholder="搜索文件名或原取件码" /></label>
<label><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">记录状态</span><select v-model="draft.state" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3"><option value="all">全部状态</option><option value="recoverable">可恢复</option><option value="scheduled">定时清理</option><option value="permanent">永久保留</option><option value="purged">仅审计记录</option></select></label>
<label><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">移入原因</span><select v-model="draft.reason" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3"><option value="">全部原因</option><option value="manual">手动删除</option><option value="batch_delete">批量删除</option><option value="expired_time">保存到期</option><option value="expired_count">次数用尽</option><option value="expired_both">到期且次数用尽</option><option value="expired">历史自动回收</option></select></label>
<div class="col-span-2 flex justify-end gap-2 xl:col-span-1"><BaseButton type="submit" :disabled="busy || !supportsFilters" :loading="isLoading">筛选</BaseButton><BaseButton variant="secondary" :disabled="busy || !supportsFilters" @click="resetFilters">重置</BaseButton></div>
</form>
<p v-if="!isLoading && !supportsFilters" class="mt-3 text-xs" :class="mutedTextClass">当前服务尚未支持回收站筛选和批量操作,更新服务后即可使用。</p>
</section>
<div v-if="resultText" role="status" class="mb-4 rounded-2xl border p-3 text-sm" :class="panelClass">
<p>{{ resultText }}</p>
<ul v-if="operationResult" class="mt-2 max-h-36 overflow-auto text-xs leading-6">
<li v-for="failure in operationResult.failed" :key="failure.id">#{{ failure.id }}:{{ failure.reason }}</li>
<li v-for="entry in restoredEntries" :key="entry.id">#{{ entry.id }} 取件码:<code class="font-semibold">{{ entry.code }}</code></li>
</ul>
</div>
<p v-if="errorText" role="alert" class="mb-4 rounded-2xl border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-200">{{ errorText }}</p>
<div v-if="isLoading" class="flex min-h-64 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载回收站…</div>
<div v-else-if="errorText" class="px-4 py-12 text-center sm:px-6"><p class="text-sm font-medium text-red-600">{{ errorText }}</p><BaseButton class="mt-3" variant="secondary" @click="loadTrash">重新加载</BaseButton></div>
<div v-else-if="items.length === 0" class="px-4 py-14 text-center sm:px-6"><Trash2Icon class="mx-auto h-9 w-9" :class="mutedTextClass" /><p class="mt-3 text-sm" :class="mutedTextClass">回收站目前为空</p></div>
<section class="theme-2026-card overflow-hidden rounded-[24px] border sm:rounded-[30px]" :class="panelClass">
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6" :class="dividerClass">
<div><h3 class="text-base font-semibold" :class="primaryTextClass">文件记录</h3><p class="mt-0.5 text-xs" :class="mutedTextClass">{{ supportsFilters ? `筛选结果 ${total} 条 · ` : '' }}恢复文件,或调整保留期限。</p></div>
<span class="inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs" :class="isDarkMode ? 'bg-[#303946] text-[#dbe9ee]' : 'bg-[#e5f0f1] text-[#365a66]'"><ShieldCheckIcon class="h-3.5 w-3.5" />历史保留</span>
</div>
<div v-if="supportsBatch && items.length" class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6" :class="dividerClass">
<label class="flex min-h-9 cursor-pointer items-center gap-2 text-sm"><input type="checkbox" :checked="allSelected" :indeterminate="partiallySelected" :disabled="busy || isLoading || !eligibleIds.length" @change="toggleAll" />{{ selectedIds.length ? `已选择 ${selectedIds.length} 项` : '选择当前页可操作记录' }}</label>
<div v-if="selectedIds.length" class="grid w-full grid-cols-2 gap-2 sm:flex sm:w-auto sm:flex-wrap">
<BaseButton size="sm" variant="success" :disabled="busy || isLoading" @click="executeBatch('restore', selectedIds)">批量恢复</BaseButton>
<BaseButton size="sm" variant="outline" :disabled="busy || isLoading" @click="openRetention(selectedIds)">设置清理时间</BaseButton>
<BaseButton size="sm" variant="outline" :disabled="busy || isLoading" @click="executeBatch('retention', selectedIds, { retentionDays: 0 })">永久保留</BaseButton>
<BaseButton size="sm" variant="danger" :disabled="busy || isLoading" @click="askPurge(selectedIds)">批量清理</BaseButton>
<BaseButton size="sm" variant="secondary" :disabled="busy" @click="selectedIds = []">清空选择</BaseButton>
</div>
</div>
<div v-if="isLoading" class="flex min-h-40 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载回收站…</div>
<div v-else-if="!items.length" class="px-4 py-12 text-center" :class="mutedTextClass"><Trash2Icon class="mx-auto h-9 w-9" /><p class="mt-3 text-sm">{{ hasFilters ? '没有匹配的回收站记录' : '回收站目前为空' }}</p></div>
<div v-else class="divide-y" :class="dividerClass">
<article
v-for="item in items"
:key="item.id"
class="fcb-interactive-row group grid gap-3 px-4 py-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center sm:px-6"
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
>
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl" :class="item.isTrashPurged ? (isDarkMode ? 'bg-[#30383c] text-[#aab7ba]' : 'bg-[#edf0f1] text-[#61747a]') : (isDarkMode ? 'bg-amber-950/45 text-amber-300' : 'bg-amber-50 text-amber-700')"><FileX2Icon class="h-5 w-5" /></div>
<div class="min-w-0">
<div class="flex flex-wrap items-center gap-2"><p class="break-all text-sm font-semibold" :class="primaryTextClass">{{ fileName(item) }}</p><span class="rounded-full border px-2 py-0.5 text-[11px] font-medium" :class="badgeClass">{{ stateLabel(item) }}</span></div>
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs" :class="mutedTextClass"><span>旧取件码 {{ item.code }}</span><span>{{ formatFileSize(Number(item.size || 0), 1) }}</span><span>移入 {{ formatTimestamp(item.trashedAt || '') }}</span></div>
<p class="mt-1 text-xs" :class="mutedTextClass">{{ expiryLabel(item) }}</p>
</div>
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="success" :loading="busyId === item.id && busyAction === 'restore'" @click="restore(item)"><template #icon><RotateCcwIcon class="mr-2 h-4 w-4" /></template>恢复</BaseButton>
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="outline" :loading="busyId === item.id && busyAction === 'retention'" @click="makePermanent(item)"><template #icon><InfinityIcon class="mr-2 h-4 w-4" /></template>永久保留</BaseButton>
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="danger" :loading="busyId === item.id && busyAction === 'purge'" @click="purge(item)"><template #icon><EraserIcon class="mr-2 h-4 w-4" /></template>物理清理</BaseButton>
</div>
<article v-for="item in items" :key="item.id" class="fcb-interactive-row grid grid-cols-[auto_minmax(0,1fr)] gap-3 px-3 py-4 sm:px-6" :class="{ 'trash-row-selected': selectedIds.includes(item.id) }">
<label v-if="supportsBatch" class="flex h-11 items-center" :title="item.isTrashPurged ? '已清理记录不能操作' : ''"><input type="checkbox" v-model="selectedIds" :value="item.id" :aria-label="`选择 ${fileName(item)}`" :disabled="busy || item.isTrashPurged" /></label>
<TrashItemInfo :item="item" :is-dark-mode="isDarkMode" :now="now" :class="!supportsBatch ? 'col-span-2' : ''">
<template v-if="!item.isTrashPurged" #actions>
<BaseButton size="sm" variant="success" :disabled="busy" @click="restore(item)"><template #icon><RotateCcwIcon class="mr-1 h-4 w-4" /></template>恢复</BaseButton>
<BaseButton size="sm" variant="outline" :disabled="busy || !supportsCustomRetention" @click="openRetention([item.id])"><template #icon><CalendarClockIcon class="mr-1 h-4 w-4" /></template>清理时间</BaseButton>
<BaseButton size="sm" variant="outline" :disabled="busy || item.isTrashPermanent" @click="makePermanent(item)"><template #icon><InfinityIcon class="mr-1 h-4 w-4" /></template>永久保留</BaseButton>
<BaseButton size="sm" variant="danger" :disabled="busy" @click="askPurge([item.id])"><template #icon><EraserIcon class="mr-1 h-4 w-4" /></template>彻底删除</BaseButton>
</template>
</TrashItemInfo>
</article>
</div>
<DataPagination v-if="total > 0" :current-page="page" :page-size="size" :total="total" @page-change="changePage" @page-size-change="changePageSize" />
</section>
<BaseModal :show="retentionOpen" title="设置自动清理时间" :closable="!busy" @close="retentionOpen = false">
<p class="mb-4 text-sm" :class="mutedTextClass">为 {{ retentionIds.length }} 条记录设置相同的回收站保留期限。</p>
<label class="mb-4 flex cursor-pointer items-center gap-2 text-sm"><input v-model="retainForever" type="checkbox" :disabled="busy" />永久保留,不自动清理</label>
<NativeDateSelect v-if="!retainForever" v-model="cleanupTime" aria-label="自动清理时间" include-time />
<p class="mt-3 text-xs" :class="mutedTextClass">可选择未来 365 天内的时间。</p>
<p v-if="dialogError" role="alert" class="mt-3 text-sm text-red-700 dark:text-red-200">{{ dialogError }}</p>
<template #footer><BaseButton variant="secondary" :disabled="busy" @click="retentionOpen = false">取消</BaseButton><BaseButton :loading="busy" @click="saveRetention">保存时间</BaseButton></template>
</BaseModal>
<BaseModal :show="purgeOpen" title="确认彻底删除" :closable="!busy" @close="purgeOpen = false">
<p class="text-sm leading-6">将永久清理所选 <strong>{{ purgeIds.length }}</strong> 条记录的文件本体。此操作不可恢复,审计记录和取件历史仍保留。</p>
<p v-if="errorText" role="alert" class="mt-3 text-sm text-red-700 dark:text-red-200">{{ errorText }}</p>
<template #footer><BaseButton variant="secondary" :disabled="busy" @click="purgeOpen = false">取消</BaseButton><BaseButton variant="danger" :loading="busy" @click="confirmPurge">确认清理 {{ purgeIds.length }} 项</BaseButton></template>
</BaseModal>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { EraserIcon, FileX2Icon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
import { CalendarClockIcon, EraserIcon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
import BaseButton from '@/components/common/BaseButton.vue'
import BaseModal from '@/components/common/BaseModal.vue'
import NativeDateSelect from '@/components/common/NativeDateSelect.vue'
import TrashItemInfo from '@/components/manage/TrashItemInfo.vue'
import DataPagination from '@/components/common/DataPagination.vue'
import { useAdminTrash, useInjectedDarkMode } from '@/composables'
import type { TrashFileItem } from '@/types'
import { formatFileSize, formatTimestamp } from '@/utils/common'
import type { TrashFileItem, TrashListParams, TrashListResponse, TrashBatchRequest, TrashBatchResult, TrashRetentionRequest } from '@/types'
import { getErrorMessage } from '@/utils/common'
import { selectableTrashIds, buildTrashRetention, summarizeTrashBatch } from '@/utils/trashSelection'
const isDarkMode = useInjectedDarkMode()
const router = useRouter()
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention } = useAdminTrash()
const items = ref<TrashFileItem[]>([])
const page = ref(1)
const size = ref(20)
const total = ref(0)
const isLoading = ref(false)
const errorText = ref('')
const busyId = ref<number | null>(null)
const busyAction = ref('')
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention, batchTrash } = useAdminTrash()
const items = ref<TrashFileItem[]>([]), page = ref(1), size = ref(20), total = ref(0)
const summary = ref<TrashListResponse['summary']>()
const capabilities = ref<TrashListResponse['capabilities']>()
const supportsFilters = computed(() => capabilities.value?.filters === true)
const supportsBatch = computed(() => capabilities.value?.batch === true)
const supportsCustomRetention = computed(() => capabilities.value?.customRetention === true)
const blankFilters = () => ({ keyword: '', state: 'all' as NonNullable<TrashListParams['state']>, reason: '' as NonNullable<TrashListParams['reason']> })
const draft = ref(blankFilters()), applied = ref(blankFilters())
const hasFilters = computed(() => Boolean(applied.value.keyword || applied.value.reason || applied.value.state !== 'all'))
const isLoading = ref(false), busy = ref(false), errorText = ref(''), resultText = ref('')
const operationResult = ref<TrashBatchResult | null>(null)
const restoredEntries = computed(() => operationResult.value?.succeeded.filter(entry => entry.code) || [])
const selectedIds = ref<number[]>([])
const eligibleIds = computed(() => selectableTrashIds(items.value))
const allSelected = computed(() => eligibleIds.value.length > 0 && eligibleIds.value.every(id => selectedIds.value.includes(id)))
const partiallySelected = computed(() => selectedIds.value.length > 0 && !allSelected.value)
const toggleAll = () => { selectedIds.value = allSelected.value ? [] : [...eligibleIds.value] }
const now = ref(Date.now())
let clockTimer: ReturnType<typeof setInterval> | undefined
onMounted(() => { clockTimer = setInterval(() => { now.value = Date.now() }, 60_000) })
onUnmounted(() => { clearInterval(clockTimer); loadVersion++ })
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
const badgeClass = computed(() => isDarkMode.value ? 'border-[#50666f] text-[#b8d6de]' : 'border-[#c8d8dc] text-[#4e6c75]')
const recoverableCount = computed(() => items.value.filter(item => !item.isTrashPurged).length)
const purgedCount = computed(() => items.value.filter(item => item.isTrashPurged).length)
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#adbec6]' : 'text-[#617980]')
const panelClass = computed(() => isDarkMode.value ? 'border-[#495765] bg-[#252b34]' : 'border-[#d7e3e5] bg-[#f8fbfb]')
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#495765] border-[#495765]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
const stats = computed(() => [
{ label: '回收站记录', value: summary.value?.total ?? total.value },
{ label: '可恢复', value: summary.value?.recoverable ?? (total.value <= size.value ? items.value.filter(item => !item.isTrashPurged).length : '—') },
{ label: '仅审计记录', value: summary.value?.purged ?? (total.value <= size.value ? items.value.filter(item => item.isTrashPurged).length : '—') }
])
const fileName = (item: TrashFileItem) => item.name || `${item.prefix || ''}${item.suffix || ''}` || '未命名文件'
const stateLabel = (item: TrashFileItem) => item.isTrashPurged ? '仅审计记录' : item.isTrashPermanent ? '永久保留' : '可恢复'
const expiryLabel = (item: TrashFileItem) => item.isTrashPurged ? `文件本体已于 ${formatTimestamp(item.trashPurgedAt || '')} 清理` : item.isTrashPermanent ? '不会自动清理文件本体' : `预计清理:${formatTimestamp(item.trashExpiresAt || '')}`
const openRetentionSettings = () => { void router.push({ path: '/admin/settings', hash: '#settings-upload' }) }
const loadTrash = async () => { isLoading.value = true; errorText.value = ''; try { const detail = await fetchTrash({ page: page.value, size: size.value }); items.value = detail?.data || []; total.value = Number(detail?.total || 0) } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '回收站加载失败,请稍后重试。' } finally { isLoading.value = false } }
const run = async (item: TrashFileItem, action: string, operation: () => Promise<unknown>) => { busyId.value = item.id; busyAction.value = action; try { await operation(); await loadTrash() } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '操作未完成,请稍后重试。' } finally { busyId.value = null; busyAction.value = '' } }
const restore = (item: TrashFileItem) => run(item, 'restore', () => restoreTrashItem(item.id))
const makePermanent = (item: TrashFileItem) => run(item, 'retention', () => updateTrashRetention(item.id, 0))
const purge = (item: TrashFileItem) => { if (!window.confirm(`确定物理清理“${fileName(item)}”吗?文件本体不可恢复,但审计记录会永久保留。`)) return; void run(item, 'purge', () => purgeTrashItem(item.id)) }
const changePage = (nextPage: number) => { page.value = nextPage; void loadTrash() }
const changePageSize = (nextSize: number) => { size.value = nextSize; page.value = 1; void loadTrash() }
let loadVersion = 0
const loadTrash = async () => {
const version = ++loadVersion
isLoading.value = true; errorText.value = ''
try {
let detail = await fetchTrash({ page: page.value, size: size.value, ...applied.value })
if (version !== loadVersion) return
const lastPage = Math.max(1, Math.ceil((detail?.total || 0) / size.value))
if (page.value > lastPage) { page.value = lastPage; detail = await fetchTrash({ page: page.value, size: size.value, ...applied.value }) }
if (version !== loadVersion) return
items.value = detail?.data || []; total.value = Number(detail?.total || 0)
summary.value = detail?.summary; capabilities.value = detail?.capabilities
selectedIds.value = selectedIds.value.filter(id => eligibleIds.value.includes(id))
} catch (error) { if (version === loadVersion) errorText.value = getErrorMessage(error, '回收站加载失败,请重试') }
finally { if (version === loadVersion) isLoading.value = false }
}
const applyFilters = () => { if (!supportsFilters.value || busy.value) return; applied.value = { ...draft.value, keyword: draft.value.keyword.trim() }; selectedIds.value = []; page.value = 1; void loadTrash() }
const resetFilters = () => { draft.value = blankFilters(); applyFilters() }
const changePage = (value: number) => { if (busy.value) return; page.value = value; selectedIds.value = []; void loadTrash() }
const changePageSize = (value: number) => { if (busy.value) return; size.value = value; page.value = 1; selectedIds.value = []; void loadTrash() }
const runSingle = async (operation: () => Promise<unknown>, message: string) => {
if (busy.value) return false
busy.value = true; errorText.value = ''; resultText.value = ''; operationResult.value = null
try { await operation(); resultText.value = message; await loadTrash(); return true }
catch (error) { errorText.value = getErrorMessage(error, '操作失败,请重试'); return false }
finally { busy.value = false }
}
const executeBatch = async (action: TrashBatchRequest['action'], ids: number[], retention: TrashRetentionRequest = {}) => {
if (busy.value || !ids.length || !supportsBatch.value) return false
busy.value = true; errorText.value = ''; resultText.value = ''; operationResult.value = null
try {
const response = await batchTrash({ action, ids: [...ids], ...retention })
if (!response.detail) throw new Error('未收到操作结果,请刷新后核对')
operationResult.value = response.detail; resultText.value = summarizeTrashBatch(response.detail)
selectedIds.value = response.detail.failed.map(entry => entry.id)
await loadTrash()
return response.detail.failed.length === 0
} catch (error) { errorText.value = getErrorMessage(error, '操作失败,请重试'); return false }
finally { busy.value = false }
}
const restore = (item: TrashFileItem) => supportsBatch.value ? executeBatch('restore', [item.id]) : runSingle(() => restoreTrashItem(item.id), '已恢复,请到文件管理查看取件码')
const makePermanent = (item: TrashFileItem) => supportsBatch.value ? executeBatch('retention', [item.id], { retentionDays: 0 }) : runSingle(() => updateTrashRetention(item.id, { retentionDays: 0 }), '已设为永久保留')
const retentionOpen = ref(false), retentionIds = ref<number[]>([]), retainForever = ref(false), cleanupTime = ref(''), dialogError = ref('')
const localDateTime = (date: Date) => `${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,'0')}-${String(date.getDate()).padStart(2,'0')}T${String(date.getHours()).padStart(2,'0')}:${String(date.getMinutes()).padStart(2,'0')}`
const openRetention = (ids: number[]) => {
retentionIds.value = [...ids]; dialogError.value = ''
const item = ids.length === 1 ? items.value.find(item => item.id === ids[0]) : undefined
const current = new Date(item?.trashExpiresAt || '').getTime()
retainForever.value = item?.isTrashPermanent === true
cleanupTime.value = localDateTime(new Date(Number.isFinite(current) && current > Date.now() ? current : Date.now()+30*86400000))
retentionOpen.value = true
}
const saveRetention = async () => {
try {
dialogError.value = ''
const payload = buildTrashRetention(retainForever.value, cleanupTime.value, Date.now())
const ok = await executeBatch('retention', retentionIds.value, payload)
if (ok) retentionOpen.value = false
else dialogError.value = errorText.value || resultText.value || '操作未完成,请重试'
} catch (error) { dialogError.value = getErrorMessage(error, '请选择有效的清理时间') }
}
const purgeOpen = ref(false), purgeIds = ref<number[]>([])
const askPurge = (ids: number[]) => { errorText.value = ''; purgeIds.value = [...ids]; purgeOpen.value = true }
const confirmPurge = async () => {
const ok = supportsBatch.value ? await executeBatch('purge', purgeIds.value) : await runSingle(() => purgeTrashItem(purgeIds.value[0]), '文件本体已清理,审计记录已保留')
if (ok || operationResult.value) purgeOpen.value = false
}
void loadTrash()
</script>
<style scoped>
.trash-row-selected { background: var(--fcb-row-hover); }
</style>
+9 -1
View File
@@ -1,12 +1,20 @@
import typography from '@tailwindcss/typography'
import plugin from 'tailwindcss/plugin'
import macaron from './src/theme/macaron.json'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
extend: {},
extend: { colors: macaron.colors },
},
plugins: [
typography,
plugin(({ addBase }) => {
const variables = mode => Object.fromEntries(Object.entries(macaron.buttons[mode]).flatMap(([variant, values]) =>
Object.entries(values).map(([key, value]) => [`--fcb-button-${variant}-${key}`, value])
))
addBase({ ':root': variables('light'), '.dark': variables('dark') })
}),
],
}
+63
View File
@@ -0,0 +1,63 @@
# Detail motion regression checks
Requires Node 22.6+ for the TypeScript unit tests (no extra test dependencies).
- `npm run test:motion`: animation completion, cancellation, reversal and reduced motion.
- `npm run test:motion:coverage`: coverage of `src/utils/detailMotion.ts` only.
Browser integration uses the actual Vue file-detail view and backend data. Start
Vite with the desired test backend, sign in, and open a file with more than three
lifecycle rows and at least one retrieval event. In that page's DevTools console:
```js
await (await import('/theme-assets/tests/detailMotion.browser.mjs')).runDetailMotionChecks()
```
Run again at 390px width, then with `prefers-reduced-motion: reduce` emulated:
```js
await (await import('/theme-assets/tests/detailMotion.browser.mjs')).runDetailMotionChecks({ reducedMotion: true })
```
Checks three expand/collapse cycles, nonidentical height endpoints, return to
natural height, visible retrieval records, no vertical record transform, rapid
reversals and final collapsed layout. It only toggles presentation and never
uploads, deletes, restores or changes file data. These checks do not measure
whole-project coverage or validate the storage implementation.
## Recycle bin information
- `npm run test:trash`: relative-time boundary tests and Vue SSR integration
checks for normal, urgent, permanent, purged and incomplete records.
- `npm run test:trash:coverage`: coverage of `src/utils/trashPresentation.ts` only.
Seven days is inclusive in both directions; older or more distant dates use
exact local date/time. Relative labels refresh every minute. Native title text
retains the exact date/time. The three-day cleanup warning is independent of
the seven-day formatting boundary. These tests do not modify backend data.
## 2026 buttons, palette and responsive controls
- `npm run test:ui`: palette text contrast, native action coverage, stationary
large sections, no submit hover overlays, and real Vue component SSR tests.
- With Vite running, open `/theme-assets/tests/ui-system.html` in a clean browser
window. Test at 320/390/430px and desktop widths; append `?dark` for dark mode.
The fixture uses real components and checks rendered heights, same-row pagination,
date part styling, leap-year changes and pagination emissions. It displays its
results; hover on buttons/cards to inspect motion without business operations.
The native UI harness is separate from server-side integration tests. Code
coverage for the existing motion/time helpers does not measure CSS coverage.
Final interaction rules: large settings/table/section containers stay fixed;
inner cards and action buttons retain their motion. List rows only fade their
background with no border or box-shadow. Light card shadows are bright at the
upper left and shaded at the lower right; dark mode reverses that direction.
Primary submit actions must not add white/gradient hover overlays.
## 清理失败弹窗
`purgeFailure.browser.mjs` 导出 `runPurgeFailureChecks(page, failure)`,接受独立
Playwright Page。Vite 固定运行于 `127.0.0.1:5180`;分别传入 `http` 和 `network`
验证服务端 500、断网时错误显示于弹窗内、原记录保留,以及重新打开时清空旧错误。
测试拦截全部管理 API,不会修改部署实例。
+10
View File
@@ -0,0 +1,10 @@
import {test} from 'node:test'
import assert from 'node:assert/strict'
import {fitValueFontSize} from '../src/utils/adaptiveValue.ts'
test('fits the value to available width without exceeding readable bounds',()=>{
assert.equal(fitValueFontSize(120,100,24,14),24)
assert.equal(fitValueFontSize(80,120,24,14),16)
assert.equal(fitValueFontSize(20,120,24,14),14)
assert.equal(fitValueFontSize(0,120,24,14),24)
assert.equal(fitValueFontSize(100,0,24,14),24)
})
+25
View File
@@ -0,0 +1,25 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { summarizeAnalyticsWindow } from '../src/utils/analyticsWindow.ts'
const rows = [
{ date: 'a', downloads: 1, uploads: 2, downloadTraffic: 100, uploadTraffic: 10 },
{ date: 'b', downloads: 3, uploads: 4, downloadTraffic: 300, uploadTraffic: 30 },
{ date: 'c', downloads: 5, uploads: 6, downloadTraffic: 500, uploadTraffic: 50 },
{ date: 'd', downloads: 7, uploads: 8, downloadTraffic: 700, uploadTraffic: 70 }
]
test('window totals only include the currently visible chart range', () => {
assert.deepEqual(summarizeAnalyticsWindow(rows, 1, 2), {
downloads: 8, uploads: 10, downloadTraffic: 800, uploadTraffic: 80
})
assert.deepEqual(summarizeAnalyticsWindow(rows, 2.3, 1.2), {
downloads: 12, uploads: 14, downloadTraffic: 1200, uploadTraffic: 120
})
})
test('window totals clamp outside offsets and empty rows safely', () => {
assert.deepEqual(summarizeAnalyticsWindow(rows, -4, 1), {
downloads: 1, uploads: 2, downloadTraffic: 100, uploadTraffic: 10
})
assert.deepEqual(summarizeAnalyticsWindow(rows, 99, 10), {
downloads: 0, uploads: 0, downloadTraffic: 0, uploadTraffic: 0
})
})
+77
View File
@@ -0,0 +1,77 @@
// Run in the local app with a file detail dialog open (more than 3 lifecycle rows
// and retrieval events). Reads real data and toggles presentation only.
export async function runDetailMotionChecks({ reducedMotion = false } = {}) {
const results = []
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
const assert = (condition, message) => { if (!condition) throw new Error(message) }
const lifecycle = () => document.querySelector('.fcb-lifecycle-viewport')
const toggle = (kind, expanded) => {
const label = kind === 'lifecycle'
? (expanded ? '展开全部生命周期记录' : '收起生命周期记录')
: (expanded ? '展开全部取件记录' : '收起取件记录')
const button = [...document.querySelectorAll('button')].find(b => b.textContent.includes(label))
if (button) button.click()
}
const assertNaturalHeight = label => {
const v = lifecycle()
const actual = v.getBoundingClientRect().height
const expected = v.firstElementChild.getBoundingClientRect().height
assert(Math.abs(actual - expected) < 1, `${label}: viewport ${actual}, content ${expected}`)
assert(!v.style.height && v.getAnimations().length === 0, `${label}: retained height effect`)
results.push({ label, height: actual, contentHeight: expected })
}
assert(lifecycle(), 'Open a file detail dialog first')
toggle('lifecycle', false)
await wait(500)
const initial = lifecycle().getBoundingClientRect().height
for (let cycle = 0; cycle < 3; cycle++) {
toggle('lifecycle', true)
await wait(30)
if (!reducedMotion) {
const animation = lifecycle().getAnimations()[0]
assert(animation, 'Missing outer height animation')
const frames = animation.effect.getKeyframes()
assert(frames[0].height !== frames[1].height, 'Identical start and end heights')
assert(animation.effect.getTiming().duration === 420, 'Unexpected height duration')
}
await wait(500)
assertNaturalHeight(`expanded-${cycle}`)
toggle('lifecycle', false)
await wait(500)
assertNaturalHeight(`collapsed-${cycle}`)
assert(Math.abs(lifecycle().getBoundingClientRect().height - initial) < 1, 'Collapsed height drift')
assert(lifecycle().querySelectorAll('.fcb-lifecycle-row').length === 3, 'Unexpected collapsed rows')
}
toggle('lifecycle', true)
await wait(500)
toggle('retrieval', true)
await wait(500)
const panel = document.querySelector('.fcb-retrieval-panel')
assert(panel && panel.getBoundingClientRect().height > 0, 'Retrieval panel is hidden')
assert(panel.querySelectorAll('.font-medium').length > 0, 'Missing retrieval records')
assert(getComputedStyle(panel).transform === 'none', 'Retrieval records translate vertically')
assertNaturalHeight('retrieval-expanded')
for (let i = 0; i < 6; i++) {
const before = panel.getBoundingClientRect().height
toggle('retrieval', i % 2 !== 0)
await wait(60)
const after = panel.getBoundingClientRect().height
assert(i % 2 === 0 ? after <= before : after >= before, 'Reversal jumps in the wrong direction')
}
await wait(500)
assertNaturalHeight('rapid-retrieval-reversal')
for (let i = 0; i < 6; i++) {
toggle('lifecycle', i % 2 !== 0)
await wait(60)
}
await wait(500)
assertNaturalHeight('rapid-lifecycle-reversal')
toggle('retrieval', false)
await wait(500)
assert(getComputedStyle(document.querySelector('.fcb-retrieval-panel')).display === 'none', 'Retrieval panel remains visible')
assertNaturalHeight('retrieval-collapsed')
toggle('lifecycle', false)
await wait(500)
assertNaturalHeight('final-collapsed')
return results
}
+76
View File
@@ -0,0 +1,76 @@
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { createDetailMotion } from '../src/utils/detailMotion.ts'
class FakeAnimation extends EventTarget {
cancelled = false
cancel() { this.cancelled = true; this.dispatchEvent(new Event('cancel')) }
finish() { this.dispatchEvent(new Event('finish')) }
}
class FakeElement {
animations = []
animate(frames, options) {
const animation = new FakeAnimation()
Object.assign(animation, { frames, options })
this.animations.push(animation)
return animation
}
getAnimations() { return this.animations.filter(a => !a.cancelled) }
}
const frames = [{ height: '186px' }, { height: '429px' }]
test('completed height effects are removed so content can shrink and nested records can grow', () => {
const motion = createDetailMotion(() => false)
const element = new FakeElement()
let done = 0
motion.play(element, frames, { duration: 420 }, () => done++)
element.animations[0].finish()
assert.equal(done, 1)
assert.equal(element.getAnimations().length, 0)
})
test('rapid reversal finishes the previous transition once and ignores its stale finish event', () => {
const motion = createDetailMotion(() => false)
const element = new FakeElement()
let first = 0, second = 0
motion.play(element, frames, {}, () => first++)
const old = element.animations[0]
motion.play(element, frames.toReversed(), {}, () => second++)
old.finish()
assert.equal(first, 1)
assert.equal(second, 0)
assert.equal(element.getAnimations().length, 1)
element.animations[1].finish()
assert.equal(second, 1)
assert.equal(element.getAnimations().length, 0)
})
test('explicit cancellation removes effects and calls completion only once', () => {
const motion = createDetailMotion(() => false)
const element = new FakeElement()
let done = 0
motion.play(element, frames, {}, () => done++)
motion.cancel(element)
motion.cancel(element)
element.animations[0].finish()
assert.equal(done, 1)
assert.equal(element.getAnimations().length, 0)
})
test('reduced motion skips animations and still completes', () => {
const motion = createDetailMotion(() => true)
const element = new FakeElement()
let done = 0
motion.play(element, frames, {}, () => done++)
assert.equal(done, 1)
assert.equal(element.animations.length, 0)
})
test('external cancellation and disposal release all owned animations', () => {
const motion = createDetailMotion(() => false)
const a = new FakeElement(), b = new FakeElement()
let done = 0
motion.play(a, frames, {}, () => done++)
a.animations[0].cancel()
motion.play(a, frames, {}, () => done++)
motion.play(b, frames, {}, () => done++)
motion.dispose()
assert.equal(done, 3)
assert.equal(a.getAnimations().length + b.getAnimations().length, 0)
})
+98
View File
@@ -0,0 +1,98 @@
<template>
<main :style="{padding:'12px',background:'var(--fcb-bg)',color:'var(--fcb-text)'}">
<h2 style="font-size:18px;font-weight:bold">2026 组件回归 · {{ width }}px</h2>
<p style="font-size:12px;margin:8px 0">本地测试,无业务数据</p>
<pre data-results style="white-space:pre-wrap;font-size:12px;margin:10px 0;color:inherit">{{ result }}</pre>
<div style="display:flex;flex-wrap:wrap;gap:8px;margin:12px 0" data-buttons>
<BaseButton v-for="variant in variants" :key="variant" :variant="variant" @pointerenter="trackHover" @pointerleave="trackLeave">{{ labels[variant] }}</BaseButton>
<button class="fcb-action inline-flex min-h-11 items-center rounded-xl border px-3 py-2 text-sm" @pointerenter="trackHover" @pointerleave="trackLeave">展开</button>
<BaseButton class="fcb-refresh-button" variant="secondary" @pointerenter="trackHover" @pointerleave="trackLeave"><template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>刷新</BaseButton>
<BaseButton disabled>禁用</BaseButton><BaseButton loading>加载</BaseButton>
<button class="fcb-action fcb-icon-action flex h-11 w-11 items-center justify-center" aria-label="关闭"><XIcon class="h-6 w-6" /></button>
</div>
<p style="font-size:12px" data-hover>{{ hoverResult }}</p>
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">下载 / 上传趋势</h3>
<div class="analytics-date-range grid w-full min-w-0 grid-cols-2 gap-2">
<NativeDateSelect v-model="start" aria-label="开始日期" />
<NativeDateSelect v-model="end" aria-label="结束日期" />
</div>
<div class="grid w-full grid-cols-3 gap-2" style="margin:8px 0">
<BaseButton variant="outline">放大</BaseButton><BaseButton variant="outline">缩小</BaseButton><BaseButton variant="outline">重置</BaseButton>
</div>
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">过期方式(多选)</h3>
<div style="display:flex;flex-wrap:wrap;gap:8px" data-choices>
<label v-for="(label, index) in ['天','小时','分钟','永久','次数']" :key="label" class="fcb-choice relative inline-flex items-center group cursor-pointer">
<input type="checkbox" v-model="chosen" :value="label" class="peer sr-only" />
<div class="fcb-action fcb-choice-face inline-flex min-h-11 items-center justify-center px-4 py-2 rounded-full border" :class="chosen.includes(label)?'fcb-button-primary':'fcb-button-secondary'" @pointerenter="trackHover" @pointerleave="trackLeave">{{ label }}</div>
</label>
</div>
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">列表高亮</h3>
<table style="width:100%"><tbody><tr v-for="n in 2" :key="n" class="fcb-list-row" @pointerenter="trackHover" @pointerleave="trackLeave"><td style="padding:12px;font-size:12px">示例文件 {{ n }}</td></tr></tbody></table>
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">分页</h3>
<DataPagination :current-page="page" :page-size="size" :total="85" @page-change="page=$event" @page-size-change="size=$event;page=1" />
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">简短统计</h3>
<div class="fcb-summary-grid grid grid-cols-3 gap-2">
<div @pointerenter="trackHover" @pointerleave="trackLeave" v-for="(label,i) in ['回收站记录','可恢复','仅审计记录']" :key="label" class="theme-2026-card theme-2026-card-hover fcb-secondary-card min-w-0 rounded-[20px] border p-2.5 shadow-sm"><p class="text-xs">{{ label }}</p><strong class="mt-1 block text-xl">{{ i===2?0:1 }}</strong></div>
</div>
<h3 style="margin:16px 0 8px;font-size:16px;font-weight:bold">常规统计</h3>
<div class="grid grid-cols-2 gap-3">
<StatCard title="存储空间" value="481.9 MB" :icon="HardDriveIcon" icon-color="purple"><template #description>今日新增 0 Bytes</template></StatCard>
<StatCard title="累计取件" value="123456789" :icon="HardDriveIcon" icon-color="green"><template #description>运行 10 天</template></StatCard>
</div>
</main>
</template>
<script setup>
import { ref, provide, onMounted, nextTick } from 'vue'
import BaseButton from '/src/components/common/BaseButton.vue'
import DataPagination from '/src/components/common/DataPagination.vue'
import NativeDateSelect from '/src/components/common/NativeDateSelect.vue'
import StatCard from '/src/components/common/StatCard.vue'
import { HardDriveIcon, RefreshCwIcon, XIcon } from 'lucide-vue-next'
const dark = new URLSearchParams(location.search).has('dark')
provide('isDarkMode', ref(dark))
document.documentElement.classList.toggle('dark', dark)
const width=innerWidth
const variants=['primary','secondary','success','danger','outline']
const labels={primary:'详情',secondary:'编辑',success:'恢复',danger:'删除',outline:'更多'}
const start=ref('2026-05-19'),end=ref('2026-09-16'),page=ref(1),size=ref(20)
const chosen=ref(['天'])
const result=ref('检测中…'),hoverResult=ref('将鼠标移到按钮上验证上浮')
const wait=ms=>new Promise(r=>setTimeout(r,ms))
const check=(condition,message)=>{if(!condition)throw new Error(message)}
function trackHover(event) {
const el=event.currentTarget
setTimeout(()=>{hoverResult.value=`${el.textContent.trim()}:移入 ${getComputedStyle(el).translate} / ${getComputedStyle(el).transform};过渡 ${getComputedStyle(el).transitionDuration};阴影 ${getComputedStyle(el).boxShadow}`},380)
}
function trackLeave(event){const el=event.currentTarget;setTimeout(()=>{hoverResult.value=`${el.textContent.trim()}:移出 ${getComputedStyle(el).translate} / ${getComputedStyle(el).transform}`},380)}
onMounted(async()=>{
try {
await wait(400)
const buttonHeights=[...document.querySelectorAll('[data-buttons] .fcb-action')].map(e=>e.getBoundingClientRect().height)
if(width<640) check(buttonHeights.every(h=>h>=36&&h<=40.5),`按钮高度异常 ${buttonHeights}`)
const controls=document.querySelector('.fcb-pagination-controls')
const sizeSelect=controls.querySelector('select')
const before=controls.querySelector('button')
if(width<640) check(Math.abs(sizeSelect.getBoundingClientRect().top-before.getBoundingClientRect().top)<2,'分页下拉框不同行')
check(document.documentElement.scrollWidth<=innerWidth,'存在横向溢出')
check([...document.querySelectorAll('.fcb-action')].every(e=>getComputedStyle(e).transitionProperty.includes('translate')),'按钮缺少位移过渡')
const statCard=document.querySelector('.fcb-summary-grid > div')
check(statCard.classList.contains('theme-2026-card-hover'),'统计卡片未接入悬浮')
if(dark) check(getComputedStyle(statCard,'::before').display==='none','深色卡片残留白色渐变高光')
check([...document.querySelectorAll('.native-date-part')].every(e=>getComputedStyle(e).boxShadow==='none'&&getComputedStyle(e).backgroundColor==='rgba(0, 0, 0, 0)'),'年月日仍有独立阴影或背景')
start.value='2024-01-31';await nextTick()
const select=document.querySelector('[aria-label="开始日期月"]');select.value='2';select.dispatchEvent(new Event('change',{bubbles:true}));await nextTick()
check(start.value==='2024-02-29','月份切换没有正确保留闰日')
const year=document.querySelector('[aria-label="开始日期年"]');year.value='2025';year.dispatchEvent(new Event('change',{bubbles:true}));await nextTick()
check(start.value==='2025-02-28','平年日期没有正确裁到月底')
const checks=[...document.querySelectorAll('[data-choices] input')]
checks[1].click();await nextTick();check(chosen.value.includes('小时')&&chosen.value.includes('天'),'多选行为被改变')
checks[1].click();await nextTick();check(chosen.value.length===1,'取消选中失败')
sizeSelect.value='50';sizeSelect.dispatchEvent(new Event('change',{bubbles:true}));await nextTick()
check(size.value===50&&page.value===1,'每页数量事件失败')
controls.querySelectorAll('button')[controls.querySelectorAll('button').length-1].click();await nextTick()
check(page.value===2,'下一页事件失败')
start.value='2026-05-19';size.value=20;page.value=1;await nextTick()
result.value=`通过:按钮 ${buttonHeights[0].toFixed(1)}px;分页同排;日期无分块;日期/分页交互正常;无横向溢出。 系统深色:${matchMedia('(prefers-color-scheme: dark)').matches};颜色方案:${getComputedStyle(document.documentElement).colorScheme};外部样式:${[...document.querySelectorAll('style')].filter(e=>(e.className+' '+e.id).includes('darkreader')).length}。`
} catch(e) {result.value=`失败:${e.message}`}
})
</script>
+39
View File
@@ -0,0 +1,39 @@
import assert from 'node:assert/strict'
// Call with a fresh Playwright page and the local Vite fixture; all API calls
// are intercepted, so this check cannot modify a deployed backend.
export async function runPurgeFailureChecks(page, failure = 'http') {
await page.route('**/*', route => {
const url = new URL(route.request().url())
return url.hostname === '127.0.0.1' ? route.continue() : route.abort()
})
await page.route('**/admin/**', async route => {
const url = new URL(route.request().url())
const headers = { 'access-control-allow-origin': '*', 'access-control-allow-headers': '*', 'access-control-allow-methods': '*' }
if (route.request().method() === 'OPTIONS') return route.fulfill({ status: 204, headers })
if (url.pathname === '/admin/trash/list') {
return route.fulfill({ json: { code: 200, detail: {
page: 1, size: 20, total: 1,
data: [{ id: 900001, name: 'isolated-check.txt', code: 'CHECK001', size: 16,
isTrashPurged: false, isTrashPermanent: true, trashReason: 'manual' }],
capabilities: { batch: true, filters: true, customRetention: true },
summary: { total: 1, recoverable: 1, purged: 0 }
} }, headers })
}
if (url.pathname === '/admin/trash/batch') {
assert.deepEqual(route.request().postDataJSON(), { action: 'purge', ids: [900001] })
return failure === 'network' ? route.abort() : route.fulfill({ status: 500, json: { detail: '测试服务暂时不可用' }, headers })
}
throw new Error(`Unexpected API request: ${url.pathname}`)
})
await page.goto('http://127.0.0.1:5180/theme-assets/tests/trash-workflow.html')
await page.getByRole('button', { name: '彻底删除', exact: true }).click()
const dialog = page.getByRole('dialog')
await dialog.getByRole('button', { name: '确认清理 1 项' }).click()
await dialog.getByRole('alert').waitFor({ state: 'visible', timeout: 4000 })
assert.ok((await dialog.getByRole('alert').textContent()).trim())
assert.equal(await page.locator('article').count(), 1)
await dialog.getByRole('button', { name: '取消', exact: true }).click()
await page.getByRole('button', { name: '彻底删除', exact: true }).click()
assert.equal(await page.getByRole('dialog').getByRole('alert').count(), 0)
}
+6
View File
@@ -0,0 +1,6 @@
<!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>回收站交互验证 · 独立测试数据</title><div style="position:sticky;top:0;z-index:90;padding:10px 16px;background:#e8e0f2;color:#504165;font:13px sans-serif">独立测试数据 · 用于验证筛选、批量操作和清理时间,不连接线上文件</div><div id="app"></div><script type="module">
import {createApp,ref} from 'vue';import {createRouter,createMemoryHistory} from 'vue-router';import {createI18n} from 'vue-i18n';import TrashView from '/src/views/manage/TrashView.vue';import zh from '/src/i18n/locales/zh-CN.ts';import '/src/assets/style/main.css';
const dark=new URLSearchParams(location.search).has('dark');document.documentElement.classList.toggle('dark',dark);
const app=createApp(TrashView);app.provide('isDarkMode',ref(dark));app.use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}}));app.use(createRouter({history:createMemoryHistory(),routes:[{path:'/',component:{template:'<div/>'}}]}));app.mount('#app');
if(new URLSearchParams(location.search).has('autotest')) import('./trashWorkflow.browser.mjs').then(m=>m.runTrashWorkflowChecks());
</script></html>
@@ -0,0 +1,40 @@
import { test, before, after } from 'node:test'
import assert from 'node:assert/strict'
import { createServer } from 'vite'
import { createSSRApp, h } from 'vue'
import { renderToString } from 'vue/server-renderer'
let server, Card
before(async () => {
server = await createServer({ server: { middlewareMode: true, watch: null }, appType: 'custom' })
Card = (await server.ssrLoadModule('/src/components/manage/TrashItemInfo.vue')).default
})
after(async () => { await server?.close() })
const now = new Date('2026-09-16T12:00:00+08:00').getTime()
const item = { id: 1, name: 'BNApp64-v3.13.5.apk', code: 'J5B33MHS', size: 327680000, trashReason: 'manual', trashedAt: '2026-09-14T16:51:32', trashExpiresAt: '2026-10-14T16:51:32' }
const render = (patch = {}, dark = false) => renderToString(createSSRApp({ render: () => h(Card, { item: { ...item, ...patch }, isDarkMode: dark, now }) }))
test('recoverable file renders grouped labels, relative and exact dates', async () => {
const html = await render()
for (const label of ['BNApp64-v3.13.5.apk', '可恢复', '原取件码', 'J5B33MHS', '文件大小', '312.5 MB', '移入原因', '手动删除', '移入时间', '2026-09-14 16:51:32', '自动清理时间', '2026-10-14 16:51:32', '1 天前']) assert.ok(html.includes(label), label)
assert.ok(html.includes('<dl'))
})
test('purged and permanent records do not show a misleading countdown', async () => {
const purged = await render({ isTrashPurged: true, trashPurgedAt: '2026-09-15T09:00:00' })
assert.ok(purged.includes('已清理') && purged.includes('文件不可恢复'))
assert.ok(!purged.includes('剩余') && !purged.includes('自动清理时间'))
const permanent = await render({ isTrashPermanent: true })
assert.ok(permanent.includes('永久保留') && permanent.includes('不自动清理'))
assert.ok(!permanent.includes('剩余'))
})
test('urgent status remains readable with explicit text in dark mode', async () => {
const html = await render({ trashExpiresAt: '2026-09-16T15:00:00+08:00', trashReason: 'expired' }, true)
assert.ok(html.includes('trash-item-info--dark') && html.includes('trash-tone-warning'))
assert.ok(html.includes('3 小时后') && html.includes('即将清理') && html.includes('历史自动回收'))
})
test('missing metadata has safe fallbacks and filenames are escaped', async () => {
const html = await render({ name: '<script>alert(1)</script>', code: '', size: -1, trashedAt: null, trashExpiresAt: null })
assert.ok(html.includes('&lt;script&gt;') && !html.includes('<script>'))
assert.ok(html.includes('未记录') && html.includes('待确认'))
assert.ok(!html.includes('NaN'))
const unnamed = await render({ name: '', prefix: '', suffix: '', text: 'text record' })
assert.ok(unnamed.includes('未命名文件'))
})
+67
View File
@@ -0,0 +1,67 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { getTrashPresentation, formatTrashTime } from '../src/utils/trashPresentation.ts'
const now = new Date('2026-09-16T12:00:00+08:00').getTime()
const day = 86400000
const item = { id: 1, code: 'ABCD1234', size: 100, trashReason: 'manual' }
const present = (patch = {}) => getTrashPresentation({ ...item, ...patch }, now)
const expiry = days => new Date(now + days * day).toISOString()
test('normal retention shows date without duplicate countdown', () => {
const p = present({ trashExpiresAt: expiry(27.3) })
assert.equal(p.reminder, '')
assert.equal(p.state, '可恢复')
assert.equal(p.reason, '手动删除')
assert.equal(p.tone, 'normal')
})
test('three-day boundary, under-one-day and elapsed deadline are distinct', () => {
assert.equal(present({ trashExpiresAt: expiry(3) }).tone, 'warning')
assert.equal(present({ trashExpiresAt: expiry(3.01) }).tone, 'normal')
assert.equal(present({ trashExpiresAt: expiry(1) }).reminder, '即将清理')
assert.equal(present({ trashExpiresAt: expiry(0.1) }).reminder, '即将清理')
assert.equal(present({ trashExpiresAt: expiry(0) }).reminder, '等待清理')
assert.equal(present({ trashExpiresAt: expiry(-1) }).state, '可恢复')
})
test('purged records take priority over permanent and stale expiry', () => {
const p = present({ isTrashPurged: true, isTrashPermanent: true, trashExpiresAt: expiry(2), trashPurgedAt: expiry(-1) })
assert.equal(p.state, '已清理')
assert.equal(p.tone, 'muted')
assert.equal(p.timeLabel, '清理时间')
assert.equal(p.reminder, '')
assert.match(p.note, /不可恢复/)
})
test('permanent records do not show a countdown', () => {
const p = present({ isTrashPermanent: true })
assert.equal(p.state, '永久保留')
assert.equal(p.reminder, '')
assert.equal(p.timeText, '不自动清理')
})
test('missing and invalid deadlines never imply permanent retention or NaN dates', () => {
for (const trashExpiresAt of [undefined, null, '', 'invalid']) {
const p = present({ trashExpiresAt })
assert.equal(p.timeText, '待确认')
assert.equal(p.reminder, '')
}
for (const date of [undefined, null, '', 'invalid']) assert.equal(formatTrashTime(date), '未记录')
assert.match(formatTrashTime('2026-09-14T16:51:32'), /2026-09-14 16:51:32/)
})
test('expiry reason does not claim that count exhaustion was a manual deletion', () => {
assert.equal(present({ trashReason: 'expired' }).reason, '历史自动回收')
assert.equal(present({ trashReason: 'unexpected' }).reason, '其他原因')
assert.equal(present({ trashReason: null }).reason, '未记录')
})
test('relative time uses seven days inclusively in both directions', () => {
assert.equal(formatTrashTime(expiry(-2), now), '2 天前')
assert.equal(formatTrashTime(expiry(3), now), '3 天后')
assert.equal(formatTrashTime(expiry(-7), now), '7 天前')
assert.equal(formatTrashTime(expiry(7), now), '7 天后')
assert.match(formatTrashTime(expiry(-7.01), now), /^2026-/)
assert.match(formatTrashTime(expiry(7.01), now), /^2026-/)
})
test('relative times handle hours, minutes and immediate deadlines', () => {
assert.equal(formatTrashTime(new Date(now - 2 * 3600000).toISOString(), now), '2 小时前')
assert.equal(formatTrashTime(new Date(now + 30 * 60000).toISOString(), now), '30 分钟后')
assert.equal(formatTrashTime(new Date(now - 1000).toISOString(), now), '刚刚')
assert.equal(formatTrashTime(new Date(now + 1000).toISOString(), now), '即将到达')
})
+17
View File
@@ -0,0 +1,17 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { selectableTrashIds, buildTrashRetention, summarizeTrashBatch } from '../src/utils/trashSelection.ts'
const now = new Date('2026-09-16T12:00:00Z').getTime()
test('select-all excludes cleared audit records and duplicate ids',()=>{
assert.deepEqual(selectableTrashIds([{id:1},{id:2,isTrashPurged:true},{id:1},{id:3}]),[1,3])
})
test('custom deadline keeps timezone and enforces the future 365-day window',()=>{
assert.deepEqual(buildTrashRetention(true,'',now),{retentionDays:0})
assert.deepEqual(buildTrashRetention(false,'2026-09-17T20:00:00+08:00',now),{expiresAt:'2026-09-17T12:00:00.000Z'})
for(const date of ['', 'invalid','2026-09-15T12:00:00Z','2028-09-16T12:00:00Z']) assert.throws(()=>buildTrashRetention(false,date,now))
})
test('mixed operation results never report full success',()=>{
assert.equal(summarizeTrashBatch({succeeded:[{id:1}],failed:[{id:2,reason:'error'}]}),'成功 1 项,失败 1 项')
assert.equal(summarizeTrashBatch({succeeded:[],failed:[{id:2,reason:'error'}]}),'成功 0 项,失败 1 项')
assert.equal(summarizeTrashBatch({succeeded:[{id:1}],failed:[]}),'已完成 1 项')
})
+61
View File
@@ -0,0 +1,61 @@
// Only run on the isolated localhost in-memory backend fixture, never production.
export async function runTrashWorkflowChecks() {
if (location.hostname !== '127.0.0.1' || location.port !== '5180') throw new Error('Use the isolated fixture on port 5180')
const output=document.createElement('pre')
output.style.cssText='position:sticky;top:0;z-index:100;white-space:pre-wrap;background:#e6f0eb;color:#284b3b;padding:10px;font-size:12px'
document.body.prepend(output)
const checks=[]
const wait=async(fn)=>{const end=Date.now()+6000;while(!fn()){if(Date.now()>end)throw new Error('等待页面状态超时');await new Promise(r=>setTimeout(r,30))}}
const button=(text,root=document)=>[...root.querySelectorAll('button')].find(e=>e.textContent.trim()===text)
const done=text=>{checks.push(text);output.textContent=checks.join('\n')}
const assert=(v,m)=>{if(!v)throw new Error(m)}
const submit=()=>document.querySelector('form').dispatchEvent(new Event('submit',{bubbles:true,cancelable:true}))
try {
await wait(()=>document.querySelectorAll('article').length===6)
const keyword=document.querySelector('form input')
keyword.value='示例记录-1.txt';keyword.dispatchEvent(new Event('input',{bubbles:true}));submit()
await wait(()=>document.querySelectorAll('article').length===1)
assert(document.querySelector('article').textContent.includes('示例记录-1'),'关键词命中错误')
done('通过:全量文件名筛选')
button('重置').click();await wait(()=>document.querySelectorAll('article').length===6)
const status=document.querySelector('form select');status.value='purged';status.dispatchEvent(new Event('change',{bubbles:true}));submit()
await wait(()=>document.querySelectorAll('article').length===1)
assert(document.querySelector('article input').disabled,'审计记录可被选中')
assert(!button('恢复',document.querySelector('article')),'审计记录出现恢复操作')
done('通过:状态筛选与已删除记录禁用')
button('重置').click();await wait(()=>document.querySelectorAll('article').length===6)
document.querySelector('input[type=checkbox]').click()
await wait(()=>button('设置清理时间'))
assert([...document.querySelectorAll('article input')].filter(e=>e.checked).length===5,'全选未排除已清理记录')
button('设置清理时间').click();await wait(()=>document.querySelector('[role=dialog]'))
let modal=document.querySelector('[role=dialog]')
modal.querySelector('input[type=checkbox]').click();button('保存时间',modal).click()
await wait(()=>!document.querySelector('[role=dialog]'))
await wait(()=>document.querySelectorAll('article').length===6)
assert([...document.querySelectorAll('article')].filter(e=>e.textContent.includes('不自动清理')).length===5,'批量永久保留未生效')
done('通过:批量永久保留与全选排除审计记录')
const record=[...document.querySelectorAll('article')].find(e=>button('清理时间',e))
button('清理时间',record).click();await wait(()=>document.querySelector('[role=dialog]'))
modal=document.querySelector('[role=dialog]');modal.querySelector('input[type=checkbox]').click()
await wait(()=>modal.querySelector('select'))
const year=modal.querySelector('select');const original=year.value;year.value='2020';year.dispatchEvent(new Event('change',{bubbles:true}));button('保存时间',modal).click()
await wait(()=>modal.querySelector('[role=alert]'))
assert(modal.textContent.includes('未来 365 天'),'日期校验提示缺失')
year.value=original;year.dispatchEvent(new Event('change',{bubbles:true}));button('保存时间',modal).click()
await wait(()=>!document.querySelector('[role=dialog]'))
done('通过:单条时间编辑与无效日期拦截')
await wait(()=>document.querySelectorAll('article').length===6)
const selectable=[...document.querySelectorAll('article input')].filter(e=>!e.disabled)
selectable[0].click();await new Promise(r=>setTimeout(r,0));selectable[1].click();await new Promise(r=>setTimeout(r,0));await wait(()=>button('批量恢复'));assert([...document.querySelectorAll('article input')].filter(e=>e.checked).length===2,'未选中两条记录')
button('批量恢复').click();await wait(()=>document.querySelectorAll('article').length===4)
assert(document.querySelectorAll('code').length===2,'未展示恢复后的取件码')
done('通过:批量恢复、列表刷新和取件码展示')
document.querySelector('input[type=checkbox]').click();await wait(()=>button('批量清理'))
button('批量清理').click();await wait(()=>document.querySelector('[role=dialog]'))
modal=document.querySelector('[role=dialog]');assert(modal.textContent.includes('不可恢复')&&modal.textContent.includes('3'),'缺少删除数量或后果提示')
button('取消',modal).click();await wait(()=>!document.querySelector('[role=dialog]'))
assert(document.querySelectorAll('article').length===4,'取消删除改变了数据')
done('通过:彻底删除确认数量、取消不修改数据')
done('全部 6 组交互检查通过(独立内存数据库)')
} catch(error) {output.textContent=checks.join('\n')+'\n失败:'+error.message;throw error}
}
+3
View File
@@ -0,0 +1,3 @@
<!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>2026 UI 回归</title><div id="app"></div><script type="module">
import {createApp} from 'vue';import {createI18n} from 'vue-i18n';import App from './fixtures/UiSystem.vue';import zh from '/src/i18n/locales/zh-CN.ts';import '/src/assets/style/main.css';createApp(App).use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}})).mount('#app');
</script></html>
+45
View File
@@ -0,0 +1,45 @@
import { test, before, after } from 'node:test'
import assert from 'node:assert/strict'
import { createServer } from 'vite'
import { createSSRApp, h } from 'vue'
import { renderToString } from 'vue/server-renderer'
import { createI18n } from 'vue-i18n'
let server, Button, Pagination, DateSelect, zh
before(async()=>{
server=await createServer({server:{middlewareMode:true,watch:null},appType:'custom'})
Button=(await server.ssrLoadModule('/src/components/common/BaseButton.vue')).default
Pagination=(await server.ssrLoadModule('/src/components/common/DataPagination.vue')).default
DateSelect=(await server.ssrLoadModule('/src/components/common/NativeDateSelect.vue')).default
zh=(await server.ssrLoadModule('/src/i18n/locales/zh-CN.ts')).default
})
after(async()=>await server?.close())
async function render(component,props,slots={}) {
const app=createSSRApp({render:()=>h(component,props,slots)})
app.use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}}))
return renderToString(app)
}
test('button variants retain their semantic role and disabled/loading behavior',async()=>{
for(const variant of ['primary','secondary','danger','success','outline']) {
const html=await render(Button,{variant},{default:()=> '刷新'})
assert.ok(html.includes(`fcb-button-${variant}`) && html.includes('fcb-action') && html.includes('刷新'))
}
const loading=await render(Button,{loading:true},{icon:()=>h('span','CUSTOM ICON'),default:()=> '刷新'})
assert.match(loading, /disabled/);assert.ok(!loading.includes('CUSTOM ICON'))
assert.match(await render(Button,{disabled:true}),/disabled/)
})
test('pagination retains accessible labels and correct edge controls',async()=>{
const first=await render(Pagination,{currentPage:1,pageSize:20,total:85})
assert.ok(first.includes('每页显示数量') && first.includes('20/页') && first.includes('1 / 5'))
assert.match(first,/<button[^>]*disabled[^>]*>[\s\S]*?上一页/)
const last=await render(Pagination,{currentPage:5,pageSize:20,total:85})
assert.ok(last.includes('第 81 到 85 条') && last.includes('5 / 5'))
assert.ok(!last.includes('col-span-3'))
})
test('date field keeps real selects, readable labels, leap days and optional time',async()=>{
const leap=await render(DateSelect,{modelValue:'2024-02-29',ariaLabel:'开始日期'})
assert.ok(leap.includes('开始日期年')&&leap.includes('开始日期月')&&leap.includes('开始日期日'))
assert.match(leap,/<option[^>]*value="29"/)
const ordinary=await render(DateSelect,{modelValue:'2025-02-28T14:30',ariaLabel:'过期时间',includeTime:true})
assert.ok(ordinary.includes('过期时间时')&&ordinary.includes('过期时间分'))
assert.ok(ordinary.includes('native-date-label'))
})
+109
View File
@@ -0,0 +1,109 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { parse } from 'vue/compiler-sfc'
const palettePath = new URL('../src/theme/macaron.json', import.meta.url)
const luminance = hex => {
const channels = hex.slice(1).match(/../g).map(c => parseInt(c, 16) / 255).map(c => c <= .04045 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4)
return channels[0] * .2126 + channels[1] * .7152 + channels[2] * .0722
}
test('all semantic button colors retain AA text contrast in both themes', () => {
const { buttons } = JSON.parse(readFileSync(palettePath))
for (const mode of ['light', 'dark']) for (const [name, colors] of Object.entries(buttons[mode])) {
for (const bg of [colors.bg, colors.hover]) {
const values = [luminance(bg), luminance(colors.text)].sort((a,b) => b-a)
assert.ok((values[0]+.05)/(values[1]+.05)>=4.5, `${mode}/${name}: low contrast`)
}
}
})
test('palette covers all Tailwind color families used by the application including opacity variants', () => {
const { colors } = JSON.parse(readFileSync(palettePath))
for (const family of ['blue','indigo','cyan','sky','green','emerald','teal','red','rose','pink','purple','violet','yellow','amber','orange','gray','slate','zinc','neutral','stone','lime','fuchsia']) {
for (const shade of [50,100,200,300,400,500,600,700,800,900,950]) assert.match(colors[family][shade], /^#[a-f0-9]{6}$/)
}
})
test('mobile page-size chooser does not span the whole pagination row', () => {
const { descriptor }=parse(readFileSync(new URL('../src/components/common/DataPagination.vue',import.meta.url),'utf8'))
assert.ok(!descriptor.template.content.match(/<select[\s\S]*?class="[^"]*col-span-3/), 'page size occupies the full row')
})
test('all native action buttons use shared motion unless they are cards, switches or backdrops', async () => {
const { globSync } = await import('glob')
for(const file of globSync('src/**/*.vue')) {
const { descriptor }=parse(readFileSync(file,'utf8'))
function visit(node) {
if(node.tag==='button') {
const opening=node.loc.source.match(/^<button\b(?:[^>"']|"[^"]*"|'[^']*')*>/s)?.[0]||''
assert.ok(/fcb-action|theme-2026-card-hover|role="switch"|inset-0/.test(opening), `Missing button motion: ${file}`)
}
for(const child of node.children||[])visit(child)
}
if(descriptor.template?.ast)visit(descriptor.template.ast)
}
})
test('primary submit buttons do not add a second white or gradient hover overlay', () => {
for(const path of ['src/views/SendFileView.vue','src/components/common/RetrieveForm.vue']) {
const source=readFileSync(path,'utf8')
assert.ok(!/group-hover:opacity-(20|100)/.test(source), `${path}: extra hover brightness layer`)
assert.ok(source.includes('fcb-button-primary'))
}
})
test('large content sections do not opt into card movement', async () => {
const {globSync}=await import('glob')
for(const path of globSync('src/views/**/*.vue')) {
const {descriptor}=parse(readFileSync(path,'utf8'))
function visit(node) {
if(node.tag==='section') {
const opening=node.loc.source.match(/^<section\b(?:[^>"']|"[^"]*"|'[^']*')*>/s)?.[0]||''
assert.ok(!opening.includes('theme-2026-card-hover'), `Moving large container: ${path}`)
}
for(const child of node.children||[])visit(child)
}
if(descriptor.template?.ast)visit(descriptor.template.ast)
}
})
test('settings shell and shared data table stay stationary while child actions opt in separately', () => {
for(const path of ['src/views/manage/SystemSettingsView.vue','src/components/common/DataTable.vue']) {
const source=readFileSync(path,'utf8')
const outer=source.match(/class="[^"]*fcb-static-container[^"]*"/)?.[0]
assert.ok(outer && !outer.includes('theme-2026-card-hover'),path)
}
})
test('list hover styles do not render an inset frame or lift rows', async () => {
const {default:postcss}=await import('postcss')
const css=postcss.parse(readFileSync('src/assets/style/main.css','utf8'))
let found=false
css.walkRules(rule=>{
if(rule.selector.includes('.fcb-list-row:hover')) {
const declarations=Object.fromEntries(rule.nodes.filter(n=>n.type==='decl').map(n=>[n.prop,n.value]))
assert.equal(declarations['box-shadow'],'none')
assert.equal(declarations.transform,'none')
found=true
}
})
assert.ok(found)
})
test('light and dark card shadows use their separately approved light directions', async () => {
const {default:postcss}=await import('postcss')
const css=postcss.parse(readFileSync('src/assets/style/main.css','utf8'))
const shadows={}
css.walkDecls('--fcb-card-shadow',decl=>{shadows[decl.parent.selector]=decl.value})
const rgb=shadow=>[...shadow.matchAll(/rgba\((\d+),(\d+),(\d+),[^)]+\)/g)].map(m=>Number(m[1])+Number(m[2])+Number(m[3]))
const light=rgb(shadows[':root']),dark=rgb(shadows['.dark'])
assert.equal(light.length,2);assert.equal(dark.length,2)
assert.ok(light[0]>light[1],'light theme: top-left must be lighter')
assert.ok(dark[0]<dark[1],'dark theme: top-left must be darker')
})
test('all five expiration choices retain native multi-selection and shared action motion', () => {
const source=readFileSync('src/views/manage/SystemSettingsView.vue','utf8')
const group=source.slice(source.indexOf('v-for="style in'),source.indexOf('v-for="style in')+1500)
assert.ok(group.includes("['day', 'hour', 'minute', 'forever', 'count']"))
assert.ok(group.includes('type="checkbox"') && group.includes('v-model="config.expireStyle"'))
assert.ok(group.includes('fcb-action fcb-choice-face'))
})