✨ 优化 2026 前端无障碍与响应式体验

完善 2026 主题的移动端与桌面端交互体验,修复多项可访问性和信息展示问题。

- 允许浏览器缩放,补充焦点样式、按钮名称、表单标签和对话框键盘焦点管理\n- 支持 reduced-motion,扩大公共页、后台导航、记录列表和分页控件的触控区域\n- 优化系统设置分区导航、密码显示、字段语义和底部粘性保存栏\n- 压缩移动文件列表操作区,改善桌面表格滚动可达性和统计值截断\n- 优化仪表盘指标、趋势摘要、进度条语义及中英文文案
This commit is contained in:
orion committed 2026-07-21 11:05:23 +08:00
1 parent 2f020f5d42
commit b60c003ec2
29 files changed
+638 -312

No files matched your search

+36 -28
View File
@@ -236,18 +236,18 @@
<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]">下载/上传趋势</h3>
<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 sm:hidden" :class="[mutedTextClass]">轻触或滑动查看数据;拖动底部日期轴平移图表</p>
<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">
<NativeDateSelect
v-model="analyticsStart"
:field-class="fieldClass"
aria-label="开始日期"
:aria-label="t('admin.dashboard.trend.startDate')"
@change="fetchAnalyticsData"
/>
<span
@@ -259,7 +259,7 @@
<NativeDateSelect
v-model="analyticsEnd"
:field-class="fieldClass"
aria-label="结束日期"
:aria-label="t('admin.dashboard.trend.endDate')"
@change="fetchAnalyticsData"
/>
</div>
@@ -270,7 +270,7 @@
class="h-9 min-w-16"
@click="trendCanvas?.zoom(0.75)"
>
放大
{{ t('admin.dashboard.trend.zoomIn') }}
</BaseButton>
<BaseButton
variant="outline"
@@ -278,7 +278,7 @@
class="h-9 min-w-16"
@click="trendCanvas?.zoom(1.33)"
>
缩小
{{ t('admin.dashboard.trend.zoomOut') }}
</BaseButton>
<BaseButton
variant="outline"
@@ -286,7 +286,7 @@
class="h-9 min-w-16"
@click="trendCanvas?.resetWindow()"
>
重置
{{ t('admin.dashboard.trend.reset') }}
</BaseButton>
</div>
</div>
@@ -317,15 +317,15 @@
>
<div class="mb-5 flex items-center justify-between">
<div>
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">热门下载 Top 5</h3>
<p class="text-sm" :class="[mutedTextClass]">统计当前日期范围内的下载次数和流量</p>
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">{{ t('admin.dashboard.topDownloads.title') }}</h3>
<p class="text-sm" :class="[mutedTextClass]">{{ t('admin.dashboard.topDownloads.description') }}</p>
</div>
<DownloadCloudIcon
class="h-5 w-5"
:class="[isDarkMode ? 'text-[#b8d4dc]' : 'text-[#5f8796]']"
/>
</div>
<div class="overflow-x-auto">
<div class="overflow-x-auto" tabindex="0" role="region" :aria-label="t('admin.dashboard.topDownloads.title')">
<table
class="min-w-full divide-y"
:class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-200']"
@@ -336,32 +336,32 @@
class="px-4 py-3 text-left text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
文件
{{ t('admin.dashboard.topDownloads.file') }}
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
下载
{{ t('admin.dashboard.topDownloads.downloads') }}
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
流量
{{ t('admin.dashboard.topDownloads.traffic') }}
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
状态
{{ t('admin.dashboard.topDownloads.status') }}
</th>
</tr>
</thead>
<tbody class="divide-y" :class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-100']">
<tr v-if="analyticsTopFiles.length === 0">
<td colspan="4" class="px-4 py-8 text-center text-sm" :class="[mutedTextClass]">
暂无下载记录
{{ t('admin.dashboard.topDownloads.empty') }}
</td>
</tr>
<tr
@@ -383,7 +383,7 @@
{{ formatBytes(file.download_traffic) }}
</td>
<td class="px-4 py-3 text-sm" :class="[mutedTextClass]">
{{ file.current ? '现存' : '历史' }}
{{ file.current ? t('admin.dashboard.topDownloads.current') : t('admin.dashboard.topDownloads.history') }}
</td>
</tr>
</tbody>
@@ -497,7 +497,7 @@ const analyticsEnd = ref(today())
const analyticsData = ref<AnalyticsData | null>(null)
const analyticsError = ref('')
const isAnalyticsLoading = ref(false)
const analyticsWindowText = ref('无数据')
const analyticsWindowText = ref(t('admin.dashboard.trend.noData'))
const analyticsDailyRows = computed(() => analyticsData.value?.daily || [])
const analyticsTopFiles = computed<AnalyticsFileRow[]>(() => analyticsData.value?.topFiles || [])
const analyticsUploadTrafficText = computed(() =>
@@ -506,13 +506,14 @@ const analyticsUploadTrafficText = computed(() =>
const analyticsDownloadTrafficText = computed(() =>
formatBytes(analyticsData.value?.totals?.downloadTraffic || 0)
)
const analyticsSummaryText = computed(
() =>
`${analyticsWindowText.value},下载 ${analyticsData.value?.totals?.totalDownloads || 0} 次 / ${
analyticsDownloadTrafficText.value
},上传 ${analyticsData.value?.totals?.totalUploads || 0} 次 / ${
analyticsUploadTrafficText.value
}`
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
})
)
const formatBytes = (value: number | string | undefined) => formatFileSize(Number(value || 0), 1)
@@ -522,7 +523,7 @@ const fetchAnalyticsData = async () => {
try {
analyticsData.value = await fetchAnalytics(analyticsStart.value, analyticsEnd.value)
} catch (error) {
analyticsError.value = error instanceof Error ? error.message : '统计加载失败'
analyticsError.value = error instanceof Error ? error.message : t('admin.dashboard.trend.loadFailed')
} finally {
isAnalyticsLoading.value = false
}
@@ -641,10 +642,17 @@ const MetricProgress = defineComponent({
h('span', { class: 'line-clamp-1 text-gray-500 dark:text-gray-400' }, props.label),
h('span', { class: 'font-medium tabular-nums text-gray-900 dark:text-white' }, `${props.value}%`)
]),
h('div', { class: 'h-2 overflow-hidden rounded-full bg-gray-100 dark:bg-gray-700' }, [
h('div', {
class: 'h-2 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700',
role: 'progressbar',
'aria-label': props.label,
'aria-valuemin': 0,
'aria-valuemax': 100,
'aria-valuenow': props.value
}, [
h('div', {
class: ['h-full rounded-full', toneClass.value],
style: { width: `${props.value}%` }
style: { width: `${Math.max(0, Math.min(100, props.value))}%` }
})
]),
h('p', { class: 'mt-2 hidden text-sm text-gray-500 sm:block dark:text-gray-400' }, props.detail)
@@ -669,7 +677,7 @@ const PolicyRow = defineComponent({
},
[
h('span', { class: 'text-sm text-gray-500 dark:text-gray-400' }, props.label),
h('span', { class: 'text-sm font-medium text-gray-900 dark:text-white' }, props.value)
h('span', { class: 'min-w-0 break-words text-right text-sm font-medium text-gray-900 dark:text-white' }, props.value)
]
)
}