|
1 | 1 | <template> |
2 | | - <div |
3 | | - v-show="statusStore.showFullPlayer" |
4 | | - :style="{ |
5 | | - '--main-color': statusStore.mainColor, |
6 | | - cursor: statusStore.playerMetaShow || isShowComment ? 'auto' : 'none', |
7 | | - }" |
8 | | - :class="['full-player', { 'show-comment': isShowComment }]" |
9 | | - @mouseleave="playerLeave" |
10 | | - > |
11 | | - <!-- 背景 --> |
12 | | - <PlayerBackground /> |
13 | | - <!-- 独立歌词 --> |
14 | | - <Transition name="fade" mode="out-in"> |
| 2 | + <Teleport to="body"> |
| 3 | + <Transition name="up" mode="out-in"> |
15 | 4 | <div |
16 | | - v-if="isShowComment && !statusStore.pureLyricMode" |
17 | | - :key="instantLyrics.content" |
18 | | - class="lrc-instant" |
| 5 | + v-if="statusStore.showFullPlayer" |
| 6 | + :style="{ |
| 7 | + '--main-color': statusStore.mainColor, |
| 8 | + cursor: statusStore.playerMetaShow || isShowComment ? 'auto' : 'none', |
| 9 | + }" |
| 10 | + :class="['full-player', { 'show-comment': isShowComment }]" |
| 11 | + @mouseleave="playerLeave" |
19 | 12 | > |
20 | | - <span class="lrc">{{ instantLyrics.content }}</span> |
21 | | - <span v-if="instantLyrics.tran" class="lrc-tran">{{ instantLyrics.tran }}</span> |
22 | | - </div> |
23 | | - </Transition> |
24 | | - <!-- 菜单 --> |
25 | | - <PlayerMenu @mouseenter.stop="stopHide" @mouseleave.stop="playerMove" /> |
26 | | - <!-- 主内容 --> |
27 | | - <Transition name="zoom" mode="out-in"> |
28 | | - <div |
29 | | - :key="playerContentKey" |
30 | | - :class="[ |
31 | | - 'player-content', |
32 | | - { |
33 | | - 'no-lrc': noLrc, |
34 | | - pure: statusStore.pureLyricMode && musicStore.isHasLrc, |
35 | | - }, |
36 | | - ]" |
37 | | - @mousemove="playerMove" |
38 | | - > |
39 | | - <Transition name="zoom"> |
40 | | - <div v-if="!pureLyricMode" :key="musicStore.playSong.id" class="content-left"> |
41 | | - <!-- 封面 --> |
42 | | - <PlayerCover /> |
43 | | - <!-- 数据 --> |
44 | | - <PlayerData :center="playerDataCenter" :theme="statusStore.mainColor" /> |
| 13 | + <!-- 背景 --> |
| 14 | + <PlayerBackground /> |
| 15 | + <!-- 独立歌词 --> |
| 16 | + <Transition name="fade" mode="out-in"> |
| 17 | + <div |
| 18 | + v-if="isShowComment && !statusStore.pureLyricMode" |
| 19 | + :key="instantLyrics.content" |
| 20 | + class="lrc-instant" |
| 21 | + > |
| 22 | + <span class="lrc">{{ instantLyrics.content }}</span> |
| 23 | + <span v-if="instantLyrics.tran" class="lrc-tran">{{ instantLyrics.tran }}</span> |
45 | 24 | </div> |
46 | 25 | </Transition> |
47 | | - <!-- 歌词 --> |
48 | | - <div class="content-right"> |
49 | | - <!-- 数据 --> |
50 | | - <PlayerData |
51 | | - v-if="statusStore.pureLyricMode && musicStore.isHasLrc" |
52 | | - :center="statusStore.pureLyricMode" |
53 | | - :theme="statusStore.mainColor" |
54 | | - :light="pureLyricMode" |
55 | | - /> |
56 | | - <!-- 歌词 --> |
57 | | - <MainAMLyric v-if="settingStore.useAMLyrics" /> |
58 | | - <MainLyric v-else /> |
59 | | - </div> |
| 26 | + <!-- 菜单 --> |
| 27 | + <PlayerMenu @mouseenter.stop="stopHide" @mouseleave.stop="playerMove" /> |
| 28 | + <!-- 主内容 --> |
| 29 | + <Transition name="zoom" mode="out-in"> |
| 30 | + <div |
| 31 | + :key="playerContentKey" |
| 32 | + :class="[ |
| 33 | + 'player-content', |
| 34 | + { |
| 35 | + 'no-lrc': noLrc, |
| 36 | + pure: statusStore.pureLyricMode && musicStore.isHasLrc, |
| 37 | + }, |
| 38 | + ]" |
| 39 | + @mousemove="playerMove" |
| 40 | + > |
| 41 | + <Transition name="zoom"> |
| 42 | + <div v-if="!pureLyricMode" :key="musicStore.playSong.id" class="content-left"> |
| 43 | + <!-- 封面 --> |
| 44 | + <PlayerCover /> |
| 45 | + <!-- 数据 --> |
| 46 | + <PlayerData :center="playerDataCenter" :theme="statusStore.mainColor" /> |
| 47 | + </div> |
| 48 | + </Transition> |
| 49 | + <!-- 歌词 --> |
| 50 | + <div class="content-right"> |
| 51 | + <!-- 数据 --> |
| 52 | + <PlayerData |
| 53 | + v-if="statusStore.pureLyricMode && musicStore.isHasLrc" |
| 54 | + :center="statusStore.pureLyricMode" |
| 55 | + :theme="statusStore.mainColor" |
| 56 | + :light="pureLyricMode" |
| 57 | + /> |
| 58 | + <!-- 歌词 --> |
| 59 | + <MainAMLyric v-if="settingStore.useAMLyrics" /> |
| 60 | + <MainLyric v-else /> |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + </Transition> |
| 64 | + <!-- 评论 --> |
| 65 | + <Transition name="zoom" mode="out-in"> |
| 66 | + <PlayerComment v-show="isShowComment && !statusStore.pureLyricMode" /> |
| 67 | + </Transition> |
| 68 | + <!-- 控制中心 --> |
| 69 | + <PlayerControl @mouseenter.stop="stopHide" @mouseleave.stop="playerMove" /> |
| 70 | + <!-- 音乐频谱 --> |
| 71 | + <PlayerSpectrum |
| 72 | + v-if="settingStore.showSpectrums" |
| 73 | + :color="statusStore.mainColor ? `rgb(${statusStore.mainColor})` : 'rgb(239 239 239)'" |
| 74 | + :show="!statusStore.playerMetaShow" |
| 75 | + :height="60" |
| 76 | + /> |
60 | 77 | </div> |
61 | 78 | </Transition> |
62 | | - <!-- 评论 --> |
63 | | - <Transition name="zoom" mode="out-in"> |
64 | | - <PlayerComment v-show="isShowComment && !statusStore.pureLyricMode" /> |
65 | | - </Transition> |
66 | | - <!-- 控制中心 --> |
67 | | - <PlayerControl @mouseenter.stop="stopHide" @mouseleave.stop="playerMove" /> |
68 | | - <!-- 音乐频谱 --> |
69 | | - <PlayerSpectrum |
70 | | - v-if="settingStore.showSpectrums" |
71 | | - :color="statusStore.mainColor ? `rgb(${statusStore.mainColor})` : 'rgb(239 239 239)'" |
72 | | - :show="!statusStore.playerMetaShow" |
73 | | - :height="60" |
74 | | - /> |
75 | | - </div> |
| 79 | + </Teleport> |
76 | 80 | </template> |
77 | 81 |
|
78 | 82 | <script setup lang="ts"> |
79 | 83 | import { useStatusStore, useMusicStore, useSettingStore } from "@/stores"; |
80 | 84 | import { isElectron } from "@/utils/env"; |
81 | 85 | import { throttle } from "lodash-es"; |
82 | | -import { usePlayer } from "@/utils/player"; |
83 | 86 |
|
84 | | -const player = usePlayer(); |
85 | 87 | const musicStore = useMusicStore(); |
86 | 88 | const statusStore = useStatusStore(); |
87 | 89 | const settingStore = useSettingStore(); |
@@ -159,10 +161,6 @@ const playerLeave = () => { |
159 | 161 | }; |
160 | 162 |
|
161 | 163 | onMounted(() => { |
162 | | - console.log("播放器开启"); |
163 | | - statusStore.fullPlayerActive = true; |
164 | | - // 音乐频谱 |
165 | | - if (settingStore.showSpectrums) player.initSpectrumData(); |
166 | 164 | // 阻止息屏 |
167 | 165 | if (isElectron && settingStore.preventSleep) { |
168 | 166 | window.electron.ipcRenderer.send("prevent-sleep", true); |
|
0 commit comments