Compare commits

..

6 Commits

Author SHA1 Message Date
alger
7efeb9492b 🐞 fix: 修复类型错误 2025-01-16 00:58:57 +08:00
alger
055536eb5c 🌈 style: v3.7.1 2025-01-16 00:46:33 +08:00
Alger
14852fc8d3 Merge pull request #44 from algerkong/fix/minimize-on-space-after-restore-42
🐞 fix: 最小化点击后恢复窗口按空格会继续最小化
2025-01-16 00:43:05 +08:00
Alger
9866e772df Merge pull request #45 from algerkong/fix/repeat-sound-on-lyric-seek-43
🐞 fix: 修复单曲循环后点击歌词快进会有重复的声音播放
2025-01-16 00:42:50 +08:00
alger
87ca0836b1 🐞 fix: 修复单曲循环后点击歌词快进会有重复的声音播放 2025-01-16 00:40:44 +08:00
alger
fa07c5a40c 🐞 fix: 最小化点击后恢复窗口按空格会继续最小化
fixed #42
2025-01-16 00:38:47 +08:00
7 changed files with 32 additions and 53 deletions

View File

@@ -1,14 +1,9 @@
# 更新日志
## v3.7.0
### ✨ 新功能
- 添加全局快捷键支持以及快捷键管理功能
- 优化设置页面样式以及布局
## v3.7.1
### 🐞 Bug修复
- 修复弹窗层级问题
- 修复夜间模式下 歌曲收藏样式无效问题
- 优化夜间模式播放按钮颜色
- 修复单曲循环后点击歌词快进会有重复的声音播放
- 修复最小化点击后恢复窗口按空格会继续最小化
## 咖啡☕️

View File

@@ -1,6 +1,6 @@
{
"name": "AlgerMusicPlayer",
"version": "3.7.0",
"version": "3.7.1",
"description": "Alger Music Player",
"author": "Alger <algerkc@qq.com>",
"main": "./out/main/index.js",

View File

@@ -317,8 +317,8 @@ async function downloadMusic(
// 等待下载完成
await new Promise((resolve, reject) => {
writer!.on('finish', resolve);
writer!.on('error', reject);
writer!.on('finish', () => resolve(undefined));
writer!.on('error', (error) => reject(error));
response.data.pipe(writer!);
});

View File

@@ -7,41 +7,6 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
NAvatar: typeof import('naive-ui')['NAvatar']
NBadge: typeof import('naive-ui')['NBadge']
NButton: typeof import('naive-ui')['NButton']
NButtonGroup: typeof import('naive-ui')['NButtonGroup']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NDropdown: typeof import('naive-ui')['NDropdown']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NEmpty: typeof import('naive-ui')['NEmpty']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NIcon: typeof import('naive-ui')['NIcon']
NImage: typeof import('naive-ui')['NImage']
NInput: typeof import('naive-ui')['NInput']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NPopover: typeof import('naive-ui')['NPopover']
NProgress: typeof import('naive-ui')['NProgress']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSlider: typeof import('naive-ui')['NSlider']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag']
NTooltip: typeof import('naive-ui')['NTooltip']
NVirtualList: typeof import('naive-ui')['NVirtualList']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}

View File

@@ -72,9 +72,13 @@ watch(
const setupAudioListeners = () => {
let interval: any = null;
// 清理所有事件监听器
audioService.clearAllListeners();
// 监听播放
audioService.on('play', () => {
store.commit('setPlayMusic', true);
if (interval) clearInterval(interval);
interval = setInterval(() => {
nowTime.value = sound.value?.seek() as number;
allTime.value = sound.value?.duration() as number;
@@ -95,7 +99,10 @@ const setupAudioListeners = () => {
// 监听暂停
audioService.on('pause', () => {
store.commit('setPlayMusic', false);
clearInterval(interval);
if (interval) {
clearInterval(interval);
interval = null;
}
if (isElectron && isLyricWindowOpen.value) {
sendLyricToWin();
}
@@ -103,9 +110,17 @@ const setupAudioListeners = () => {
// 监听结束
audioService.on('end', () => {
if (interval) {
clearInterval(interval);
interval = null;
}
if (store.state.playMode === 1) {
// 单曲循环模式
sound.value?.play();
if (sound.value) {
sound.value.seek(0);
sound.value.play();
}
} else if (store.state.playMode === 2) {
// 随机播放模式
const { playList } = store.state;

View File

@@ -2,12 +2,12 @@
<div id="title-bar" @mousedown="drag">
<div id="title">Alger Music</div>
<div id="buttons">
<button @click="minimize">
<div class="button" @click="minimize">
<i class="iconfont icon-minisize"></i>
</button>
<button @click="close">
</div>
<div class="button" @click="close">
<i class="iconfont icon-close"></i>
</button>
</div>
</div>
</div>
@@ -107,7 +107,7 @@ const drag = (event: MouseEvent) => {
-webkit-app-region: no-drag;
}
button {
.button {
@apply text-gray-600 dark:text-gray-400 hover:text-green-500;
}

View File

@@ -202,6 +202,10 @@ class AudioService {
this.updateMediaSessionPositionState();
}
}
clearAllListeners() {
this.callbacks = {};
}
}
export const audioService = new AudioService();