Files
Nekosonic-Music/src/api/song.ts
T
atdunbg 263e9b31d9 feat: v0.8.0 详情页架构重构、皮肤系统、侧边栏交互升级、底层模块拆分
- 详情页统一 DetailLayout 组件(常驻头部 + 独立滚动 + 紧凑态动画)
- 歌曲/评论 tab 切换(懒加载 + 保活),专辑模糊搜索
- 皮肤系统 skins.ts(19 语义色 + 14 预设 + 自定义皮肤 + 壁纸)
- 设置页皮肤模块(外观/主题色/皮肤编辑器/壁纸选择)
- 可折叠侧边栏 + TopBar + 折叠态歌单浮层(高度不越 PlayerBar)
- 首页扩展至 6 区块 + 通用卡片组件 + 虚拟歌曲列表
- audio.rs 拆为 8 模块,api.ts 拆为 api/ 目录,player store 拆为 4 store
- 修复播放竞态、seek 暂停、评论提前加载、紧凑态卡死等
2026-06-26 21:05:51 +08:00

37 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { invoke } from '@tauri-apps/api/core';
/**
* 歌曲相关 API
*/
export const SongApi = {
/** 获取歌曲详情 */
async getSongDetail(id: string): Promise<string> {
return invoke('get_song_detail', { id });
},
/** 获取歌曲播放 URL */
async getSongUrl(query: { id: number; level: string; fm_mode?: boolean }): Promise<string> {
return invoke('get_song_url', { query });
},
/** 获取歌词 */
async getLyric(id: number): Promise<string> {
return invoke('get_lyric', { id });
},
/** 获取喜欢列表 */
async likelist(uid: number): Promise<string> {
return invoke('likelist', { uid });
},
/** 喜欢/取消喜欢歌曲 */
async likeSong(id: number, like: boolean): Promise<void> {
return invoke('like_song', { query: { id, like: like ? 'true' : 'false' } });
},
/** 上报听歌记录(scrobble */
async scrobble(query: { id: number; sourceid: string; time: number; alg?: string; source?: string; bitrate?: number }): Promise<void> {
return invoke('scrobble', { query });
},
};