feat: 优化类型处理

This commit is contained in:
alger
2025-08-07 22:57:17 +08:00
parent daa8e7514d
commit 3ba85f34ed
62 changed files with 104 additions and 88 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
// musicHistoryHooks
import { useLocalStorage } from '@vueuse/core';
import type { SongResult } from '@/type/music';
import type { SongResult } from '@/types/music';
export const useMusicHistory = () => {
const musicHistory = useLocalStorage<SongResult[]>('musicHistory', []);
+6 -3
View File
@@ -1,13 +1,13 @@
import { cloneDeep } from 'lodash';
import { createDiscreteApi } from 'naive-ui';
import { computed, type ComputedRef,nextTick, onUnmounted, ref, watch } from 'vue';
import { computed, type ComputedRef, nextTick, onUnmounted, ref, watch } from 'vue';
import { getBilibiliAudioUrl } from '@/api/bilibili';
import useIndexedDB from '@/hooks/IndexDBHook';
import { audioService } from '@/services/audioService';
import type { usePlayerStore } from '@/store';
import { getSongUrl } from '@/store/modules/player';
import type { Artist, ILyricText, SongResult } from '@/type/music';
import type { Artist, ILyricText, SongResult } from '@/types/music';
import { isElectron } from '@/utils';
import { getTextColors } from '@/utils/linearColor';
@@ -464,7 +464,10 @@ const setupAudioListeners = () => {
let randomIndex;
do {
randomIndex = Math.floor(Math.random() * getPlayerStore().playList.length);
} while (randomIndex === getPlayerStore().playListIndex && getPlayerStore().playList.length > 1);
} while (
randomIndex === getPlayerStore().playListIndex &&
getPlayerStore().playList.length > 1
);
getPlayerStore().playListIndex = randomIndex;
getPlayerStore().setPlay(getPlayerStore().playList[randomIndex]);
}
+1 -1
View File
@@ -6,7 +6,7 @@ import { getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music';
import { useMusicHistory } from '@/hooks/MusicHistoryHook';
import { audioService } from '@/services/audioService';
import { useSettingsStore } from '@/store';
import type { ILyric, ILyricText, SongResult } from '@/type/music';
import type { ILyric, ILyricText, SongResult } from '@/types/music';
import { getImgUrl } from '@/utils';
import { getImageLinearBackground } from '@/utils/linearColor';
+1 -1
View File
@@ -4,7 +4,7 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { getSongUrl } from '@/store/modules/player';
import type { SongResult } from '@/type/music';
import type { SongResult } from '@/types/music';
import { isElectron } from '@/utils';
const ipcRenderer = isElectron ? window.electron.ipcRenderer : null;
+1 -1
View File
@@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { usePlayerStore } from '@/store';
import type { SongResult } from '@/type/music';
import type { SongResult } from '@/types/music';
import { getImgUrl } from '@/utils';
import { getImageBackground } from '@/utils/linearColor';