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

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

No files matched your search

+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>