refactor: 重构历史记录

This commit is contained in:
alger
2026-02-06 20:35:04 +08:00
parent b955e95edc
commit e53a035ebc
19 changed files with 469 additions and 357 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { AlbumHistoryItem } from '@/hooks/AlbumHistoryHook';
import type { AlbumHistoryItem } from '@/store/modules/playHistory';
import { getImgUrl } from '@/utils';
interface Props {
@@ -26,7 +26,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { PlaylistHistoryItem } from '@/hooks/PlaylistHistoryHook';
import type { PlaylistHistoryItem } from '@/store/modules/playHistory';
import { getImgUrl } from '@/utils';
interface Props {
@@ -66,8 +66,8 @@ import { useRouter } from 'vue-router';
import { navigateToMusicList } from '@/components/common/MusicListNavigator';
import MvPlayer from '@/components/MvPlayer.vue';
import { usePodcastRadioHistory } from '@/hooks/PodcastRadioHistoryHook';
import { usePlayerStore } from '@/store/modules/player';
import { usePlayHistoryStore } from '@/store/modules/playHistory';
import { IMvItem } from '@/types/mv';
import { getImgUrl } from '@/utils';
@@ -86,7 +86,7 @@ const showPop = ref(false);
const playerStore = usePlayerStore();
const router = useRouter();
const { addPodcastRadio } = usePodcastRadioHistory();
const playHistoryStore = usePlayHistoryStore();
const getCurrentMv = () => {
return {
@@ -117,7 +117,7 @@ const handleClick = async () => {
} else if (props.item.type === 'mv') {
handleShowMv();
} else if (props.item.type === 'djRadio') {
addPodcastRadio({
playHistoryStore.addPodcastRadio({
id: props.item.id,
name: props.item.name,
picUrl: props.item.picUrl,
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { usePodcastHistory } from '@/hooks/PodcastHistoryHook';
import { usePlayerStore } from '@/store';
import { usePlayHistoryStore } from '@/store/modules/playHistory';
import type { SongResult } from '@/types/music';
import type { DjProgram } from '@/types/podcast';
import { formatNumber, getImgUrl, secondToMinute } from '@/utils';
@@ -11,7 +11,7 @@ defineProps<{
}>();
const playerStore = usePlayerStore();
const { addPodcast } = usePodcastHistory();
const playHistoryStore = usePlayHistoryStore();
const formatDate = (timestamp: number): string => {
const date = new Date(timestamp);
@@ -98,7 +98,7 @@ const playProgram = async (program: DjProgram) => {
};
await playerStore.setPlay(songData);
addPodcast(program);
playHistoryStore.addPodcast(program);
} catch (error) {
console.error('播放节目失败:', error);
}