From 33474821645f5e381646b1091e63c9879c011f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Fri, 12 Jul 2024 11:14:03 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E8=A7=86=E9=A2=91=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=B0=81=E9=9D=A2=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/post/tp-vod.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/post/tp-vod.vue b/src/components/post/tp-vod.vue index a6fd3782..1c78c4bd 100644 --- a/src/components/post/tp-vod.vue +++ b/src/components/post/tp-vod.vue @@ -18,6 +18,10 @@ import Artplayer from "artplayer"; import type { Option } from "artplayer/types/option.js"; import { onMounted, ref, toRaw } from "vue"; +import { getImageBuffer, saveCanvasImg } from "../../utils/TGShare.js"; +import { bytesToSize } from "../../utils/toolFunc.js"; +import showSnackbar from "../func/snackbar.js"; + interface TpVod { insert: { vod: { @@ -97,6 +101,19 @@ onMounted(async () => { }`, tooltip: `播放数:${props.data.insert.vod?.view_num ?? 0}`, }, + { + name: "download-cover", + index: 0, + position: "right", + html: ``, + tooltip: "下载封面", + click: async () => { + const buffer = await getImageBuffer(props.data.insert.vod.cover); + const size = bytesToSize(buffer.byteLength); + await saveCanvasImg(buffer, `vod-cover-${props.data.insert.vod.id}`); + showSnackbar({ text: `封面已下载到本地,大小:${size}` }); + }, + }, ], }; container.value = new Artplayer(option);