From fe9737c229ea2018759b92b072c287d02be9f999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Mon, 16 Dec 2024 16:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20=E8=B0=83=E6=95=B4load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/viewPost/tp-vod.vue | 16 ++-------------- src/pages/common/PostCollect.vue | 1 - 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/viewPost/tp-vod.vue b/src/components/viewPost/tp-vod.vue index 39ae4362..8e11dc9c 100644 --- a/src/components/viewPost/tp-vod.vue +++ b/src/components/viewPost/tp-vod.vue @@ -10,7 +10,7 @@ icon
mdi-clock-time-four-outline - {{ getVodTime() }} + {{ getVideoDuration(props.data.insert.vod.duration) }}
mdi-eye @@ -26,6 +26,7 @@ import type { Option } from "artplayer/types/option.js"; import { onMounted, ref, shallowRef, toRaw } from "vue"; import { getImageBuffer, saveCanvasImg } from "@/utils/TGShare.js"; +import { getVideoDuration } from "@/utils/toolFunc.js"; type TpVod = { insert: { @@ -115,19 +116,6 @@ onMounted(async () => { container.value = new Artplayer(option); container.value?.on("fullscreen", async (s) => await getCurrentWindow().setFullscreen(s)); }); - -function getVodTime(): string { - const duration = props.data.insert.vod.duration; - const secTotal = Math.floor(duration / 1000); - const seconds = secTotal % 60; - const minutes = Math.floor(secTotal / 60) % 60; - const hours = Math.floor(secTotal / 3600); - let result = ""; - if (hours > 0) result += `${hours.toString().padStart(2, "0")}:`; - result += `${minutes.toString().padStart(2, "0")}:`; - result += `${seconds.toString().padStart(2, "0")}`; - return result; -}