Skip to content

Commit f0270a2

Browse files
committed
✨ feat: 添加交流群
1 parent 3ebfccd commit f0270a2

7 files changed

Lines changed: 61 additions & 35 deletions

File tree

src/assets/icons/QQ.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/Layout/Nav.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@
9191
<script setup lang="ts">
9292
import type { DropdownOption } from "naive-ui";
9393
import { useSettingStore } from "@/stores";
94-
import { renderIcon } from "@/utils/helper";
94+
import { openLink, renderIcon } from "@/utils/helper";
9595
import { openSetting } from "@/utils/modal";
9696
import { isDev, isElectron } from "@/utils/env";
97+
import packageJson from "@/../package.json";
9798
9899
const router = useRouter();
99100
const settingStore = useSettingStore();
@@ -155,7 +156,30 @@ const setOptions = computed<DropdownOption[]>(() => [
155156
),
156157
},
157158
{
158-
key: "header-divider",
159+
key: "divider-1",
160+
type: "divider",
161+
},
162+
{
163+
// 交流群
164+
key: "qq",
165+
label: "加入交流群",
166+
props: {
167+
onClick: () =>
168+
openLink(
169+
"https://qm.qq.com/cgi-bin/qm/qr?k=2-cVSf1bE0AvAehCib00qFEFdUvPaJ_k&jump_from=webapi&authKey=1NEhib9+GsmsXVo2rCc0IbRaVHeeRXJJ0gbsyKDcIwDdAzYySOubkFCvkV32+7Cw",
170+
),
171+
},
172+
icon: renderIcon("QQ"),
173+
},
174+
{
175+
// 交流群
176+
key: "github",
177+
label: "开源仓库",
178+
props: { onClick: () => openLink(packageJson.github) },
179+
icon: renderIcon("Github"),
180+
},
181+
{
182+
key: "divider-2",
159183
type: "divider",
160184
},
161185
{

src/components/Player/MainPlayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ const isShowLyrics = computed(() => {
262262
const isHasLrc = musicStore.isHasLrc;
263263
return (
264264
isHasLrc &&
265+
!statusStore.lyricLoading &&
265266
settingStore.barLyricShow &&
266267
musicStore.playSong.type !== "radio" &&
267268
statusStore.playStatus &&

src/stores/music.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const useMusicStore = defineStore("music", {
106106
"play-lyric-change",
107107
cloneDeep({
108108
songId: this.playSong?.id,
109+
lyricLoading: false,
109110
lrcData: this.songLyric.lrcData ?? [],
110111
yrcData: this.songLyric.yrcData ?? [],
111112
}),

src/types/desktop-lyric.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface LyricData {
88
playStatus?: boolean;
99
/** 当前播放进度 */
1010
currentTime?: number;
11+
/** 是否正在加载歌词 */
12+
lyricLoading?: boolean;
1113
/** 当前播放歌曲 id(用于偏移校准) */
1214
songId?: number;
1315
/** 当前歌曲的时间偏移(秒,正负均可) */

src/utils/lyricManager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ class LyricManager {
299299
try {
300300
// 歌词加载状态
301301
statusStore.lyricLoading = true;
302+
// 通知桌面歌词
303+
if (isElectron) {
304+
window.electron.ipcRenderer.send("update-desktop-lyric-data", {
305+
lyricLoading: true,
306+
});
307+
}
302308
// 检查歌词覆盖
303309
let lyricData = await this.checkLocalLyricOverride(id);
304310
// 开始获取歌词

src/views/DesktopLyric/index.vue

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ const lyricData = reactive<LyricData>({
135135
playName: "未知歌曲",
136136
playStatus: false,
137137
currentTime: 0,
138+
lyricLoading: false,
138139
songId: 0,
139140
songOffset: 0,
140141
lrcData: [],
@@ -212,43 +213,33 @@ const getSafeEndTime = (lyrics: LyricLine[], idx: number) => {
212213
*/
213214
const renderLyricLines = computed<RenderLine[]>(() => {
214215
const lyrics = lyricData?.yrcData?.length ? lyricData.yrcData : lyricData.lrcData;
215-
if (!lyrics?.length) {
216-
return [
217-
{
218-
line: {
219-
startTime: 0,
220-
endTime: 0,
221-
words: [{ word: "纯音乐,请欣赏", startTime: 0, endTime: 0, romanWord: "" }],
222-
translatedLyric: "",
223-
romanLyric: "",
224-
isBG: false,
225-
isDuet: false,
226-
},
227-
index: -1,
228-
key: "placeholder",
229-
active: true,
216+
// 提示词占位
217+
const placeholder = (word: string): RenderLine[] => [
218+
{
219+
line: {
220+
startTime: 0,
221+
endTime: 0,
222+
words: [{ word, startTime: 0, endTime: 0, romanWord: "" }],
223+
translatedLyric: "",
224+
romanLyric: "",
225+
isBG: false,
226+
isDuet: false,
230227
},
231-
];
232-
}
228+
index: -1,
229+
key: "placeholder",
230+
active: true,
231+
},
232+
];
233+
// 加载中
234+
if (lyricData.lyricLoading) return placeholder("歌词加载中...");
235+
// 纯音乐
236+
if (!lyrics?.length) return placeholder("纯音乐,请欣赏");
237+
// 获取当前歌词索引
233238
const idx = lyricData?.lyricIndex ?? -1;
239+
// 索引小于 0,显示歌曲名称
234240
if (idx < 0) {
235241
const text = lyricData.playName ?? "未知歌曲";
236-
return [
237-
{
238-
line: {
239-
startTime: 0,
240-
endTime: 0,
241-
words: [{ word: text, startTime: 0, endTime: 0, romanWord: "" }],
242-
translatedLyric: "",
243-
romanLyric: "",
244-
isBG: false,
245-
isDuet: false,
246-
},
247-
index: -1,
248-
key: "placeholder",
249-
active: true,
250-
},
251-
];
242+
return placeholder(text);
252243
}
253244
const current = lyrics[idx];
254245
const next = lyrics[idx + 1];

0 commit comments

Comments
 (0)