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