mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
feat(web/songcard): gate play/playNext/add by member capability or guest flag
This commit is contained in:
1 parent
e36a049216
commit
9d8c95b2f9
1 file changed
+11
-4
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="song-card" :class="{ active }" @dblclick="$emit('play')">
|
<div class="song-card" :class="{ active }" @dblclick="showPlay && $emit('play')">
|
||||||
<div class="song-index">{{ index }}</div>
|
<div class="song-index">{{ index }}</div>
|
||||||
<CoverArt :url="song.coverUrl" :size="36" :radius="6" />
|
<CoverArt :url="song.coverUrl" :size="36" :radius="6" />
|
||||||
<div class="song-info">
|
<div class="song-info">
|
||||||
@@ -15,13 +15,13 @@
|
|||||||
<div class="song-album">{{ song.album }}</div>
|
<div class="song-album">{{ song.album }}</div>
|
||||||
<div class="song-duration">{{ formatDuration(song.duration) }}</div>
|
<div class="song-duration">{{ formatDuration(song.duration) }}</div>
|
||||||
<div class="song-actions">
|
<div class="song-actions">
|
||||||
<button class="action-btn" @click.stop="$emit('play')" title="播放">
|
<button v-if="showPlay" class="action-btn" @click.stop="$emit('play')" title="播放">
|
||||||
<Icon icon="mdi:play" />
|
<Icon icon="mdi:play" />
|
||||||
</button>
|
</button>
|
||||||
<button class="action-btn" @click.stop="$emit('playNext')" title="下一首播放">
|
<button v-if="showPlayNext" class="action-btn" @click.stop="$emit('playNext')" title="下一首播放">
|
||||||
<Icon icon="mdi:playlist-play" />
|
<Icon icon="mdi:playlist-play" />
|
||||||
</button>
|
</button>
|
||||||
<button class="action-btn" @click.stop="$emit('add')" title="添加到队列">
|
<button v-if="showAdd" class="action-btn" @click.stop="$emit('add')" title="添加到队列">
|
||||||
<Icon icon="mdi:playlist-plus" />
|
<Icon icon="mdi:playlist-plus" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -29,9 +29,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
import CoverArt from './CoverArt.vue';
|
import CoverArt from './CoverArt.vue';
|
||||||
import { Song } from '../stores/player.js';
|
import { Song } from '../stores/player.js';
|
||||||
|
import { useSession } from '../composables/useSession.js';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
song: Song;
|
song: Song;
|
||||||
@@ -39,6 +41,11 @@ defineProps<{
|
|||||||
active?: boolean;
|
active?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const { can, guestCan } = useSession();
|
||||||
|
const showPlay = computed(() => can('player.control') || guestCan('playNow'));
|
||||||
|
const showPlayNext = computed(() => can('player.control') || guestCan('playNext'));
|
||||||
|
const showAdd = computed(() => can('player.queue') || guestCan('addToQueue'));
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
play: [];
|
play: [];
|
||||||
playNext: [];
|
playNext: [];
|
||||||
|
|||||||
Reference in new issue
Block a user