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; -}