diff --git a/apps/web/src/pages/duplication/DuplicationDetail.tsx b/apps/web/src/pages/duplication/DuplicationDetail.tsx index 39ad49949..ada59f3a9 100644 --- a/apps/web/src/pages/duplication/DuplicationDetail.tsx +++ b/apps/web/src/pages/duplication/DuplicationDetail.tsx @@ -33,8 +33,9 @@ const formatSize = (bytes: number) => { /** 格式化时长 */ const formatDuration = (seconds?: number) => { if (!seconds) return "-"; - const m = Math.floor(seconds / 60); - const s = seconds % 60; + const totalSec = Math.round(seconds); + const m = Math.floor(totalSec / 60); + const s = totalSec % 60; return m > 0 ? `${m}分${s}秒` : `${s}秒`; }; diff --git a/apps/web/src/pages/duplication/DuplicationResults.tsx b/apps/web/src/pages/duplication/DuplicationResults.tsx index d2bb87da5..e150b215c 100644 --- a/apps/web/src/pages/duplication/DuplicationResults.tsx +++ b/apps/web/src/pages/duplication/DuplicationResults.tsx @@ -59,8 +59,9 @@ const formatSize = (bytes: number) => { /** 格式化时长 */ const formatDuration = (seconds?: number) => { if (!seconds) return "-"; - const m = Math.floor(seconds / 60); - const s = seconds % 60; + const totalSec = Math.round(seconds); + const m = Math.floor(totalSec / 60); + const s = totalSec % 60; return m > 0 ? `${m}分${s}秒` : `${s}秒`; }; diff --git a/apps/web/src/pages/edit-plans/EditPlans.tsx b/apps/web/src/pages/edit-plans/EditPlans.tsx index 89e590526..f78a4a8f2 100644 --- a/apps/web/src/pages/edit-plans/EditPlans.tsx +++ b/apps/web/src/pages/edit-plans/EditPlans.tsx @@ -86,8 +86,9 @@ const STATUS_CONFIG: Record< /** 格式化时长 */ const formatDuration = (seconds: number): string => { if (seconds <= 0) return "-"; - const m = Math.floor(seconds / 60); - const s = seconds % 60; + const totalSec = Math.round(seconds); + const m = Math.floor(totalSec / 60); + const s = totalSec % 60; if (m === 0) return `${s}秒`; return `${m}分${s > 0 ? `${s}秒` : ""}`; }; diff --git a/apps/web/src/pages/templates/TemplateLibrary.tsx b/apps/web/src/pages/templates/TemplateLibrary.tsx index 859af06ff..333b0c4c7 100644 --- a/apps/web/src/pages/templates/TemplateLibrary.tsx +++ b/apps/web/src/pages/templates/TemplateLibrary.tsx @@ -92,8 +92,9 @@ const gradientForCategory = (category: string): string => { /** 格式化时长 */ const formatDuration = (seconds: number | undefined | null): string => { if (!seconds || seconds <= 0) return "0秒"; - const m = Math.floor(seconds / 60); - const s = seconds % 60; + const totalSec = Math.round(seconds); + const m = Math.floor(totalSec / 60); + const s = totalSec % 60; if (m === 0) return `${s}秒`; return `${m}分${s > 0 ? `${s}秒` : ""}`; };