mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
fix: address Phase 7 review — move WS/theme init to App.vue, wire Queue component
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
41d9e88c8e
commit
5041a4f3f7
3 files changed
+17
-8
No files matched your search
+9
-1
@@ -9,13 +9,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed, onMounted } from 'vue';
|
||||||
import { usePlayerStore } from './stores/player.js';
|
import { usePlayerStore } from './stores/player.js';
|
||||||
|
import { useWebSocket } from './composables/useWebSocket.js';
|
||||||
import Navbar from './components/Navbar.vue';
|
import Navbar from './components/Navbar.vue';
|
||||||
import Player from './components/Player.vue';
|
import Player from './components/Player.vue';
|
||||||
|
|
||||||
const playerStore = usePlayerStore();
|
const playerStore = usePlayerStore();
|
||||||
const theme = computed(() => playerStore.theme);
|
const theme = computed(() => playerStore.theme);
|
||||||
|
const { connect } = useWebSocket();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
playerStore.loadTheme();
|
||||||
|
connect();
|
||||||
|
playerStore.fetchBots();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -30,18 +30,25 @@
|
|||||||
@input="onVolumeChange"
|
@input="onVolumeChange"
|
||||||
class="volume-slider"
|
class="volume-slider"
|
||||||
/>
|
/>
|
||||||
|
<button class="control-btn" @click="showQueue = !showQueue">
|
||||||
|
<Icon icon="mdi:playlist-music" />
|
||||||
|
</button>
|
||||||
<RouterLink to="/lyrics" class="control-btn lyrics-btn">
|
<RouterLink to="/lyrics" class="control-btn lyrics-btn">
|
||||||
<Icon icon="mdi:microphone" />
|
<Icon icon="mdi:microphone" />
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
<Queue :open="showQueue" @close="showQueue = false" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
import { usePlayerStore } from '../stores/player.js';
|
import { usePlayerStore } from '../stores/player.js';
|
||||||
import CoverArt from './CoverArt.vue';
|
import CoverArt from './CoverArt.vue';
|
||||||
|
import Queue from './Queue.vue';
|
||||||
|
|
||||||
|
const showQueue = ref(false);
|
||||||
|
|
||||||
const store = usePlayerStore();
|
const store = usePlayerStore();
|
||||||
const activeBot = computed(() => store.activeBot);
|
const activeBot = computed(() => store.activeBot);
|
||||||
|
|||||||
@@ -54,11 +54,9 @@ import { ref, onMounted } from 'vue';
|
|||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { usePlayerStore } from '../stores/player.js';
|
import { usePlayerStore } from '../stores/player.js';
|
||||||
import { useWebSocket } from '../composables/useWebSocket.js';
|
|
||||||
import CoverArt from '../components/CoverArt.vue';
|
import CoverArt from '../components/CoverArt.vue';
|
||||||
|
|
||||||
const store = usePlayerStore();
|
const store = usePlayerStore();
|
||||||
const { connect } = useWebSocket();
|
|
||||||
|
|
||||||
interface Playlist {
|
interface Playlist {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -70,10 +68,6 @@ interface Playlist {
|
|||||||
const playlists = ref<Playlist[]>([]);
|
const playlists = ref<Playlist[]>([]);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.loadTheme();
|
|
||||||
connect();
|
|
||||||
await store.fetchBots();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.get('/api/music/recommend/playlists');
|
const res = await axios.get('/api/music/recommend/playlists');
|
||||||
playlists.value = res.data.playlists;
|
playlists.value = res.data.playlists;
|
||||||
|
|||||||
Reference in new issue
Block a user