refactor(desktop-client): tidy PublishManagementView copy and errors

将队列提示与英文 eyebrow 全部本地化为中文,并改为通过
unwrapClientErrorMessage + normalizeTaskErrorMessage 统一兜底,
避免不同操作回退到原始 Error.message 时漏掉发布器归一化结果。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 10:22:03 +08:00
parent 7b6ae0f6d0
commit 764abf32ae
@@ -14,6 +14,7 @@ import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import StatusBadge from "../components/StatusBadge.vue"; import StatusBadge from "../components/StatusBadge.vue";
import { useDesktopRuntime } from "../composables/useDesktopRuntime"; import { useDesktopRuntime } from "../composables/useDesktopRuntime";
import { unwrapClientErrorMessage } from "../lib/client-errors";
import { formatDateTime, formatRelativeTime } from "../lib/formatters"; import { formatDateTime, formatRelativeTime } from "../lib/formatters";
import { desktopPlatformShortName, desktopPublishMediaCatalog, translateDesktopPlatform } from "../lib/media-catalog"; import { desktopPlatformShortName, desktopPublishMediaCatalog, translateDesktopPlatform } from "../lib/media-catalog";
import { normalizePublisherErrorMessage } from "../../shared/publisher-errors"; import { normalizePublisherErrorMessage } from "../../shared/publisher-errors";
@@ -199,7 +200,7 @@ function summaryForTask(
): string { ): string {
switch (status) { switch (status) {
case "queued": case "queued":
return "任务已进入队列,前面的 PublishTasks 翻完后再继续展示历史记录。"; return "任务已进入队列,前面的发布任务完成后继续执行。";
case "in_progress": case "in_progress":
return "当前正在由桌面端执行发送,请避免重复触发。"; return "当前正在由桌面端执行发送,请避免重复触发。";
case "succeeded": case "succeeded":
@@ -277,7 +278,7 @@ async function refreshTasks(page = currentPage.value) {
taskPage.value = response; taskPage.value = response;
currentPage.value = response.page; currentPage.value = response.page;
} catch (err) { } catch (err) {
error.value = err instanceof Error ? err.message : "desktop publish tasks unavailable"; error.value = normalizeTaskErrorMessage(unwrapClientErrorMessage(err, "发布任务暂时不可用"));
} finally { } finally {
loading.value = false; loading.value = false;
} }
@@ -291,7 +292,7 @@ async function retryTask(taskId: string) {
notifySuccess("已重新加入发布队列"); notifySuccess("已重新加入发布队列");
await refreshTasks(); await refreshTasks();
} catch (err) { } catch (err) {
notifyActionError(err instanceof Error ? err.message : "重新发送失败"); notifyActionError(normalizeTaskErrorMessage(unwrapClientErrorMessage(err, "重新发送失败")) ?? "重新发送失败");
} finally { } finally {
actionPendingTaskId.value = null; actionPendingTaskId.value = null;
} }
@@ -305,7 +306,7 @@ async function openExternalUrl(url: string | null) {
try { try {
await window.desktopBridge.app.openExternalUrl(url); await window.desktopBridge.app.openExternalUrl(url);
} catch (err) { } catch (err) {
notifyActionError(err instanceof Error ? err.message : "打开外链失败"); notifyActionError(normalizeTaskErrorMessage(unwrapClientErrorMessage(err, "打开外链失败")) ?? "打开外链失败");
} }
} }
@@ -321,7 +322,7 @@ async function openAccountWorkbench(record: PublishTaskItem) {
displayName: account?.displayName ?? record.accountName, displayName: account?.displayName ?? record.accountName,
}); });
} catch (err) { } catch (err) {
notifyActionError(err instanceof Error ? err.message : "打开账号工作台失败"); notifyActionError(normalizeTaskErrorMessage(unwrapClientErrorMessage(err, "打开账号工作台失败")) ?? "打开账号工作台失败");
} finally { } finally {
consolePendingTaskId.value = null; consolePendingTaskId.value = null;
} }
@@ -359,7 +360,7 @@ async function copyErrorMessage(record: PublishTaskItem) {
} }
}, 1_500); }, 1_500);
} catch (err) { } catch (err) {
notifyActionError(err instanceof Error ? err.message : "复制错误详情失败"); notifyActionError(normalizeTaskErrorMessage(unwrapClientErrorMessage(err, "复制错误详情失败")) ?? "复制错误详情失败");
} }
} }
@@ -470,7 +471,7 @@ const tableScroll = { x: 1080 } as const;
<section class="hero-card"> <section class="hero-card">
<div class="hero-header"> <div class="hero-header">
<div class="hero-title"> <div class="hero-title">
<p class="eyebrow">PUBLISH EXECUTION DESK</p> <p class="eyebrow">发布执行台</p>
<h2>发布管理</h2> <h2>发布管理</h2>
</div> </div>
<div class="hero-actions"> <div class="hero-actions">
@@ -505,7 +506,7 @@ const tableScroll = { x: 1080 } as const;
<div class="hero-header table-toolbar"> <div class="hero-header table-toolbar">
<div class="toolbar-meta"> <div class="toolbar-meta">
<h3 class="section-title">待发布与已发送记录</h3> <h3 class="section-title">待发布与已发送记录</h3>
<p class="section-desc">待发布任务始终排在最前每页 10 分页与总数以服务端返回的 PublishTasks 为准</p> <p class="section-desc">待发布任务始终排在最前每页 10 分页与总数以服务端返回的发布任务为准</p>
</div> </div>
<div class="toolbar-filters"> <div class="toolbar-filters">
<a-input <a-input