Skip to content

Commit 9eb2fbe

Browse files
✨ feat: 支持刷新私人漫游 (#762)
* ✨ feat: 支持刷新私人漫游 * 🐞 fix: 修复 #758 * 🐞 fix: 修复 #734 * 🐞 fix: 修复代码审查 * ✨ feat: 支持个性化歌词边距 * ✨ feat: 支持左右对唱互换 * ✨ feat: 支持音译翻译调换 * ✨ feat: 不喜欢括号与别名 * ✨ feat: 显示主页问好 * ✨ feat: 自定义css js * 🐞 fix: 兼容网页端 * Revert "🐞 fix: 兼容网页端" This reverts commit a721693. * Revert "✨ feat: 自定义css js" This reverts commit f8d4482. * 🐞 fix: 修复被错误移除的空格 * 🐞 fix: 修复部分写法问题 --------- Co-authored-by: imsyy <one@imsyy.top>
1 parent eec7ea2 commit 9eb2fbe

18 files changed

Lines changed: 294 additions & 66 deletions

File tree

src/components/Card/SongCard.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
}"
4040
class="name-text"
4141
>
42-
{{ song?.name || "未知曲目" }}
43-
<n-text v-if="song.alia?.length" class="alia" depth="3"> ({{ song.alia }}) </n-text>
42+
{{ settingStore.hideLyricBrackets ? removeBrackets(song?.name) : (song?.name || "未知曲目") }}
43+
<n-text v-if="song.alia?.length && !settingStore.hideLyricBrackets" class="alia" depth="3"> ({{ song.alia }}) </n-text>
4444
</n-ellipsis>
4545
</div>
4646
<n-flex :size="4" :wrap="false" class="desc" align="center">
@@ -90,7 +90,7 @@
9090
MV
9191
</n-tag>
9292
<!-- 歌手 -->
93-
<div v-if="Array.isArray(song.artists)" class="artists text-hidden">
93+
<div v-if="Array.isArray(song.artists)" class="artists">
9494
<n-text
9595
v-for="ar in song.artists"
9696
:key="ar.id"
@@ -103,7 +103,7 @@
103103
<div v-else-if="song.type === 'radio'" class="artists">
104104
<n-text class="ar"> 电台节目 </n-text>
105105
</div>
106-
<div v-else class="artists text-hidden" @click="openJumpArtist(song.artists)">
106+
<div v-else class="artists" @click="openJumpArtist(song.artists)">
107107
<n-text class="ar"> {{ song.artists || "未知艺术家" }} </n-text>
108108
</div>
109109
</n-flex>
@@ -163,6 +163,7 @@ import { QualityType, type SongType } from "@/types/main";
163163
import { useStatusStore, useMusicStore, useDataStore, useSettingStore } from "@/stores";
164164
import { formatNumber } from "@/utils/helper";
165165
import { openJumpArtist } from "@/utils/modal";
166+
import { removeBrackets } from "@/utils/format";
166167
import { toLikeSong } from "@/utils/auth";
167168
import { isObject } from "lodash-es";
168169
import { formatTimestamp, msToTime } from "@/utils/time";
@@ -320,6 +321,7 @@ const localCover = async (show: boolean) => {
320321
}
321322
.title {
322323
flex: 1;
324+
min-width: 0;
323325
display: flex;
324326
align-items: center;
325327
padding: 4px 20px 4px 0;
@@ -335,6 +337,7 @@ const localCover = async (show: boolean) => {
335337
overflow: hidden;
336338
}
337339
.info {
340+
min-width: 0;
338341
.name {
339342
display: flex;
340343
flex-direction: row;
@@ -343,6 +346,7 @@ const localCover = async (show: boolean) => {
343346
font-size: 16px;
344347
}
345348
.desc {
349+
min-width: 0;
346350
margin-top: 2px;
347351
font-size: 13px;
348352
.n-tag {
@@ -375,8 +379,13 @@ const localCover = async (show: boolean) => {
375379
}
376380
}
377381
.artists {
382+
flex: 1;
383+
min-width: 0;
384+
overflow: hidden;
385+
text-overflow: ellipsis;
386+
white-space: nowrap;
378387
.ar {
379-
display: inline-flex;
388+
display: inline;
380389
transition: opacity 0.3s;
381390
opacity: 0.6;
382391
cursor: pointer;
@@ -407,6 +416,7 @@ const localCover = async (show: boolean) => {
407416
}
408417
.album {
409418
flex: 1;
419+
min-width: 0;
410420
line-clamp: 2;
411421
-webkit-line-clamp: 2;
412422
padding-right: 20px;

src/components/Layout/Menu.vue

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<script setup lang="ts">
2020
import { useMobile } from "@/composables/useMobile";
2121
import { usePlayerController } from "@/core/player/PlayerController";
22+
import { useSongManager } from "@/core/player/SongManager";
2223
import {
2324
useDataStore,
2425
useLocalStore,
@@ -54,6 +55,7 @@ const musicStore = useMusicStore();
5455
const statusStore = useStatusStore();
5556
const settingStore = useSettingStore();
5657
const player = usePlayerController();
58+
const songManager = useSongManager();
5759
5860
const { isDesktop } = useMobile();
5961
@@ -62,6 +64,16 @@ const menuRef = ref<MenuInst | null>(null);
6264
const menuActiveKey = ref<string | number>((router.currentRoute.value.name as string) || "home");
6365
const playlistMode = ref<"online" | "local">("online");
6466
67+
// 刷新私人漫游
68+
const handleRefreshFM = async (e: Event) => {
69+
e.stopPropagation();
70+
await songManager.refreshPersonalFM();
71+
// 刷新后如果处于私人漫游模式,则重新播放
72+
if (statusStore.personalFmMode && musicStore.personalFMSong?.id) {
73+
player.playSong();
74+
}
75+
};
76+
6577
// 菜单内容
6678
const menuOptions = computed<MenuOption[] | MenuGroupOption[]>(() => {
6779
return settingStore.useOnlineService
@@ -89,7 +101,18 @@ const menuOptions = computed<MenuOption[] | MenuGroupOption[]>(() => {
89101
},
90102
{
91103
key: "personal-fm",
92-
label: "私人漫游",
104+
label: () =>
105+
h("div", { class: "user-liked roaming-label" }, [
106+
h(NText, null, () => "私人漫游"),
107+
h(NButton, {
108+
type: "tertiary",
109+
round: true,
110+
strong: true,
111+
secondary: true,
112+
renderIcon: renderIcon("Refresh"),
113+
onClick: handleRefreshFM,
114+
}),
115+
]),
93116
show: isLogin() !== 0 && !settingStore.sidebarHide.hidePersonalFM,
94117
icon: renderIcon("Radio", {
95118
style: {
@@ -575,4 +598,17 @@ watch(
575598
border-radius: 8px;
576599
}
577600
}
601+
.roaming-label {
602+
.n-button {
603+
opacity: 0;
604+
pointer-events: none;
605+
transition: opacity 0.3s;
606+
}
607+
&:hover {
608+
.n-button {
609+
opacity: 1;
610+
pointer-events: auto;
611+
}
612+
}
613+
}
578614
</style>

src/components/Modal/Setting/HomePageSectionManager.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
<template>
22
<div class="home-page-section-manager">
3+
<n-card
4+
:content-style="{
5+
display: 'flex',
6+
alignItems: 'center',
7+
gap: '12px',
8+
padding: '16px',
9+
}"
10+
class="greeting-item"
11+
>
12+
<n-text class="name">显示主页问好</n-text>
13+
<n-switch v-model:value="settingStore.showHomeGreeting" :round="false" />
14+
</n-card>
315
<div ref="sortableRef" class="sortable-list">
416
<n-card
517
v-for="item in settingStore.homePageSections"
@@ -50,6 +62,17 @@ onMounted(() => {
5062
</script>
5163

5264
<style scoped lang="scss">
65+
.greeting-item {
66+
border-radius: 8px;
67+
margin-bottom: 12px;
68+
.name {
69+
font-size: 16px;
70+
line-height: normal;
71+
}
72+
.n-switch {
73+
margin-left: auto;
74+
}
75+
}
5376
.sortable-list {
5477
margin-top: 12px;
5578
display: flex;

src/components/Modal/Setting/SidebarHideManager.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ const settingStore = useSettingStore();
3434
const statusStore = useStatusStore();
3535
3636
type SidebarHideKey = keyof typeof settingStore.sidebarHide;
37-
type SidebarHideItem = { label: string, key: SidebarHideKey };
37+
type SidebarHideItem = { label: string; key: SidebarHideKey };
3838
39-
const when = (
40-
condition: boolean, ...item: SidebarHideItem[]
41-
): SidebarHideItem[] => {
39+
const when = (condition: boolean, ...item: SidebarHideItem[]): SidebarHideItem[] => {
4240
return condition ? item : [];
43-
}
41+
};
4442
4543
const sidebarItems: SidebarHideItem[] = [
4644
{ label: "发现音乐", key: "hideDiscover" },
@@ -63,8 +61,6 @@ const updateSetting = (key: SidebarHideKey, val: boolean) => {
6361

6462
<style scoped lang="scss">
6563
.list {
66-
margin-top: 12px;
67-
padding-right: 12px;
6864
display: flex;
6965
flex-direction: column;
7066
gap: 12px;

src/components/Player/FullPlayerMobile.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<div class="lyric-header">
128128
<s-image :src="musicStore.getSongCover('s')" class="lyric-cover" />
129129
<div class="lyric-info">
130-
<div class="name text-hidden">{{ musicStore.playSong.name }}</div>
130+
<div class="name text-hidden">{{ settingStore.hideLyricBrackets ? removeBrackets(musicStore.playSong.name) : musicStore.playSong.name }}</div>
131131
<div class="artist text-hidden">{{ artistName }}</div>
132132
</div>
133133
<!-- 喜欢按钮 -->
@@ -165,14 +165,16 @@
165165

166166
<script setup lang="ts">
167167
import { useSwipe } from "@vueuse/core";
168-
import { useMusicStore, useStatusStore, useDataStore } from "@/stores";
168+
import { useMusicStore, useStatusStore, useDataStore, useSettingStore } from "@/stores";
169169
import { usePlayerController } from "@/core/player/PlayerController";
170170
import { useTimeFormat } from "@/composables/useTimeFormat";
171171
import { toLikeSong } from "@/utils/auth";
172172
import { openPlaylistAdd } from "@/utils/modal";
173+
import { removeBrackets } from "@/utils/format";
173174
174175
const musicStore = useMusicStore();
175176
const statusStore = useStatusStore();
177+
const settingStore = useSettingStore();
176178
const dataStore = useDataStore();
177179
const player = usePlayerController();
178180
const { timeDisplay, toggleTimeFormat } = useTimeFormat();

src/components/Player/MainPlayer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<!-- 名称 -->
4545
<TextContainer
4646
:key="musicStore.playSong.name"
47-
:text="musicStore.playSong.name"
47+
:text="settingStore.hideLyricBrackets ? removeBrackets(musicStore.playSong.name) : musicStore.playSong.name"
4848
:speed="0.2"
4949
class="name"
5050
/>
@@ -224,6 +224,7 @@ import {
224224
openPlaylistAdd,
225225
} from "@/utils/modal";
226226
import { convertSecondsToTime } from "@/utils/time";
227+
import { removeBrackets } from "@/utils/format";
227228
import type { DropdownOption } from "naive-ui";
228229
229230
const router = useRouter();

src/components/Player/PlayerComponents/PlayerComment.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</template>
1717
</n-image>
1818
<n-flex :size="2" class="song-info" vertical>
19-
<span class="title text-hidden">{{ musicStore.playSong.name }}</span>
19+
<span class="title text-hidden">{{ settingStore.hideLyricBrackets ? removeBrackets(musicStore.playSong.name) : musicStore.playSong.name }}</span>
2020
<span class="artist text-hidden">
2121
{{
2222
Array.isArray(musicStore.playSong.artists)
@@ -70,15 +70,16 @@
7070

7171
<script setup lang="ts">
7272
import type { CommentType } from "@/types/main";
73-
import { useMusicStore, useStatusStore } from "@/stores";
73+
import { useMusicStore, useStatusStore, useSettingStore } from "@/stores";
7474
import { getComment, getHotComment } from "@/api/comment";
7575
import { isEmpty } from "lodash-es";
76-
import { formatCommentList } from "@/utils/format";
76+
import { formatCommentList, removeBrackets } from "@/utils/format";
7777
import { NScrollbar } from "naive-ui";
7878
import { coverLoaded } from "@/utils/helper";
7979
8080
const musicStore = useMusicStore();
8181
const statusStore = useStatusStore();
82+
const settingStore = useSettingStore();
8283
8384
const commentScroll = ref<InstanceType<typeof NScrollbar> | null>(null);
8485

0 commit comments

Comments
 (0)