Skip to content

Commit ff4e814

Browse files
committed
mediaSession
我也不知道做了干嘛
1 parent 8344d93 commit ff4e814

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

MaiChartManager/Front/src/components/MusicEdit/index.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import AcbAwb from "@/components/MusicEdit/AcbAwb";
1313
import GenreInput from "@/components/GenreInput";
1414
import VersionInput from "@/components/VersionInput";
1515
import { captureException } from "@sentry/vue"
16+
import noJacket from "@/assets/noJacket.webp";
17+
import { getUrl } from "@/client/api";
1618

1719
const Component = defineComponent({
1820
setup() {
@@ -40,6 +42,19 @@ const Component = defineComponent({
4042
watch(() => info.value?.comment, sync('comment', api.EditMusicComment));
4143
watch(() => info.value?.longMusic, sync('longMusic', api.EditMusicLong));
4244

45+
onMounted(()=>{
46+
if ('mediaSession' in navigator) {
47+
navigator.mediaSession.metadata = new MediaMetadata({
48+
title: info.value?.name || '',
49+
artist: info.value?.artist || '',
50+
album: genreList.value.find(genre => genre.id === info.value?.genreId)?.genreName || '',
51+
artwork: [
52+
{ src: info.value?.hasJacket ? getUrl(`GetJacketApi/${selectedADir.value}/${info.value?.id}?${(info.value as any).updateTime}`) : noJacket, type: 'image/png' },
53+
]
54+
});
55+
}
56+
})
57+
4358
return () => info.value && <NForm showFeedback={false} labelPlacement="top" disabled={selectedADir.value === 'A000'}>
4459
<div class="grid cols-[1fr_12em] gap-5">
4560
<NFlex vertical class="relative">

MaiChartManager/Front/src/components/MusicList/ConflictDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineComponent({
1010
type: {type: String, required: true},
1111
},
1212
setup(props) {
13-
return () => <NPopover trigger="hover">
13+
return () => !!props.conflicts.length && <NPopover trigger="hover">
1414
{{
1515
trigger: () => props.type === 'up' ?
1616
// @ts-ignore

0 commit comments

Comments
 (0)