feat: 跨平台持久化与版本管理优化

- Cookie 存储从 temp_dir 迁移至 Tauri app_data_dir,兼容 Linux
- 简单统一风格,UI优化
- recentLocal 播放历史持久化到 localStorage
- 添加设置界面可以修改简单的设置
This commit is contained in:
2026-05-12 09:58:07 +08:00
parent 463e8e95b6
commit 7847a9f6b2
28 changed files with 1592 additions and 535 deletions

View File

@ -1,4 +1,4 @@
import { ref, computed, watch } from 'vue';
import { ref, watch } from 'vue';
import { invoke } from '@tauri-apps/api/core';
import { parseLrc, getCurrentLyricIndex, LyricLine } from '../utils/lyric';
import { usePlayerStore } from '../stores/player';
@ -9,12 +9,6 @@ export function useLyric() {
const lyrics = ref<LyricLine[]>([]);
const currentLyricIdx = ref(-1);
const currentLyricText = computed(() => {
if (lyrics.value.length === 0) return '';
const idx = currentLyricIdx.value;
return idx >= 0 && idx < lyrics.value.length ? lyrics.value[idx].text : '';
});
watch(() => player.currentSong, async (song) => {
if (!song) {
lyrics.value = [];
@ -43,6 +37,5 @@ export function useLyric() {
return {
lyrics,
currentLyricIdx,
currentLyricText,
};
}

View File

@ -0,0 +1,22 @@
import { ref } from 'vue';
export interface Toast {
id: number;
message: string;
type: 'success' | 'error' | 'info';
}
const toasts = ref<Toast[]>([]);
let nextId = 0;
export function showToast(message: string, type: 'success' | 'error' | 'info' = 'info', duration = 3000) {
const id = nextId++;
toasts.value.push({ id, message, type });
setTimeout(() => {
toasts.value = toasts.value.filter(t => t.id !== id);
}, duration);
}
export function useToast() {
return { toasts, showToast };
}