Files
AlgerMusicPlayer/src/renderer/components/common/DownloadDrawer.vue
T
alger bc46024499 refactor(download): 重构下载系统,支持暂停/恢复/取消,修复歌词加载
- 新建 DownloadManager 类(主进程),每个任务独立 AbortController 控制
- 新建 Pinia useDownloadStore 作为渲染进程单一数据源
- 支持暂停/恢复/取消下载,支持断点续传(Range header)
- 批量下载全部完成后发送汇总系统通知,单首不重复通知
- 并发数可配置(1-5),队列持久化(重启后恢复)
- 修复下载列表不全、封面加载失败、通知重复等 bug
- 修复本地/下载歌曲歌词加载:优先从 ID3/FLAC 元数据提取,API 作为 fallback
- 删除 useDownloadStatus.ts,统一状态管理
- DownloadDrawer/DownloadPage 全面重写,移除 @apply 违规
- 新增 5 语言 i18n 键值(暂停/恢复/取消/排队中等)
2026-03-27 23:02:08 +08:00

37 lines
1.0 KiB
Vue

<template>
<div class="fixed left-6 bottom-24 z-[999]">
<n-badge :value="downloadingCount" :max="99" :show="downloadingCount > 0">
<n-button
circle
class="bg-white/80 dark:bg-gray-800/80 shadow-lg backdrop-blur-sm hover:bg-light dark:hover:bg-dark-200 text-gray-600 dark:text-gray-300 transition-all duration-300 w-10 h-10"
@click="navigateToDownloads"
>
<template #icon>
<i class="iconfont ri-download-cloud-2-line text-xl"></i>
</template>
</n-button>
</n-badge>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useDownloadStore } from '@/store/modules/download';
const router = useRouter();
const downloadStore = useDownloadStore();
const downloadingCount = computed(() => downloadStore.downloadingCount);
const navigateToDownloads = () => {
router.push('/downloads');
};
onMounted(() => {
downloadStore.initListeners();
downloadStore.loadPersistedQueue();
});
</script>