feat: redesign admin layout and stats dashboards

This commit is contained in:
2026-02-07 01:59:29 +08:00
parent 9991834ccd
commit 6eb0651e23
70 changed files with 713 additions and 690 deletions

View File

@@ -0,0 +1,164 @@
<script setup>
const props = defineProps({
items: {
type: Array,
default: () => [],
},
loading: {
type: Boolean,
default: false,
},
minWidth: {
type: Number,
default: 180,
},
})
</script>
<template>
<div class="metric-grid" :style="{ '--metric-min': `${minWidth}px` }">
<div
v-for="item in items"
:key="item?.key || item?.label"
class="metric-card"
:class="`metric-tone--${item?.tone || 'blue'}`"
>
<div class="metric-top">
<div v-if="item?.icon" class="metric-icon">
<el-icon><component :is="item.icon" /></el-icon>
</div>
<div class="metric-label">{{ item?.label || '-' }}</div>
</div>
<div class="metric-value">
<el-skeleton v-if="loading" :rows="1" animated />
<template v-else>{{ item?.value ?? 0 }}</template>
</div>
<div v-if="item?.hint || item?.sub" class="metric-hint app-muted">{{ item?.hint || item?.sub }}</div>
</div>
</div>
</template>
<style scoped>
.metric-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--metric-min), 1fr));
gap: 12px;
}
.metric-card {
position: relative;
overflow: hidden;
border-radius: 14px;
border: 1px solid var(--app-border);
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.9));
box-shadow: var(--app-shadow-soft);
padding: 13px 14px;
min-height: 104px;
}
.metric-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: var(--metric-top, #3b82f6);
}
.metric-top {
display: flex;
align-items: center;
gap: 8px;
}
.metric-icon {
width: 26px;
height: 26px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
background: var(--metric-icon-bg, rgba(59, 130, 246, 0.12));
color: var(--metric-icon-color, #1d4ed8);
}
.metric-label {
font-size: 12px;
color: #475569;
font-weight: 700;
line-height: 1.4;
}
.metric-value {
margin-top: 10px;
font-size: 26px;
line-height: 1.05;
font-weight: 900;
color: #0f172a;
}
.metric-hint {
margin-top: 8px;
font-size: 12px;
line-height: 1.4;
}
.metric-tone--blue {
--metric-top: linear-gradient(90deg, #3b82f6, #06b6d4);
--metric-icon-bg: rgba(59, 130, 246, 0.14);
--metric-icon-color: #1d4ed8;
}
.metric-tone--green {
--metric-top: linear-gradient(90deg, #10b981, #22c55e);
--metric-icon-bg: rgba(16, 185, 129, 0.14);
--metric-icon-color: #047857;
}
.metric-tone--purple {
--metric-top: linear-gradient(90deg, #8b5cf6, #ec4899);
--metric-icon-bg: rgba(139, 92, 246, 0.14);
--metric-icon-color: #6d28d9;
}
.metric-tone--orange {
--metric-top: linear-gradient(90deg, #f59e0b, #f97316);
--metric-icon-bg: rgba(245, 158, 11, 0.14);
--metric-icon-color: #b45309;
}
.metric-tone--red {
--metric-top: linear-gradient(90deg, #ef4444, #f43f5e);
--metric-icon-bg: rgba(239, 68, 68, 0.14);
--metric-icon-color: #b91c1c;
}
.metric-tone--cyan {
--metric-top: linear-gradient(90deg, #06b6d4, #3b82f6);
--metric-icon-bg: rgba(6, 182, 212, 0.14);
--metric-icon-color: #0e7490;
}
@media (max-width: 768px) {
.metric-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric-card {
min-height: 96px;
}
.metric-value {
font-size: 22px;
}
}
@media (max-width: 480px) {
.metric-grid {
grid-template-columns: 1fr;
}
}
</style>

View File

@@ -162,21 +162,23 @@ async function go(path) {
<span class="app-muted">管理员</span>
<strong>{{ adminUsername || '-' }}</strong>
</div>
<el-button type="primary" plain @click="logout">退出</el-button>
<el-button type="primary" plain class="logout-btn" @click="logout">退出</el-button>
</div>
</el-header>
<el-main class="layout-main">
<Suspense>
<template #default>
<RouterView />
</template>
<template #fallback>
<el-card shadow="never" :body-style="{ padding: '16px' }" class="fallback-card">
<el-skeleton :rows="5" animated />
</el-card>
</template>
</Suspense>
<div class="main-shell">
<Suspense>
<template #default>
<RouterView />
</template>
<template #fallback>
<el-card shadow="never" :body-style="{ padding: '16px' }" class="fallback-card">
<el-skeleton :rows="5" animated />
</el-card>
</template>
</Suspense>
</div>
</el-main>
</el-container>
@@ -204,31 +206,58 @@ async function go(path) {
}
.layout-aside {
background: #ffffff;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
border-right: 1px solid var(--app-border);
box-shadow: 4px 0 16px rgba(15, 23, 42, 0.04);
}
.brand,
.drawer-brand {
padding: 18px 16px 14px;
}
.brand {
padding: 18px 16px 10px;
}
.drawer-brand {
padding: 18px 16px 10px;
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.brand-title {
font-size: 15px;
font-size: 16px;
font-weight: 800;
letter-spacing: 0.2px;
}
.brand-sub {
margin-top: 2px;
margin-top: 4px;
font-size: 12px;
}
.aside-menu {
border-right: none;
padding: 8px;
background: transparent;
}
.aside-menu :deep(.el-menu-item) {
height: 42px;
line-height: 42px;
margin: 3px 0;
border-radius: 10px;
color: #334155;
font-weight: 600;
}
.aside-menu :deep(.el-menu-item .el-icon) {
margin-right: 10px;
}
.aside-menu :deep(.el-menu-item:hover) {
background: rgba(59, 130, 246, 0.08);
color: #1d4ed8;
}
.aside-menu :deep(.el-menu-item.is-active) {
background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.1));
color: #1e40af;
}
.menu-label {
@@ -243,16 +272,22 @@ async function go(path) {
}
.fallback-card {
border-radius: var(--app-radius);
min-height: 160px;
border-radius: var(--app-radius-lg);
border: 1px solid var(--app-border);
}
.layout-header {
position: sticky;
top: 0;
z-index: 20;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: rgba(246, 247, 251, 0.6);
height: 58px;
padding: 0 18px;
background: rgba(255, 255, 255, 0.78);
backdrop-filter: saturate(180%) blur(10px);
border-bottom: 1px solid var(--app-border);
}
@@ -265,7 +300,7 @@ async function go(path) {
}
.header-title {
font-size: 14px;
font-size: 15px;
font-weight: 800;
white-space: nowrap;
overflow: hidden;
@@ -288,18 +323,33 @@ async function go(path) {
align-items: baseline;
gap: 8px;
font-size: 13px;
color: #334155;
}
.admin-name strong {
color: #0f172a;
font-weight: 800;
}
.logout-btn {
min-width: 74px;
}
.layout-main {
padding: 16px;
padding: 18px;
}
.main-shell {
width: 100%;
max-width: 1600px;
margin: 0 auto;
}
@media (max-width: 768px) {
.layout-header {
flex-wrap: wrap;
height: auto;
padding-top: 10px;
padding-bottom: 10px;
padding: 10px 12px;
}
.header-right {

View File

@@ -291,18 +291,22 @@ onMounted(load)
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.section-title {
margin: 0 0 12px;
font-size: 14px;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.help {
@@ -364,6 +368,9 @@ onMounted(load)
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.ellipsis {

View File

@@ -12,6 +12,7 @@ import {
testSmtpConfig,
updateSmtpConfig,
} from '../api/smtp'
import MetricGrid from '../components/MetricGrid.vue'
// ========== 全局设置 ==========
const emailSettingsLoading = ref(false)
@@ -487,6 +488,21 @@ function emailLogUserLabel(row) {
return '系统'
}
const emailSummaryCards = computed(() => [
{ key: 'total_sent', label: '总发送', value: emailStats.value?.total_sent || 0, tone: 'blue' },
{ key: 'total_success', label: '成功', value: emailStats.value?.total_success || 0, tone: 'green' },
{ key: 'total_failed', label: '失败', value: emailStats.value?.total_failed || 0, tone: 'red' },
{ key: 'success_rate', label: '成功率', value: `${emailStats.value?.success_rate || 0}%`, tone: 'purple' },
])
const emailTypeCards = computed(() => [
{ key: 'register_sent', label: '注册验证', value: emailStats.value?.register_sent || 0, tone: 'cyan' },
{ key: 'reset_sent', label: '密码重置', value: emailStats.value?.reset_sent || 0, tone: 'orange' },
{ key: 'bind_sent', label: '邮箱绑定', value: emailStats.value?.bind_sent || 0, tone: 'purple' },
{ key: 'task_complete_sent', label: '任务完成', value: emailStats.value?.task_complete_sent || 0, tone: 'green' },
])
async function loadEmailStats() {
emailStatsLoading.value = true
try {
@@ -668,38 +684,10 @@ onMounted(refreshAll)
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card" v-loading="emailStatsLoading">
<h3 class="section-title">邮件发送统计</h3>
<el-row :gutter="12">
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value">{{ emailStats.total_sent || 0 }}</div>
<div class="stat-label">总发送</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value ok">{{ emailStats.total_success || 0 }}</div>
<div class="stat-label">成功</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value err">{{ emailStats.total_failed || 0 }}</div>
<div class="stat-label">失败</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value">{{ emailStats.success_rate || 0 }}%</div>
<div class="stat-label">成功率</div>
</el-card>
</el-col>
</el-row>
<MetricGrid :items="emailSummaryCards" :loading="emailStatsLoading" :min-width="160" />
<div class="sub-stats">
<el-tag effect="light">注册验证 {{ emailStats.register_sent || 0 }}</el-tag>
<el-tag effect="light">密码重置 {{ emailStats.reset_sent || 0 }}</el-tag>
<el-tag effect="light">邮箱绑定 {{ emailStats.bind_sent || 0 }}</el-tag>
<el-tag effect="light">任务完成 {{ emailStats.task_complete_sent || 0 }}</el-tag>
<MetricGrid :items="emailTypeCards" :loading="emailStatsLoading" :min-width="150" />
</div>
<div class="help app-muted">最后更新{{ emailStats.last_updated || '-' }}</div>
@@ -853,7 +841,8 @@ onMounted(refreshAll)
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.toolbar {
@@ -866,6 +855,8 @@ onMounted(refreshAll)
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.section-head {
@@ -879,8 +870,9 @@ onMounted(refreshAll)
.section-title {
margin: 0;
font-size: 14px;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.help {
@@ -891,37 +883,13 @@ onMounted(refreshAll)
.table-wrap {
overflow-x: auto;
}
.stat-card {
border-radius: var(--app-radius);
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.stat-value {
font-size: 20px;
font-weight: 900;
line-height: 1.1;
}
.stat-label {
margin-top: 6px;
font-size: 12px;
color: var(--app-muted);
}
.ok {
color: #047857;
}
.err {
color: #b91c1c;
}
.sub-stats {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}

View File

@@ -1,8 +1,9 @@
<script setup>
import { inject, onMounted, ref } from 'vue'
import { computed, inject, onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { closeFeedback, deleteFeedback, fetchFeedbacks, replyFeedback } from '../api/feedbacks'
import MetricGrid from '../components/MetricGrid.vue'
const refreshNavBadges = inject('refreshNavBadges', null)
@@ -18,6 +19,13 @@ const statusOptions = [
{ label: '已关闭', value: 'closed' },
]
const metricItems = computed(() => [
{ key: 'total', label: '总反馈', value: stats.value.total || 0, tone: 'blue' },
{ key: 'pending', label: '待处理', value: stats.value.pending || 0, tone: 'orange' },
{ key: 'replied', label: '已回复', value: stats.value.replied || 0, tone: 'green' },
{ key: 'closed', label: '已关闭', value: stats.value.closed || 0, tone: 'purple' },
])
function statusMeta(status) {
if (status === 'pending') return { label: '待处理', type: 'warning' }
if (status === 'replied') return { label: '已回复', type: 'success' }
@@ -121,34 +129,14 @@ onMounted(load)
</div>
</div>
<el-row :gutter="12">
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value">{{ stats.total || 0 }}</div>
<div class="stat-label">总计</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value warn">{{ stats.pending || 0 }}</div>
<div class="stat-label">待处理</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value ok">{{ stats.replied || 0 }}</div>
<div class="stat-label">已回复</div>
</el-card>
</el-col>
<el-col :xs="12" :sm="6">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value">{{ stats.closed || 0 }}</div>
<div class="stat-label">已关闭</div>
</el-card>
</el-col>
</el-row>
<MetricGrid :items="metricItems" :loading="loading" :min-width="165" />
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card">
<div class="section-head">
<h3 class="section-title">反馈列表</h3>
<div class="app-muted"> {{ list.length }} 当前筛选</div>
</div>
<div class="table-wrap">
<el-table :data="list" v-loading="loading" style="width: 100%">
<el-table-column prop="id" label="ID" width="80" />
@@ -204,43 +192,44 @@ onMounted(load)
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.toolbar {
display: flex;
gap: 10px;
align-items: center;
flex-wrap: wrap;
}
.card,
.stat-card {
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.stat-value {
font-size: 20px;
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
flex-wrap: wrap;
}
.section-title {
margin: 0;
font-size: 15px;
font-weight: 800;
line-height: 1.1;
}
.stat-label {
margin-top: 6px;
font-size: 12px;
color: var(--app-muted);
}
.warn {
color: #b45309;
}
.ok {
color: #047857;
}
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.ellipsis {

View File

@@ -249,12 +249,15 @@ onMounted(async () => {
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.filters {
@@ -266,6 +269,9 @@ onMounted(async () => {
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.ellipsis {

View File

@@ -20,6 +20,7 @@ import { fetchEmailStats } from '../api/email'
import { fetchDockerStats, fetchRunningTasks, fetchServerInfo, fetchTaskStats } from '../api/tasks'
import { fetchBrowserPoolStats } from '../api/browser_pool'
import { fetchSystemConfig } from '../api/system'
import MetricGrid from '../components/MetricGrid.vue'
const refreshStats = inject('refreshStats', null)
const adminStats = inject('adminStats', null)
@@ -143,6 +144,50 @@ const taskTodaySuccessRate = computed(() => {
const emailSuccessRate = computed(() => normalizeCount(emailStats.value?.success_rate))
const taskTodayCards = computed(() => [
{ label: '总任务', value: normalizeCount(taskToday.value.total_tasks), tone: 'blue' },
{ label: '成功', value: normalizeCount(taskToday.value.success_tasks), tone: 'green' },
{ label: '失败', value: normalizeCount(taskToday.value.failed_tasks), tone: 'red' },
{ label: '浏览内容', value: normalizeCount(taskToday.value.total_items), tone: 'purple' },
{ label: '查看附件', value: normalizeCount(taskToday.value.total_attachments), tone: 'cyan' },
])
const taskTotalCards = computed(() => [
{ label: '总任务', value: normalizeCount(taskTotal.value.total_tasks), tone: 'blue' },
{ label: '成功', value: normalizeCount(taskTotal.value.success_tasks), tone: 'green' },
{ label: '失败', value: normalizeCount(taskTotal.value.failed_tasks), tone: 'red' },
{ label: '浏览内容', value: normalizeCount(taskTotal.value.total_items), tone: 'purple' },
{ label: '查看附件', value: normalizeCount(taskTotal.value.total_attachments), tone: 'cyan' },
])
const emailCards = computed(() => [
{ label: '总发送', value: normalizeCount(emailStats.value?.total_sent), tone: 'blue' },
{ label: '成功', value: normalizeCount(emailStats.value?.total_success), tone: 'green' },
{ label: '失败', value: normalizeCount(emailStats.value?.total_failed), tone: 'red' },
{ label: '成功率', value: `${emailSuccessRate.value}%`, tone: 'purple' },
])
const emailTypeCards = computed(() => [
{ label: '注册验证', value: normalizeCount(emailStats.value?.register_sent), tone: 'cyan' },
{ label: '密码重置', value: normalizeCount(emailStats.value?.reset_sent), tone: 'orange' },
{ label: '邮箱绑定', value: normalizeCount(emailStats.value?.bind_sent), tone: 'purple' },
{ label: '任务完成', value: normalizeCount(emailStats.value?.task_complete_sent), tone: 'green' },
])
const feedbackCards = computed(() => [
{ label: '总反馈', value: normalizeCount(feedbackStats.value?.total), tone: 'blue' },
{ label: '待处理', value: normalizeCount(feedbackStats.value?.pending), tone: 'orange' },
{ label: '已回复', value: normalizeCount(feedbackStats.value?.replied), tone: 'green' },
])
const browserPoolCards = computed(() => [
{ label: '总 Worker', value: browserPoolTotalWorkers.value, tone: 'blue' },
{ label: '活跃 Worker', value: browserPoolActiveWorkers.value, tone: 'green' },
{ label: '空闲 Worker', value: browserPoolIdleWorkers.value, tone: 'cyan' },
{ label: '忙碌 Worker', value: browserPoolBusyWorkers.value, tone: 'orange' },
{ label: '队列', value: browserPoolQueueSize.value, tone: 'purple' },
])
const scheduleEnabled = computed(() => (systemConfig.value?.schedule_enabled ?? 0) === 1)
const scheduleTime = computed(() => systemConfig.value?.schedule_time || '-')
const scheduleBrowseType = computed(() => systemConfig.value?.schedule_browse_type || '-')
@@ -250,12 +295,10 @@ onUnmounted(() => {
<template>
<div class="page-stack">
<div class="hero">
<div class="hero-top">
<div class="hero-title">
<div class="hero-title-row">
<h2>报表中心</h2>
</div>
<section class="report-hero">
<div class="hero-head">
<div class="hero-main">
<h2>报表中心</h2>
<div class="hero-meta app-muted">
<span v-if="lastUpdatedAt">更新时间{{ lastUpdatedAt }}</span>
<span v-if="serverInfo?.uptime" class="hero-dot">·</span>
@@ -264,23 +307,12 @@ onUnmounted(() => {
</div>
<div class="hero-actions">
<el-button type="primary" plain :loading="loading" @click="manualRefresh">刷新</el-button>
<el-button type="primary" :loading="loading" @click="manualRefresh">刷新数据</el-button>
</div>
</div>
<div class="kpi-grid">
<div v-for="c in overviewCards" :key="c.label" class="kpi-card" :class="`kpi-tone--${c.tone}`">
<div class="kpi-icon">
<el-icon><component :is="c.icon" /></el-icon>
</div>
<div class="kpi-body">
<div class="kpi-value">{{ c.value }}</div>
<div class="kpi-label">{{ c.label }}</div>
<div v-if="c.sub" class="kpi-sub app-muted">{{ c.sub }}</div>
</div>
</div>
</div>
</div>
<MetricGrid :items="overviewCards" :loading="loading" :min-width="165" />
</section>
<el-row :gutter="12">
<el-col :xs="24" :lg="12">
@@ -309,58 +341,16 @@ onUnmounted(() => {
/>
</div>
<div class="tile-section">
<div class="tile-title app-muted">今日</div>
<div class="tile-grid">
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskToday.total_tasks) }}</div>
<div class="tile-k app-muted">总任务</div>
</div>
<div class="tile">
<div class="tile-v ok">{{ normalizeCount(taskToday.success_tasks) }}</div>
<div class="tile-k app-muted">成功</div>
</div>
<div class="tile">
<div class="tile-v err">{{ normalizeCount(taskToday.failed_tasks) }}</div>
<div class="tile-k app-muted">失败</div>
</div>
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskToday.total_items) }}</div>
<div class="tile-k app-muted">浏览内容</div>
</div>
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskToday.total_attachments) }}</div>
<div class="tile-k app-muted">查看附件</div>
</div>
</div>
<div class="metrics-block">
<div class="block-title">今日</div>
<MetricGrid :items="taskTodayCards" :loading="refreshing" :min-width="120" />
</div>
<div class="divider"></div>
<div class="tile-section">
<div class="tile-title app-muted">累计</div>
<div class="tile-grid">
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskTotal.total_tasks) }}</div>
<div class="tile-k app-muted">总任务</div>
</div>
<div class="tile">
<div class="tile-v ok">{{ normalizeCount(taskTotal.success_tasks) }}</div>
<div class="tile-k app-muted">成功</div>
</div>
<div class="tile">
<div class="tile-v err">{{ normalizeCount(taskTotal.failed_tasks) }}</div>
<div class="tile-k app-muted">失败</div>
</div>
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskTotal.total_items) }}</div>
<div class="tile-k app-muted">浏览内容</div>
</div>
<div class="tile">
<div class="tile-v">{{ normalizeCount(taskTotal.total_attachments) }}</div>
<div class="tile-k app-muted">查看附件</div>
</div>
</div>
<div class="metrics-block">
<div class="block-title">累计</div>
<MetricGrid :items="taskTotalCards" :loading="refreshing" :min-width="120" />
</div>
</el-card>
</el-col>
@@ -466,41 +456,13 @@ onUnmounted(() => {
</div>
</div>
<div class="tile-grid tile-grid--3">
<div class="tile">
<div class="tile-v">{{ normalizeCount(emailStats?.total_sent) }}</div>
<div class="tile-k app-muted">总发送</div>
</div>
<div class="tile">
<div class="tile-v ok">{{ normalizeCount(emailStats?.total_success) }}</div>
<div class="tile-k app-muted">成功</div>
</div>
<div class="tile">
<div class="tile-v err">{{ normalizeCount(emailStats?.total_failed) }}</div>
<div class="tile-k app-muted">失败</div>
</div>
</div>
<MetricGrid :items="emailCards" :loading="refreshing" :min-width="132" />
<div class="divider"></div>
<div class="sub-title">类型统计</div>
<div class="type-grid">
<div class="type-item">
<div class="type-v">{{ normalizeCount(emailStats?.register_sent) }}</div>
<div class="type-k app-muted">注册验证</div>
</div>
<div class="type-item">
<div class="type-v">{{ normalizeCount(emailStats?.reset_sent) }}</div>
<div class="type-k app-muted">密码重置</div>
</div>
<div class="type-item">
<div class="type-v">{{ normalizeCount(emailStats?.bind_sent) }}</div>
<div class="type-k app-muted">邮箱绑定</div>
</div>
<div class="type-item">
<div class="type-v">{{ normalizeCount(emailStats?.task_complete_sent) }}</div>
<div class="type-k app-muted">任务完成</div>
</div>
<div class="metrics-block">
<div class="block-title">类型统计</div>
<MetricGrid :items="emailTypeCards" :loading="refreshing" :min-width="132" />
</div>
</el-card>
</el-col>
@@ -519,24 +481,9 @@ onUnmounted(() => {
</div>
</div>
<div class="tile-grid tile-grid--3">
<div class="tile">
<div class="tile-v">{{ normalizeCount(feedbackStats?.total) }}</div>
<div class="tile-k app-muted">总反馈</div>
</div>
<div class="tile">
<div class="tile-v warn">{{ normalizeCount(feedbackStats?.pending) }}</div>
<div class="tile-k app-muted">待处理</div>
</div>
<div class="tile">
<div class="tile-v ok">{{ normalizeCount(feedbackStats?.replied) }}</div>
<div class="tile-k app-muted">已回复</div>
</div>
</div>
<MetricGrid :items="feedbackCards" :loading="refreshing" :min-width="145" />
<div class="divider"></div>
<div class="help app-muted">提示用户的反馈需要及时处理避免影响活跃度与留存</div>
<div class="help app-muted">提示反馈处理越及时用户留存与满意度越高</div>
</el-card>
</el-col>
</el-row>
@@ -590,7 +537,7 @@ onUnmounted(() => {
<div class="divider"></div>
<div class="sub-title">容器</div>
<div class="block-title">容器</div>
<el-descriptions border :column="2" size="small">
<el-descriptions-item label="状态">{{ dockerStats?.status || '-' }}</el-descriptions-item>
<el-descriptions-item label="容器名">{{ dockerStats?.container_name || '-' }}</el-descriptions-item>
@@ -614,24 +561,7 @@ onUnmounted(() => {
<el-tag v-if="browserPoolStats?.server_time_cst" effect="light" type="info">{{ browserPoolStats.server_time_cst }}</el-tag>
</div>
<div class="tile-grid tile-grid--4">
<div class="tile">
<div class="tile-v">{{ browserPoolTotalWorkers }}</div>
<div class="tile-k app-muted"> Worker</div>
</div>
<div class="tile">
<div class="tile-v ok">{{ browserPoolActiveWorkers }}</div>
<div class="tile-k app-muted">活跃有执行环境</div>
</div>
<div class="tile">
<div class="tile-v">{{ browserPoolIdleWorkers }}</div>
<div class="tile-k app-muted">空闲无任务</div>
</div>
<div class="tile">
<div class="tile-v warn">{{ browserPoolQueueSize }}</div>
<div class="tile-k app-muted">队列等待</div>
</div>
</div>
<MetricGrid :items="browserPoolCards" :loading="refreshing" :min-width="120" />
<div class="divider"></div>
@@ -722,7 +652,7 @@ onUnmounted(() => {
gap: 14px;
}
.hero {
.report-hero {
position: relative;
overflow: hidden;
border-radius: 18px;
@@ -730,31 +660,24 @@ onUnmounted(() => {
background: radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.18), transparent 48%),
radial-gradient(circle at 80% 0%, rgba(236, 72, 153, 0.16), transparent 45%),
radial-gradient(circle at 90% 90%, rgba(16, 185, 129, 0.14), transparent 42%),
rgba(255, 255, 255, 0.65);
rgba(255, 255, 255, 0.72);
box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
backdrop-filter: saturate(180%) blur(12px);
padding: 16px;
}
.hero-top {
.hero-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 10px;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 14px;
}
.hero-title-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.hero-title h2 {
.hero-main h2 {
margin: 0;
font-size: 18px;
font-size: 19px;
font-weight: 900;
letter-spacing: 0.2px;
}
@@ -763,9 +686,9 @@ onUnmounted(() => {
margin-top: 6px;
font-size: 12px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.hero-dot {
@@ -779,140 +702,10 @@ onUnmounted(() => {
flex-wrap: wrap;
}
.kpi-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.kpi-card {
position: relative;
overflow: hidden;
border-radius: 16px;
border: 1px solid rgba(17, 24, 39, 0.1);
background: rgba(255, 255, 255, 0.7);
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
padding: 14px;
display: flex;
gap: 12px;
align-items: flex-start;
transition:
transform 160ms ease,
box-shadow 160ms ease,
border-color 160ms ease;
}
.kpi-card::before {
content: '';
position: absolute;
inset: 0;
background: var(--kpi-grad, transparent);
opacity: 0.9;
pointer-events: none;
}
.kpi-card::after {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
height: 3px;
background: var(--kpi-top, transparent);
opacity: 0.9;
pointer-events: none;
}
.kpi-card:hover {
transform: translateY(-2px);
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
border-color: rgba(17, 24, 39, 0.14);
}
.kpi-icon {
position: relative;
z-index: 1;
width: 38px;
height: 38px;
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
background: var(--kpi-icon-bg, rgba(59, 130, 246, 0.14));
color: var(--kpi-icon-color, #1d4ed8);
border: 1px solid rgba(17, 24, 39, 0.08);
flex: 0 0 auto;
}
.kpi-body {
position: relative;
z-index: 1;
min-width: 0;
}
.kpi-value {
font-size: 22px;
font-weight: 900;
line-height: 1.1;
}
.kpi-label {
margin-top: 6px;
font-size: 12px;
color: rgba(17, 24, 39, 0.7);
}
.kpi-sub {
margin-top: 6px;
font-size: 12px;
}
.kpi-tone--blue {
--kpi-grad: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(6, 182, 212, 0.1));
--kpi-top: linear-gradient(90deg, #3b82f6, #06b6d4);
--kpi-icon-bg: rgba(59, 130, 246, 0.14);
--kpi-icon-color: #1d4ed8;
}
.kpi-tone--green {
--kpi-grad: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(34, 197, 94, 0.1));
--kpi-top: linear-gradient(90deg, #10b981, #22c55e);
--kpi-icon-bg: rgba(16, 185, 129, 0.14);
--kpi-icon-color: #047857;
}
.kpi-tone--purple {
--kpi-grad: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(236, 72, 153, 0.1));
--kpi-top: linear-gradient(90deg, #8b5cf6, #ec4899);
--kpi-icon-bg: rgba(139, 92, 246, 0.14);
--kpi-icon-color: #6d28d9;
}
.kpi-tone--orange {
--kpi-grad: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(249, 115, 22, 0.1));
--kpi-top: linear-gradient(90deg, #f59e0b, #f97316);
--kpi-icon-bg: rgba(245, 158, 11, 0.14);
--kpi-icon-color: #b45309;
}
.kpi-tone--red {
--kpi-grad: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(244, 63, 94, 0.1));
--kpi-top: linear-gradient(90deg, #ef4444, #f43f5e);
--kpi-icon-bg: rgba(239, 68, 68, 0.14);
--kpi-icon-color: #b91c1c;
}
.kpi-tone--cyan {
--kpi-grad: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(59, 130, 246, 0.1));
--kpi-top: linear-gradient(90deg, #22d3ee, #3b82f6);
--kpi-icon-bg: rgba(34, 211, 238, 0.14);
--kpi-icon-color: #0369a1;
}
.panel {
border-radius: 18px;
border: 1px solid rgba(17, 24, 39, 0.1);
background: rgba(255, 255, 255, 0.7);
background: rgba(255, 255, 255, 0.72);
box-shadow: var(--app-shadow);
backdrop-filter: saturate(180%) blur(10px);
}
@@ -991,60 +784,16 @@ onUnmounted(() => {
text-overflow: ellipsis;
}
.tile-section {
.metrics-block {
display: flex;
flex-direction: column;
gap: 10px;
}
.tile-title {
font-size: 12px;
font-weight: 800;
letter-spacing: 0.2px;
}
.tile-grid {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 10px;
}
.tile-grid--3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tile-grid--4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tile {
border: 1px solid rgba(17, 24, 39, 0.08);
border-radius: 16px;
padding: 12px;
background: rgba(255, 255, 255, 0.65);
}
.tile-v {
font-size: 18px;
.block-title {
font-size: 13px;
font-weight: 900;
line-height: 1.1;
}
.tile-k {
margin-top: 6px;
font-size: 12px;
}
.ok {
color: #047857;
}
.warn {
color: #b45309;
}
.err {
color: #b91c1c;
letter-spacing: 0.2px;
}
.divider {
@@ -1063,38 +812,11 @@ onUnmounted(() => {
gap: 6px;
}
.sub-title {
font-size: 13px;
font-weight: 900;
margin-bottom: 10px;
letter-spacing: 0.2px;
}
.type-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.type-item {
border: 1px solid rgba(17, 24, 39, 0.08);
border-radius: 16px;
padding: 12px;
background: rgba(255, 255, 255, 0.65);
}
.type-v {
font-size: 16px;
font-weight: 900;
}
.type-k {
margin-top: 6px;
font-size: 12px;
}
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.help {
@@ -1112,7 +834,7 @@ onUnmounted(() => {
border: 1px solid rgba(17, 24, 39, 0.08);
border-radius: 16px;
padding: 12px;
background: rgba(255, 255, 255, 0.65);
background: rgba(255, 255, 255, 0.7);
}
.resource-k {
@@ -1135,7 +857,7 @@ onUnmounted(() => {
border: 1px solid rgba(17, 24, 39, 0.08);
border-radius: 16px;
padding: 12px;
background: rgba(255, 255, 255, 0.65);
background: rgba(255, 255, 255, 0.7);
}
.config-k {
@@ -1166,6 +888,10 @@ onUnmounted(() => {
font-size: 12px;
}
.err {
color: #b91c1c;
}
:deep(.el-table) {
--el-table-border-color: rgba(17, 24, 39, 0.08);
--el-table-header-bg-color: rgba(246, 247, 251, 0.8);
@@ -1176,30 +902,8 @@ onUnmounted(() => {
}
@media (max-width: 768px) {
.kpi-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tile-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tile-grid--3 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tile-grid--4 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.resource-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 520px) {
.kpi-grid {
grid-template-columns: 1fr;
}
}
</style>

View File

@@ -16,6 +16,7 @@ import {
unbanIp,
unbanUser,
} from '../api/security'
import MetricGrid from '../components/MetricGrid.vue'
const pageSize = 20
@@ -119,9 +120,27 @@ const threatTypeOptions = computed(() => {
const dashboardCards = computed(() => {
const d = dashboard.value || {}
return [
{ key: 'threat_events_24h', label: '最近24小时威胁事件', value: normalizeCount(d.threat_events_24h) },
{ key: 'banned_ip_count', label: '当前封禁IP数', value: normalizeCount(d.banned_ip_count) },
{ key: 'banned_user_count', label: '当前封禁用户数', value: normalizeCount(d.banned_user_count) },
{
key: 'threat_events_24h',
label: '最近24小时威胁事件',
value: normalizeCount(d.threat_events_24h),
tone: 'red',
hint: '用于衡量当前攻击面活跃度',
},
{
key: 'banned_ip_count',
label: '当前封禁 IP 数',
value: normalizeCount(d.banned_ip_count),
tone: 'orange',
hint: '自动与人工封禁总量',
},
{
key: 'banned_user_count',
label: '当前封禁用户数',
value: normalizeCount(d.banned_user_count),
tone: 'purple',
hint: '高风险账户拦截情况',
},
]
})
@@ -452,17 +471,7 @@ onMounted(async () => {
</div>
</div>
<el-row :gutter="12" class="stats-row">
<el-col v-for="it in dashboardCards" :key="it.key" :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
<el-card shadow="never" class="stat-card" :body-style="{ padding: '14px' }">
<div class="stat-value">
<el-skeleton v-if="dashboardLoading" :rows="1" animated />
<template v-else>{{ it.value }}</template>
</div>
<div class="stat-label">{{ it.label }}</div>
</el-card>
</el-col>
</el-row>
<MetricGrid :items="dashboardCards" :loading="dashboardLoading" :min-width="220" />
<el-card shadow="never" :body-style="{ padding: '16px' }" class="card">
<el-tabs v-model="activeTab">
@@ -731,7 +740,8 @@ onMounted(async () => {
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.toolbar {
@@ -741,13 +751,12 @@ onMounted(async () => {
flex-wrap: wrap;
}
.stats-row {
margin-bottom: 2px;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.sub-card {
@@ -756,23 +765,6 @@ onMounted(async () => {
border: 1px solid var(--app-border);
}
.stat-card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
box-shadow: var(--app-shadow);
}
.stat-value {
font-size: 22px;
font-weight: 800;
line-height: 1.1;
}
.stat-label {
margin-top: 6px;
font-size: 12px;
color: var(--app-muted);
}
.filters {
display: flex;
@@ -784,6 +776,9 @@ onMounted(async () => {
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.ellipsis {

View File

@@ -132,18 +132,22 @@ async function savePassword() {
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.section-title {
margin: 0 0 12px;
font-size: 14px;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.help {

View File

@@ -642,18 +642,22 @@ onMounted(loadAll)
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.section-title {
margin: 0 0 12px;
font-size: 14px;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.kdocs-qr {

View File

@@ -285,18 +285,22 @@ onMounted(refreshAll)
.page-stack {
display: flex;
flex-direction: column;
gap: 12px;
gap: 14px;
min-width: 0;
}
.card {
border-radius: var(--app-radius);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.section-title {
margin: 0 0 12px;
font-size: 14px;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.help {
@@ -306,6 +310,9 @@ onMounted(refreshAll)
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.user-block {

View File

@@ -1,10 +1,14 @@
:root {
--app-bg: #f6f7fb;
--app-bg: #f4f6fb;
--app-text: #111827;
--app-muted: #6b7280;
--app-border: rgba(17, 24, 39, 0.08);
--app-border: rgba(15, 23, 42, 0.1);
--app-border-strong: rgba(15, 23, 42, 0.14);
--app-radius: 12px;
--app-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
--app-radius-lg: 14px;
--app-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.05);
--app-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
--app-card-bg: rgba(255, 255, 255, 0.94);
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
@@ -20,10 +24,17 @@ body,
height: 100%;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--app-bg);
color: var(--app-text);
background:
radial-gradient(1200px 500px at -10% -10%, rgba(59, 130, 246, 0.12), transparent 55%),
radial-gradient(1000px 420px at 110% 0%, rgba(139, 92, 246, 0.1), transparent 50%),
var(--app-bg);
}
a {
@@ -36,13 +47,13 @@ a {
align-items: center;
justify-content: space-between;
gap: 12px;
margin: 0 0 12px;
margin: 0 0 14px;
}
.app-page-title h2 {
margin: 0;
font-size: 18px;
font-weight: 700;
font-size: 19px;
font-weight: 800;
letter-spacing: 0.2px;
}
@@ -50,12 +61,72 @@ a {
color: var(--app-muted);
}
.page-stack {
display: flex;
flex-direction: column;
gap: 14px;
min-width: 0;
}
.el-card {
border-radius: var(--app-radius-lg);
border: 1px solid var(--app-border);
background: var(--app-card-bg);
box-shadow: var(--app-shadow-soft);
}
.el-button {
border-radius: 10px;
font-weight: 600;
}
.el-input__wrapper,
.el-textarea__inner,
.el-select__wrapper,
.el-input-number,
.el-picker__wrapper {
border-radius: 10px;
}
.el-table {
border-radius: 10px;
overflow: hidden;
}
.el-table th.el-table__cell {
background: #f8fafc;
color: #334155;
font-weight: 700;
}
.el-table td.el-table__cell,
.el-table th.el-table__cell {
padding-top: 11px;
padding-bottom: 11px;
}
.el-table .el-table__row:hover > td.el-table__cell {
background: #f8fbff;
}
.el-tag {
border-radius: 999px;
}
.el-dialog {
border-radius: var(--app-radius-lg);
}
@media (max-width: 768px) {
.app-page-title {
flex-wrap: wrap;
align-items: flex-start;
}
.app-page-title h2 {
font-size: 17px;
}
.el-dialog {
max-width: 92vw;
}
@@ -78,3 +149,59 @@ a {
width: 100%;
}
}
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.section-title {
margin: 0;
font-size: 15px;
font-weight: 800;
letter-spacing: 0.2px;
}
.toolbar {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.table-wrap {
overflow-x: auto;
border-radius: 10px;
border: 1px solid var(--app-border);
background: #fff;
}
.pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 14px;
flex-wrap: wrap;
}
.page-hint {
font-size: 12px;
}
.el-tabs__item {
font-weight: 700;
}
.el-form-item {
margin-bottom: 18px;
}
@media (max-width: 768px) {
.pagination {
justify-content: flex-start;
}
}