style(desktop): refresh Home and Publish views with modern card layout

Inline the card styling on HomeView and PublishManagementView instead of
leaning on the generic MetricCard/SurfaceCard wrappers — larger numerics,
softer radii, clearer section headers, and a stats strip on the Publish hero.
No behavioral changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 16:04:39 +08:00
parent 40c9c36653
commit 07881a66d0
2 changed files with 685 additions and 554 deletions
@@ -4,7 +4,6 @@ import type { DesktopPublishTaskListResponse, DesktopTaskInfo, JsonValue } from
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import StatusBadge from "../components/StatusBadge.vue";
import SurfaceCard from "../components/SurfaceCard.vue";
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
import { formatDateTime, formatRelativeTime, titleCaseToken } from "../lib/formatters";
@@ -284,258 +283,396 @@ const tableColumns = [
</script>
<template>
<section class="page">
<header class="hero">
<div class="hero-copy">
<p class="eyebrow">PUBLISH EXECUTION DESK</p>
<h2>发布管理</h2>
<p class="hero-summary">
统一用一个 table 查看当前设备负责的待发布队列与已发送历史页面固定每页 10 待发布任务会始终排在最前面只有当前页的
PublishTasks 展示完后才会继续补已发送历史记录
</p>
</div>
</header>
<SurfaceCard
eyebrow="Publish Tasks"
title="待发布与已发送记录"
description="支持按文章标题搜索,分页与总数以服务端返回的 PublishTasks 结果为准。"
>
<template #action>
<a-button :loading="loading" @click="refreshTasks()">
<template #icon><ReloadOutlined /></template>
刷新
</a-button>
</template>
<div class="table-toolbar">
<div class="toolbar-stats">
<span class="stat-chip">总数 {{ totalCount }}</span>
<span class="stat-chip">等待发布 {{ pendingCount }}</span>
<span class="stat-chip">已发送 {{ historyTotal }}</span>
<section class="page-container">
<section class="hero-card">
<div class="hero-header">
<div class="hero-title">
<p class="eyebrow">PUBLISH EXECUTION DESK</p>
<h2>发布管理</h2>
<p class="summary">
统一用一个 table 查看当前设备负责的待发布队列与已发送历史页面固定每页 10 待发布任务会始终排在最前面只有当前页的 PublishTasks 展示完后才会继续补已发送历史记录
</p>
</div>
<div class="toolbar-search">
<a-input
v-model:value="searchTitle"
allow-clear
placeholder="搜索文章标题"
class="search-input"
@pressEnter="applySearch"
>
<template #prefix>
<SearchOutlined style="color: #bfbfbf" />
</template>
</a-input>
<a-button type="primary" @click="applySearch">搜索</a-button>
<div class="hero-actions">
<a-button type="primary" ghost class="modern-btn" :loading="loading" @click="refreshTasks()">
<template #icon><ReloadOutlined /></template>
刷新状态
</a-button>
</div>
</div>
<div class="stats-strip">
<div class="stat-card">
<div class="stat-label">历史总数</div>
<div class="stat-value">{{ totalCount }}</div>
</div>
<div class="stat-card">
<div class="stat-label">等待发布</div>
<div class="stat-value">{{ pendingCount }}</div>
</div>
<div class="stat-card">
<div class="stat-label">已发送</div>
<div class="stat-value">{{ historyTotal }}</div>
</div>
</div>
</section>
<a-table
row-key="id"
class="modern-table publish-table"
:columns="tableColumns"
:data-source="publishTasks"
:pagination="false"
:loading="loading"
:row-class-name="rowClassName"
>
<template #emptyText>
<a-empty description="暂无匹配的发布任务" />
</template>
<!-- Feedback Banners -->
<div v-if="actionMessage" class="feedback-banner success"><div class="success-text">{{ actionMessage }}</div></div>
<div v-if="error" class="feedback-banner error"><div class="error-text">{{ error }}</div></div>
<div v-if="actionError" class="feedback-banner error"><div class="error-text">{{ actionError }}</div></div>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'title'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title">{{ record.title }}</span>
<span class="subtitle">
<template v-if="record.articleId">文章 #{{ record.articleId }} · </template>
{{ isPendingStatus(record.status) ? "待发布队列" : "已发送历史" }}
</span>
</div>
</div>
<!-- Table Details Section -->
<section class="content-section">
<div class="hero-card" style="padding-bottom: 0;">
<div class="hero-header" style="padding: 24px 32px 16px; border-bottom: 1px solid #eef2f6; align-items: center;">
<div style="flex: 1;">
<h3 class="section-title">待发布与已发送记录</h3>
<p class="section-desc" style="margin-top: 4px;">支持按文章标题搜索分页与总数以服务端返回的 PublishTasks 结果为准</p>
</div>
<!-- Filters ToolBar -->
<div style="display: flex; gap: 12px; align-items: center;">
<a-input
v-model:value="searchTitle"
allow-clear
placeholder="搜索文章标题"
style="width: 280px;"
@pressEnter="applySearch"
>
<template #prefix>
<SearchOutlined style="color: #94a3b8" />
</template>
</a-input>
<a-button type="primary" class="modern-btn" style="border-radius: 8px; font-weight: 500;" @click="applySearch">搜索</a-button>
</div>
</div>
<a-table
row-key="id"
class="modern-table publish-table"
:columns="tableColumns"
:data-source="publishTasks"
:pagination="false"
:loading="loading"
:row-class-name="rowClassName"
>
<template #emptyText>
<div style="padding: 60px; color: #94a3b8;"><a-empty description="暂无匹配的发布任务" /></div>
</template>
<template v-else-if="column.key === 'account'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title">{{ record.accountName }}</span>
<span class="subtitle">{{ translatePlatform(record.platform) }}</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'status'">
<div class="status-cell">
<StatusBadge :tone="statusTone(record.status)" :label="statusLabel(record.status)" />
<span v-if="isPendingStatus(record.status)" class="status-note">优先展示</span>
</div>
</template>
<template v-else-if="column.key === 'meta'">
<div class="cell-primary-secondary meta-cell">
<div class="info-stack">
<span class="subtitle strong-text">{{ record.summary }}</span>
<span v-if="record.errorMessage" class="error-text">{{ record.errorMessage }}</span>
<span class="subtitle">
尝试 {{ record.attempts }}
<template v-if="record.leaseExpiresAt"> · 租约 {{ formatRelativeTime(record.leaseExpiresAt) }} 到期</template>
<template v-else-if="record.externalArticleUrl"> · 已生成外链</template>
<template v-else-if="record.externalManageUrl"> · 已生成管理链接</template>
</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'time'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title">{{ formatDateTime(record.updatedAt) }}</span>
<span class="subtitle">更新于 {{ formatRelativeTime(record.updatedAt) }}</span>
<span class="subtitle">创建于 {{ formatDateTime(record.createdAt) }}</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'actions'">
<div class="action-buttons">
<a-popconfirm
v-if="!isPendingStatus(record.status)"
title="确定要重试本次发布吗?"
placement="topRight"
ok-text="确定"
cancel-text="取消"
@confirm="retryTask(record.id)"
>
<a-tooltip title="再次发送" placement="top">
<a-button
type="text"
class="icon-action-btn"
:loading="actionPendingTaskId === record.id"
>
<template #icon><SendOutlined /></template>
</a-button>
</a-tooltip>
</a-popconfirm>
<a-tooltip v-else title="排队中...">
<div class="action-placeholder-icon">
<ClockCircleOutlined />
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'title'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title">{{ record.title }}</span>
<span class="subtitle">
<template v-if="record.articleId">文章 #{{ record.articleId }} · </template>
{{ isPendingStatus(record.status) ? "待发布队列" : "已发送历史" }}
</span>
</div>
</a-tooltip>
</div>
</div>
</template>
<template v-else-if="column.key === 'account'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title">{{ record.accountName }}</span>
<span class="subtitle">{{ translatePlatform(record.platform) }}</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'status'">
<div class="status-cell">
<StatusBadge :tone="statusTone(record.status)" :label="statusLabel(record.status)" />
</div>
</template>
<template v-else-if="column.key === 'meta'">
<div class="cell-primary-secondary meta-cell">
<div class="info-stack">
<span class="subtitle strong-text">{{ record.summary }}</span>
<span v-if="record.errorMessage" class="error-text">{{ record.errorMessage }}</span>
<span class="subtitle mono-detail">
尝试 {{ record.attempts }}
<template v-if="record.leaseExpiresAt"> · 租约 {{ formatRelativeTime(record.leaseExpiresAt) }} 到期</template>
<template v-else-if="record.externalArticleUrl"> · 已生成外链</template>
<template v-else-if="record.externalManageUrl"> · 已生成管理链接</template>
</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'time'">
<div class="cell-primary-secondary">
<div class="info-stack">
<span class="title mono-text">{{ formatDateTime(record.updatedAt) }}</span>
<span class="subtitle">更新于 {{ formatRelativeTime(record.updatedAt) }}</span>
<span class="subtitle">创建 {{ formatDateTime(record.createdAt) }}</span>
</div>
</div>
</template>
<template v-else-if="column.key === 'actions'">
<div class="action-buttons">
<a-popconfirm
v-if="!isPendingStatus(record.status)"
title="确定要重试本次发布吗?"
placement="topRight"
ok-text="确定"
cancel-text="取消"
@confirm="retryTask(record.id)"
>
<a-tooltip title="再次发送" placement="top">
<a-button
type="text"
class="icon-action-btn"
:loading="actionPendingTaskId === record.id"
>
<template #icon><SendOutlined /></template>
</a-button>
</a-tooltip>
</a-popconfirm>
<a-tooltip v-else title="排队中...">
<div class="action-placeholder-icon">
<ClockCircleOutlined />
</div>
</a-tooltip>
</div>
</template>
</template>
</template>
</a-table>
</a-table>
<div class="table-footer">
<p class="table-note">
当前页固定展示 10 待发布任务会先占满前面的页码 PublishTasks 展示完后才继续显示已发送历史记录
</p>
<a-pagination
:current="currentPage"
:page-size="PAGE_SIZE"
:total="totalCount"
:show-size-changer="false"
@change="handlePageChange"
/>
<div class="table-footer">
<a-pagination
:current="currentPage"
:page-size="PAGE_SIZE"
:total="totalCount"
:show-size-changer="false"
@change="handlePageChange"
/>
</div>
</div>
</SurfaceCard>
<p v-if="actionMessage" class="success-text">{{ actionMessage }}</p>
<p v-if="error" class="error-text page-feedback">{{ error }}</p>
<p v-if="actionError" class="error-text page-feedback">{{ actionError }}</p>
</section>
</section>
</template>
<style scoped>
.page {
display: grid;
gap: 18px;
.page-container {
display: flex;
flex-direction: column;
gap: 32px;
padding-bottom: 40px;
max-width: 1400px;
}
.hero-copy {
padding: 28px;
border-radius: 12px;
border: 1px solid #e2e8f0;
background: linear-gradient(135deg, #ffffff, #f8fafc);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
/* Hero Section */
.hero-card {
background: #ffffff;
border-radius: 20px;
border: 1px solid #eef2f6;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.01);
overflow: hidden;
}
.eyebrow,
.hero-summary,
h2 {
margin: 0;
.hero-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 36px 40px;
}
.eyebrow {
color: #8c8c8c;
font-size: 11px;
margin: 0 0 12px;
color: #64748b;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
h2 {
margin-top: 8px;
font-size: 24px;
font-weight: 600;
color: #1a1a1a;
line-height: 1.4;
.hero-title h2 {
margin: 0;
font-size: 32px;
font-weight: 800;
color: #0f172a;
letter-spacing: -0.02em;
}
.hero-summary {
margin-top: 12px;
max-width: 860px;
color: #8c8c8c;
.summary {
margin: 16px 0 0;
max-width: 800px;
color: #475569;
line-height: 1.6;
font-size: 15px;
}
.modern-btn {
border-radius: 8px;
height: 40px;
padding: 0 20px;
font-weight: 600;
}
/* Stats Strip */
.stats-strip {
display: flex;
padding: 24px 40px;
background: #f8fafc;
border-top: 1px solid #eef2f6;
gap: 40px;
}
.stat-card {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
}
.stat-label {
font-size: 14px;
font-weight: 500;
color: #64748b;
}
.stat-value {
font-size: 40px;
font-weight: 700;
color: #0f172a;
line-height: 1;
font-feature-settings: "tnum";
}
/* Content Section */
.content-section {
display: flex;
flex-direction: column;
gap: 24px;
}
.section-title {
margin: 0;
font-size: 20px;
font-weight: 700;
color: #0f172a;
}
.section-desc {
margin: 8px 0 0;
color: #64748b;
font-size: 15px;
line-height: 1.5;
}
/* Modern Enterprise Table Styles */
:deep(.modern-table) {
padding: 0 32px;
}
:deep(.modern-table .ant-table-thead > tr > th) {
background-color: transparent !important;
color: #64748b;
font-weight: 600;
font-size: 13px;
border-bottom: 1px solid #e2e8f0;
padding: 16px 12px;
}
.table-toolbar {
:deep(.modern-table .ant-table-tbody > tr > td) {
padding: 16px 12px;
border-bottom: 1px solid #f1f5f9;
color: #0f172a;
vertical-align: top;
transition: background-color 0.2s ease;
}
:deep(.modern-table .ant-table-tbody > tr:last-child > td) {
border-bottom: none;
}
:deep(.modern-table .ant-table-tbody > tr:hover > td) {
background-color: #f8fafc !important;
}
:deep(.publish-table .publish-row--pending > td) {
background: #fdfcee !important;
}
.cell-primary-secondary {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-top: 18px;
margin-bottom: 16px;
flex-direction: column;
}
.toolbar-stats,
.toolbar-search,
.status-cell {
.info-stack {
display: flex;
align-items: center;
gap: 10px;
flex-direction: column;
gap: 2px;
}
.info-stack .title {
font-weight: 600;
color: #0f172a;
font-size: 14px;
line-height: 1.5;
}
.info-stack .subtitle {
color: #64748b;
font-size: 13px;
line-height: 1.5;
}
.info-stack .mono-text {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.info-stack .mono-detail {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px;
color: #94a3b8;
}
.info-stack .strong-text {
color: #1e293b;
font-weight: 500;
}
.error-text {
color: #ef4444;
font-size: 13px;
margin-top: 4px;
font-weight: 500;
}
.success-text {
color: #10b981;
font-size: 13px;
font-weight: 500;
}
/* Action Buttons */
.action-buttons {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
.icon-action-btn {
color: #64748b;
border-radius: 6px;
border-radius: 8px;
transition: all 0.2s ease;
background: transparent;
width: 32px;
height: 32px;
width: 36px;
height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border: 1px solid transparent;
}
.icon-action-btn:hover {
background: #f1f5f9;
color: #0ea5e9;
border-color: #e2e8f0;
}
.action-placeholder-icon {
width: 32px;
height: 32px;
width: 36px;
height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -543,149 +680,44 @@ h2 {
font-size: 16px;
}
.toolbar-stats {
flex-wrap: wrap;
}
.toolbar-search {
justify-content: flex-end;
}
.search-input {
width: 280px;
}
.stat-chip {
display: inline-flex;
align-items: center;
min-height: 32px;
padding: 0 12px;
border-radius: 999px;
background: #f8fafc;
color: #475569;
font-size: 12px;
font-weight: 600;
border: 1px solid #e2e8f0;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.cell-primary-secondary {
display: flex;
align-items: center;
min-height: 52px;
}
.info-stack {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.title,
.subtitle,
.table-note,
.status-note,
.action-placeholder,
.success-text,
.error-text {
margin: 0;
}
.title {
color: #111827;
font-size: 14px;
font-weight: 600;
line-height: 1.5;
word-break: break-word;
}
.subtitle {
color: #8c8c8c;
font-size: 12px;
line-height: 1.6;
}
.strong-text {
color: #4b5563;
}
.meta-cell {
align-items: flex-start;
}
.status-note,
.action-placeholder {
color: #8c8c8c;
font-size: 12px;
}
.table-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-top: 16px;
padding: 16px 32px 32px;
border-top: 1px solid #eef2f6;
background: transparent;
}
.table-note {
color: #8c8c8c;
font-size: 12px;
line-height: 1.6;
}
.success-text {
color: #15803d;
color: #94a3b8;
font-size: 13px;
}
.error-text {
color: #b42318;
font-size: 13px;
.feedback-banner {
padding: 16px 20px;
border-radius: 12px;
background: #fff;
border: 1px solid transparent;
}
.feedback-banner.error {
border-color: #fca5a5;
background: #fef2f2;
}
.feedback-banner.success {
border-color: #6ee7b7;
background: #ecfdf5;
}
.page-feedback {
margin: 0;
}
:deep(.publish-table .ant-table-thead > tr > th) {
background: #f8fafc;
color: #475569;
font-size: 13px;
font-weight: 600;
border-bottom: 1px solid #e2e8f0;
padding: 12px 16px;
}
:deep(.publish-table .ant-table-tbody > tr > td) {
border-bottom: 1px solid #f1f5f9;
vertical-align: top;
background: #ffffff;
padding: 16px;
transition: background-color 0.2s ease;
}
:deep(.publish-table .publish-row--pending > td) {
background: #fefce8;
}
:deep(.publish-table .ant-table-tbody > tr:hover > td) {
background: #f8fafc;
}
@media (max-width: 980px) {
.table-toolbar,
.table-footer {
/* Responsiveness */
@media (max-width: 1024px) {
.hero-header {
flex-direction: column;
align-items: stretch;
gap: 24px;
}
.toolbar-search {
justify-content: stretch;
}
.search-input {
width: 100%;
.stats-strip {
flex-wrap: wrap;
gap: 24px;
}
}
</style>