Skip to content

Commit 8d381d0

Browse files
committed
Merge branch 'dev' into dev-dl
2 parents 98c2001 + e11c52b commit 8d381d0

File tree

19 files changed

+934
-1093
lines changed

19 files changed

+934
-1093
lines changed

electron/main/ipc/ipc-window.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,15 @@ const initWindowsIpc = (): void => {
8282
mainWin?.focus();
8383
});
8484

85-
// 重启
85+
// 重载
8686
ipcMain.on("win-reload", () => {
87+
const mainWin = mainWindow.getWin();
88+
if (!mainWin) return;
89+
mainWin.reload();
90+
});
91+
92+
// 重启
93+
ipcMain.on("win-restart", () => {
8794
app.quit();
8895
app.relaunch();
8996
});

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"font-list": "^2.0.1",
6262
"get-port": "^7.1.0",
6363
"github-markdown-css": "^5.8.1",
64-
"howler": "^2.2.4",
6564
"js-cookie": "^3.0.5",
6665
"jss": "^10.10.0",
6766
"jss-preset-default": "^10.10.0",
@@ -73,8 +72,7 @@
7372
"pinia": "^3.0.4",
7473
"pinia-plugin-persistedstate": "^4.7.1",
7574
"plyr": "^3.8.3",
76-
"sortablejs": "^1.15.6",
77-
"vue-virt-list": "^1.6.1"
75+
"sortablejs": "^1.15.6"
7876
},
7977
"devDependencies": {
8078
"@electron-toolkit/preload": "^3.0.1",
@@ -85,7 +83,6 @@
8583
"@fastify/multipart": "^9.3.0",
8684
"@fastify/static": "^8.3.0",
8785
"@types/file-saver": "^2.0.7",
88-
"@types/howler": "^2.2.12",
8986
"@types/js-cookie": "^3.0.6",
9087
"@types/md5": "^2.3.6",
9188
"@types/node": "^24.10.1",

pnpm-lock.yaml

Lines changed: 0 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Layout/Nav.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const setOptions = computed<DropdownOption[]>(() => [
163163
key: "restart",
164164
label: "软件热重载",
165165
show: isElectron,
166-
props: { onClick: () => window.location.reload() },
166+
props: { onClick: () => window.electron.ipcRenderer.send("win-reload") },
167167
icon: renderIcon("Restart"),
168168
},
169169
{

src/components/Modal/DownloadSong.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,11 @@ const download = async () => {
138138
if (!songData.value) return;
139139
loading.value = true;
140140
if (settingStore.downloadPath) downloadPath.value = settingStore.downloadPath;
141-
141+
142142
try {
143143
const result = await downloadSong({
144144
song: songData.value,
145145
quality: songLevelChoosed.value,
146-
settingStore,
147146
downloadPath: downloadPath.value,
148147
});
149148

src/components/Player/MainPlayer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
strong
127127
secondary
128128
circle
129-
v-debounce="() => player.playOrPause()"
129+
@click.stop="player.playOrPause()"
130130
>
131131
<template #icon>
132132
<Transition name="fade" mode="out-in">

src/components/Player/PlayerSpectrum.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const isKeepDrawing = ref<boolean>(true);
2525
*/
2626
const drawSpectrum = () => {
2727
const spectrumData = player.getSpectrumData();
28+
2829
if (!spectrumData) return;
2930
// 转换为普通数组并处理
3031
const data = Array.from(spectrumData).slice(10);
@@ -98,12 +99,15 @@ const roundRect = (
9899
};
99100
100101
// 开始绘制频谱
101-
const { pause: pauseDraw, resume: resumeDraw } = useRafFn(() => {
102-
drawSpectrum();
103-
}, { immediate: false });
102+
const { pause: pauseDraw, resume: resumeDraw } = useRafFn(
103+
() => {
104+
drawSpectrum();
105+
},
106+
{ immediate: false },
107+
);
104108
105109
onMounted(() => {
106-
isKeepDrawing.value = false;
110+
isKeepDrawing.value = true;
107111
resumeDraw();
108112
});
109113

src/components/Setting/GeneralSetting.vue

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,14 @@
107107
<n-text class="name">侧边栏隐藏</n-text>
108108
<n-text class="tip" :depth="3">配置需要在侧边栏隐藏的菜单项</n-text>
109109
</div>
110-
<n-button
111-
type="primary"
112-
strong
113-
secondary
114-
@click="openSidebarHideManager"
115-
>
116-
配置
117-
</n-button>
110+
<n-button type="primary" strong secondary @click="openSidebarHideManager"> 配置 </n-button>
118111
</n-card>
119112
<n-card class="set-item">
120113
<div class="label">
121114
<n-text class="name">首页栏目配置</n-text>
122115
<n-text class="tip" :depth="3">调整首页各栏目的显示顺序或隐藏不需要的栏目</n-text>
123116
</div>
124-
<n-button
125-
type="primary"
126-
strong
127-
secondary
128-
@click="openHomePageSectionManager"
129-
>
117+
<n-button type="primary" strong secondary @click="openHomePageSectionManager">
130118
配置
131119
</n-button>
132120
</n-card>
@@ -342,7 +330,7 @@
342330
import type { SelectOption } from "naive-ui";
343331
import { useDataStore, useMusicStore, useSettingStore, useStatusStore } from "@/stores";
344332
import { isDev, isElectron } from "@/utils/env";
345-
import { getCoverColor } from "@/utils/player-utils/song";
333+
import songManager from "@/utils/songManager";
346334
import { isEmpty } from "lodash-es";
347335
import themeColor from "@/assets/data/themeColor.json";
348336
import { openSidebarHideManager, openHomePageSectionManager } from "@/utils/modal";
@@ -438,7 +426,7 @@ const modeChange = (val: boolean) => {
438426
localStorage.removeItem("data-store");
439427
localStorage.removeItem("music-store");
440428
// 重启
441-
if (!isDev) window.electron.ipcRenderer.send("win-reload");
429+
if (!isDev) window.electron.ipcRenderer.send("win-restart");
442430
},
443431
onNegativeClick: () => {
444432
useOnlineService.value = true;
@@ -450,7 +438,7 @@ const modeChange = (val: boolean) => {
450438
451439
// 全局着色更改
452440
const themeGlobalColorChange = (val: boolean) => {
453-
if (val) getCoverColor(musicStore.songCover);
441+
if (val) songManager.getCoverColor(musicStore.songCover);
454442
};
455443
456444
onMounted(() => {

src/components/Setting/PlaySetting.vue

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
<div class="label">
229229
<n-text class="name">音乐频谱</n-text>
230230
<n-text class="tip" :depth="3">
231-
开启音乐频谱会影响性能或音频输出切换等功能,如遇问题请关闭
231+
开启音乐频谱会影响性能或增加内存占用,如遇问题请关闭
232232
</n-text>
233233
</div>
234234
<n-switch
@@ -342,51 +342,53 @@ const getOutputDevices = async () => {
342342
343343
// 切换输出设备
344344
const playDeviceChange = (deviceId: string, option: SelectOption) => {
345-
if (settingStore.showSpectrums) {
346-
window.$dialog.warning({
347-
title: "音频通道占用",
348-
content:
349-
"由于系统限制,切换音频输出设备会导致音乐频谱失效,将会关闭音乐频谱,并将于热重载后生效( 请点击右上角的设置菜单中的热重载按钮 ),是否继续?",
350-
positiveText: "继续",
351-
negativeText: "取消",
352-
closeOnEsc: false,
353-
closable: false,
354-
maskClosable: false,
355-
autoFocus: false,
356-
onPositiveClick: () => {
357-
showSpectrums.value = false;
358-
settingStore.showSpectrums = false;
359-
player.toggleOutputDevice(deviceId);
360-
window.$message.success(`已切换输出设备为 ${option.label}`);
361-
},
362-
onNegativeClick: () => {
363-
settingStore.playDevice = "default";
364-
},
365-
});
366-
} else {
367-
player.toggleOutputDevice(deviceId);
368-
window.$message.success(`已切换输出设备为 ${option.label}`);
369-
}
345+
// if (settingStore.showSpectrums) {
346+
// window.$dialog.warning({
347+
// title: "音频通道占用",
348+
// content:
349+
// "由于系统限制,切换音频输出设备会导致音乐频谱失效,将会关闭音乐频谱,并将于热重载后生效( 请点击右上角的设置菜单中的热重载按钮 ),是否继续?",
350+
// positiveText: "继续",
351+
// negativeText: "取消",
352+
// closeOnEsc: false,
353+
// closable: false,
354+
// maskClosable: false,
355+
// autoFocus: false,
356+
// onPositiveClick: () => {
357+
// showSpectrums.value = false;
358+
// settingStore.showSpectrums = false;
359+
// player.toggleOutputDevice(deviceId);
360+
// window.$message.success(`已切换输出设备为 ${option.label}`);
361+
// },
362+
// onNegativeClick: () => {
363+
// settingStore.playDevice = "default";
364+
// },
365+
// });
366+
// } else {
367+
// player.toggleOutputDevice(deviceId);
368+
// window.$message.success(`已切换输出设备为 ${option.label}`);
369+
// }
370+
player.toggleOutputDevice(deviceId);
371+
window.$message.success(`已切换输出设备为 ${option.label}`);
370372
};
371373
372374
// 显示音乐频谱更改
373375
const showSpectrumsChange = (value: boolean) => {
374376
if (value) {
375-
if (settingStore.playDevice !== "default") {
376-
window.$dialog.warning({
377-
title: "音频通道占用",
378-
content: "开启音乐频谱会导致自定义音频输出设备失效,将会恢复默认输出设备,是否继续开启?",
379-
positiveText: "开启",
380-
negativeText: "取消",
381-
onPositiveClick: () => {
382-
showSpectrums.value = true;
383-
settingStore.showSpectrums = true;
384-
settingStore.playDevice = "default";
385-
player.toggleOutputDevice("default");
386-
},
387-
});
388-
return;
389-
}
377+
// if (settingStore.playDevice !== "default") {
378+
// window.$dialog.warning({
379+
// title: "音频通道占用",
380+
// content: "开启音乐频谱会导致自定义音频输出设备失效,将会恢复默认输出设备,是否继续开启?",
381+
// positiveText: "开启",
382+
// negativeText: "取消",
383+
// onPositiveClick: () => {
384+
// showSpectrums.value = true;
385+
// settingStore.showSpectrums = true;
386+
// settingStore.playDevice = "default";
387+
// player.toggleOutputDevice("default");
388+
// },
389+
// });
390+
// return;
391+
// }
390392
showSpectrums.value = true;
391393
settingStore.showSpectrums = true;
392394
} else {

0 commit comments

Comments
 (0)