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