Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import request from "@/utils/request";
* 获取歌单详情
* @param {number} id - 歌单 id
*/
export const playlistDetail = (id: number) => {
export const playlistDetail = (id: number, noCookie: boolean = true) => {
return request({
url: "/playlist/detail",
params: {
id,
s: 0, // 去除返回收藏者
noCookie: true, // 去除返回 privileges
...(noCookie ? { noCookie: true } : {}), // 去除返回 privileges
timestamp: Date.now(),
},
});
Expand Down
36 changes: 3 additions & 33 deletions src/views/List/liked.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,8 @@
@play-all="playAllSongs"
/>
<Transition name="fade" mode="out-in">
<div v-if="(!searchValue || searchData?.length) && isPhone" class="mobile-liked-song-list">
<SongCard
v-for="(song, index) in displayData"
:key="song.id"
:song="song"
:index="index"
hidden-size
@click.stop="playMobileSong(song)"
/>
</div>
<SongList
v-else-if="!searchValue || searchData?.length"
v-if="!searchValue || searchData?.length"
:data="displayData"
:loading="loading"
:height="songListHeight"
Expand Down Expand Up @@ -67,14 +57,9 @@ import { useListDetail } from "@/composables/List/useListDetail";
import { useListSearch } from "@/composables/List/useListSearch";
import { useListScroll } from "@/composables/List/useListScroll";
import { useListActions } from "@/composables/List/useListActions";
import { useDevice } from "@/composables/useDevice";
import { usePlayerController } from "@/core/player/PlayerController";
import SongCard from "@/components/Card/SongCard.vue";

const dataStore = useDataStore();
const statusStore = useStatusStore();
const { isPhone } = useDevice();
const player = usePlayerController();

// 是否激活
const isActivated = ref<boolean>(false);
Expand Down Expand Up @@ -202,7 +187,7 @@ const loadPlaylistData = async (id: number, forceRefresh: boolean = false) => {
resetScroll();
}
try {
const detail = await playlistDetail(id);
const detail = await playlistDetail(id, false);
if (currentRequestId.value !== id) return;
// 更新歌单详情
setDetailData(formatCoverList(detail.playlist)[0]);
Expand Down Expand Up @@ -323,7 +308,7 @@ const syncSongList = async (serverIds: number[], requestId: number) => {
if (currentRequestId.value !== requestId) return;
setListData(newList);
// 更新详情
const detail = await playlistDetail(playlistId.value);
const detail = await playlistDetail(playlistId.value, false);
if (currentRequestId.value === requestId) {
setDetailData(formatCoverList(detail.playlist)[0]);
}
Expand Down Expand Up @@ -357,11 +342,6 @@ const playAllSongs = useDebounceFn(() => {
playAllSongsAction(displayData.value, playlistId.value);
}, 300);

const playMobileSong = (song: SongType) => {
if (!displayData.value?.length) return;
player.updatePlayList(displayData.value, song, playlistId.value);
};

// 删除指定索引歌曲
const removeSong = (ids: number[]) => {
if (!listData.value) return;
Expand Down Expand Up @@ -438,13 +418,3 @@ onMounted(async () => {
}
});
</script>

<style lang="scss" scoped>
.mobile-liked-song-list {
display: flex;
flex-direction: column;
gap: 12px;
padding-top: 236px;
padding-bottom: 12px;
}
</style>