-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add songlist panel in user center
- Loading branch information
Showing
8 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,6 @@ watch(props, async (val) => { | |
|
||
<style lang="scss"> | ||
.my-favorite-songs { | ||
height: 900px; | ||
height: 500px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/pages/UserCenter/components/SonglistsList/SonglistsList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<script setup lang="ts"> | ||
import { computed, ref } from 'vue' | ||
import { storeToRefs } from 'pinia' | ||
import { useSonglistsStore } from 'stores' | ||
import ListItem from 'src/pages/Search/components/ListItem.vue' | ||
const currentTab = ref<'created-list' | 'collected-list'>('created-list') | ||
const { createdSonglists, collectedSonglists } = storeToRefs(useSonglistsStore()) | ||
const songlistArr = computed(() => { | ||
const list = | ||
currentTab.value === 'created-list' ? createdSonglists.value : collectedSonglists.value | ||
return list.map((item) => { | ||
return { | ||
name: item.name, | ||
creator: item.creator.nickname, | ||
cover: item.coverImgUrl, | ||
id: item.id | ||
} | ||
}) | ||
}) | ||
async function onTabChange() { | ||
currentTab.value = currentTab.value === 'created-list' ? 'collected-list' : 'created-list' | ||
} | ||
</script> | ||
|
||
<template> | ||
<div | ||
id="songlists-list" | ||
class="mt-8 flex w-full flex-col rounded-lg bg-base-100 bg-gradient-to-b from-primary/5 to-30% p-4" | ||
> | ||
<div class="mb-4 flex w-full items-center"> | ||
<template v-if="currentTab === 'created-list'"> | ||
<h2 class="border-l-4 border-primary px-2 text-lg/5 font-bold">我创建的歌单</h2> | ||
<div class="h-4 w-px bg-base-content/10"></div> | ||
<button | ||
class="ml-2 text-sm" | ||
@click="onTabChange" | ||
> | ||
我收藏的歌单 | ||
</button> | ||
</template> | ||
<template v-else> | ||
<h2 class="border-l-4 border-primary px-2 text-lg/5 font-bold">我收藏的歌单</h2> | ||
<div class="h-4 w-px bg-base-content/10"></div> | ||
<button | ||
class="ml-2 text-sm" | ||
@click="onTabChange" | ||
> | ||
我创建的歌单 | ||
</button> | ||
</template> | ||
</div> | ||
|
||
<ul | ||
class="songlists-list relative flex h-[800px] w-full flex-wrap overflow-y-auto overflow-x-visible" | ||
> | ||
<ListItem | ||
v-for="songlist in songlistArr" | ||
:key="songlist.id" | ||
:list-item="songlist" | ||
type="songlist" | ||
class="flex items-center" | ||
/> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { default as AlbumList } from './AlbumList/AlbumList.vue' | ||
export { default as FavoriteSongs } from './FavoriteSongs.vue' | ||
export { default as RecentSongs } from './RecentSongs.vue' | ||
export { default as SonglistsList } from './SonglistsList/SonglistsList.vue' | ||
export { default as UserInfo } from './UserInfo.vue' |