Skip to content

Commit eb1d809

Browse files
authored
Merge pull request #983 from MoYingJi/pr/hc
feat(FullPlayer): 评论页半屏显示
2 parents ecc047b + 139e45b commit eb1d809

3 files changed

Lines changed: 44 additions & 15 deletions

File tree

src/components/Modal/Setting/FullscreenPlayerManager.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ const items = computed<Item[]>(() => [
4848
key: "commentCount",
4949
disabled: !settingStore.fullscreenPlayerElements.comments,
5050
},
51+
{
52+
label: "评论页半屏显示(左侧)",
53+
key: "commentHalfScreen",
54+
disabled: !settingStore.fullscreenPlayerElements.comments,
55+
},
5156
]);
5257
5358
const updateSetting = (key: FullscreenPlayerElementKey, val: boolean) => {

src/components/Player/FullPlayer.vue

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<div
55
v-if="statusStore.showFullPlayer"
66
:style="{
7-
cursor: statusStore.playerMetaShow || isShowComment ? 'auto' : 'none',
7+
cursor: statusStore.playerMetaShow || showComment ? 'auto' : 'none',
88
'--lyric-blend-mode': settingStore.lyricsBlendMode,
99
}"
10-
:class="['full-player', { 'show-comment': isShowComment && !statusStore.pureLyricMode }]"
10+
:class="['full-player', { 'fullscreen-comment': showFullScreenComment }]"
1111
@mouseleave="playerLeave"
1212
@mousemove="playerMove"
1313
@click="playerMove"
@@ -20,11 +20,7 @@
2020
<template v-else>
2121
<!-- 独立歌词 -->
2222
<Transition name="fade" mode="out-in">
23-
<div
24-
v-if="isShowComment && !statusStore.pureLyricMode"
25-
:key="instantLyrics.content"
26-
class="lrc-instant"
27-
>
23+
<div v-if="showFullScreenComment" :key="instantLyrics.content" class="lrc-instant">
2824
<span class="lrc">{{ instantLyrics.content }}</span>
2925
<span v-if="instantLyrics.tran" class="lrc-tran">{{ instantLyrics.tran }}</span>
3026
</div>
@@ -47,9 +43,14 @@
4743
]"
4844
@mousemove="playerMove"
4945
>
46+
<!-- 左侧的封面和数据 -->
5047
<Transition name="zoom">
5148
<div
52-
v-if="!pureLyricMode && settingStore.playerType !== 'fullscreen'"
49+
v-if="
50+
!showHalfScreenComment &&
51+
!pureLyricMode &&
52+
settingStore.playerType !== 'fullscreen'
53+
"
5354
:key="musicStore.playSong.id"
5455
class="content-left"
5556
:style="layoutStyles.left"
@@ -60,6 +61,14 @@
6061
<PlayerData :center="playerDataCenter" />
6162
</div>
6263
</Transition>
64+
<!-- 左侧的半屏评论 -->
65+
<Transition name="zoom" mode="out-in">
66+
<PlayerComment
67+
v-if="showHalfScreenComment"
68+
class="content-left"
69+
:style="layoutStyles.left"
70+
/>
71+
</Transition>
6372
<!-- 歌词 -->
6473
<div class="content-right" :style="layoutStyles.right">
6574
<!-- 数据 -->
@@ -78,7 +87,7 @@
7887
</Transition>
7988
<!-- 评论 -->
8089
<Transition name="zoom" mode="out-in">
81-
<PlayerComment v-show="isShowComment && !statusStore.pureLyricMode" />
90+
<PlayerComment v-if="showFullScreenComment" />
8291
</Transition>
8392
<!-- 控制中心 -->
8493
<PlayerControl @mouseenter.stop="stopHide" @mouseleave.stop="playerMove" />
@@ -109,10 +118,23 @@ const { isTablet } = useMobile();
109118
/** 封面主颜色 */
110119
const mainCoverColor = useCssVar("--main-cover-color", document.documentElement);
111120
112-
// 是否显示评论
113-
const isShowComment = computed<boolean>(
114-
() => !musicStore.playSong.path && statusStore.showPlayerComment && !isTablet.value,
121+
/** 是否显示评论 */
122+
const showComment = computed<boolean>(
123+
() =>
124+
statusStore.showPlayerComment &&
125+
!musicStore.playSong.path &&
126+
!statusStore.pureLyricMode &&
127+
!isTablet.value,
128+
);
129+
/** 评论是否半屏显示 */
130+
const commentHalfScreen = computed<boolean>(
131+
() => settingStore.fullscreenPlayerElements.commentHalfScreen && !noLrc.value,
132+
);
133+
/** 显示全屏评论 */
134+
const showFullScreenComment = computed<boolean>(
135+
() => showComment.value && !commentHalfScreen.value,
115136
);
137+
const showHalfScreenComment = computed<boolean>(() => showComment.value && commentHalfScreen.value);
116138
117139
/** 没有歌词 */
118140
const noLrc = computed<boolean>(() => {
@@ -124,9 +146,9 @@ const noLrc = computed<boolean>(() => {
124146
/** 是否处于纯净模式 */
125147
const pureLyricMode = computed<boolean>(() => statusStore.pureLyricMode && musicStore.isHasLrc);
126148
127-
/* 是否显示全屏封面 */
149+
/** 是否显示全屏封面 */
128150
const showFullScreenCover = computed<boolean>(
129-
() => settingStore.playerType === "fullscreen" && !pureLyricMode.value && !isShowComment.value,
151+
() => settingStore.playerType === "fullscreen" && !pureLyricMode.value && !showComment.value,
130152
);
131153
132154
// 主内容 key
@@ -332,7 +354,7 @@ onBeforeUnmount(() => {
332354
}
333355
}
334356
}
335-
&.show-comment {
357+
&.fullscreen-comment {
336358
.player-content {
337359
&:not(.pure) {
338360
transform: scale(0.95);

src/stores/setting.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ export interface SettingState {
381381
lyricOffset: boolean;
382382
lyricSettings: boolean;
383383
commentCount: boolean;
384+
commentHalfScreen: boolean;
384385
};
385386
/** 右键菜单显示配置 */
386387
contextMenuOptions: {
@@ -673,6 +674,7 @@ export const useSettingStore = defineStore("setting", {
673674
lyricOffset: true,
674675
lyricSettings: true,
675676
commentCount: false,
677+
commentHalfScreen: false,
676678
},
677679
contextMenuOptions: {
678680
play: true,

0 commit comments

Comments
 (0)