- Cookie 存储从 temp_dir 迁移至 Tauri app_data_dir,兼容 Linux - 简单统一风格,UI优化 - recentLocal 播放历史持久化到 localStorage - 添加设置界面可以修改简单的设置
21 lines
661 B
TypeScript
21 lines
661 B
TypeScript
export function formatDuration(ms: number): string {
|
|
const sec = Math.floor(ms / 1000);
|
|
const m = Math.floor(sec / 60);
|
|
const s = sec % 60;
|
|
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
}
|
|
|
|
export function formatTime(sec: number): string {
|
|
if (!sec || isNaN(sec)) return '0:00';
|
|
const m = Math.floor(sec / 60);
|
|
const s = Math.floor(sec % 60);
|
|
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
}
|
|
|
|
export function formatPlayCount(count: number): string {
|
|
if (!count) return '0';
|
|
if (count >= 100000000) return (count / 100000000).toFixed(1) + '亿';
|
|
if (count >= 10000) return (count / 10000).toFixed(1) + '万';
|
|
return count.toString();
|
|
}
|