|
@@ -729,6 +729,13 @@ function formatDurationSeconds(secLike: any): string {
|
|
|
return `${s}秒`;
|
|
return `${s}秒`;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 平均观看时长:保留 2 位小数,不取整 */
|
|
|
|
|
+function formatAvgWatchDurationSeconds(secLike: any): string {
|
|
|
|
|
+ const s = Math.max(0, parseFloat(String(secLike ?? '0')) || 0);
|
|
|
|
|
+ if (s >= 60) return `${Math.floor(s / 60)}分${(s % 60).toFixed(2)}秒`;
|
|
|
|
|
+ return `${s.toFixed(2)}秒`;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function formatRate(rateLike: any): string {
|
|
function formatRate(rateLike: any): string {
|
|
|
const raw = String(rateLike ?? '0').trim();
|
|
const raw = String(rateLike ?? '0').trim();
|
|
|
if (!raw) return '0%';
|
|
if (!raw) return '0%';
|
|
@@ -764,7 +771,7 @@ const xhsMetricCards = computed<MetricCardConfig[]>(() => {
|
|
|
{ key: 'collectCount' as const, label: '收藏量', value: formatNumber(d.collectCount || selectedWork.value?.collectsCount || 0) },
|
|
{ key: 'collectCount' as const, label: '收藏量', value: formatNumber(d.collectCount || selectedWork.value?.collectsCount || 0) },
|
|
|
{ key: 'shareCount' as const, label: '分享量', value: formatNumber(d.shareCount || selectedWork.value?.sharesCount || 0) },
|
|
{ key: 'shareCount' as const, label: '分享量', value: formatNumber(d.shareCount || selectedWork.value?.sharesCount || 0) },
|
|
|
{ key: 'coverClickRate' as const, label: '封面点击率', value: formatRate(d.coverClickRate) },
|
|
{ key: 'coverClickRate' as const, label: '封面点击率', value: formatRate(d.coverClickRate) },
|
|
|
- { key: 'avgWatchDuration' as const, label: '平均观看时长', value: formatDurationSeconds(d.avgWatchDuration) },
|
|
|
|
|
|
|
+ { key: 'avgWatchDuration' as const, label: '平均观看时长', value: formatAvgWatchDurationSeconds(d.avgWatchDuration) },
|
|
|
{ key: 'completionRate' as const, label: '完播率', value: formatRate(d.completionRate) },
|
|
{ key: 'completionRate' as const, label: '完播率', value: formatRate(d.completionRate) },
|
|
|
{ key: 'twoSecondExitRate' as const, label: '2s退出率', value: formatRate(d.twoSecondExitRate) },
|
|
{ key: 'twoSecondExitRate' as const, label: '2s退出率', value: formatRate(d.twoSecondExitRate) },
|
|
|
{ key: 'fansIncrease' as const, label: '涨粉量', value: formatNumber(d.fansIncrease || 0) },
|
|
{ key: 'fansIncrease' as const, label: '涨粉量', value: formatNumber(d.fansIncrease || 0) },
|
|
@@ -782,7 +789,7 @@ const douyinMetricCards = computed<MetricCardConfig[]>(() => {
|
|
|
{ key: 'collectCount', label: '收藏量', value: formatNumber(d.collectCount || base?.collectsCount || 0) },
|
|
{ key: 'collectCount', label: '收藏量', value: formatNumber(d.collectCount || base?.collectsCount || 0) },
|
|
|
{ key: 'shareCount', label: '分享量', value: formatNumber(d.shareCount || base?.sharesCount || 0) },
|
|
{ key: 'shareCount', label: '分享量', value: formatNumber(d.shareCount || base?.sharesCount || 0) },
|
|
|
{ key: 'fansIncrease', label: '涨粉量', value: formatNumber(d.fansIncrease || 0) },
|
|
{ key: 'fansIncrease', label: '涨粉量', value: formatNumber(d.fansIncrease || 0) },
|
|
|
- { key: 'avgWatchDuration', label: '平均观看时长', value: formatDurationSeconds(d.avgWatchDuration) },
|
|
|
|
|
|
|
+ { label: '平均观看时长', value: formatAvgWatchDurationSeconds(d.avgWatchDuration) },
|
|
|
{ key: 'completionRate', label: '完播率', value: formatRate(d.completionRate) },
|
|
{ key: 'completionRate', label: '完播率', value: formatRate(d.completionRate) },
|
|
|
{ key: 'twoSecondExitRate', label: '2s退出率', value: formatRate(d.twoSecondExitRate) },
|
|
{ key: 'twoSecondExitRate', label: '2s退出率', value: formatRate(d.twoSecondExitRate) },
|
|
|
// 5s 完播率仅为昨日快照,不参与趋势联动
|
|
// 5s 完播率仅为昨日快照,不参与趋势联动
|