Skip to content

Commit d56a25e

Browse files
committed
feat: 在用户歌单中添加“我创建的”标签,优化获取用户歌单的逻辑
1 parent a449b74 commit d56a25e

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

src/i18n/lang/en-US/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
},
77
playlist: {
88
created: 'Created Playlists',
9+
mine: 'Mine',
910
trackCount: '{count} tracks',
1011
playCount: 'Played {count} times'
1112
},

src/i18n/lang/zh-CN/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
},
77
playlist: {
88
created: '创建的歌单',
9+
mine: '我创建的',
910
trackCount: '{count}首',
1011
playCount: '播放{count}次'
1112
},

src/renderer/components/common/PlaylistDrawer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ const fetchUserPlaylists = async () => {
159159
return;
160160
}
161161
162-
const res = await getUserPlaylist(user.userId);
162+
const res = await getUserPlaylist(user.userId, 999);
163163
if (res.data?.playlist) {
164-
playlists.value = res.data.playlist;
164+
playlists.value = res.data.playlist.filter((item: any) => item.userId === user.userId);
165165
}
166166
} catch (error) {
167167
console.error('获取歌单失败:', error);

src/renderer/views/user/index.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@
4343
preview-disabled
4444
/>
4545
<div class="play-list-item-info">
46-
<div class="play-list-item-name">{{ item.name }}</div>
46+
<div class="play-list-item-name">
47+
{{ item.name }}
48+
<div v-if="item.creator.userId === user.userId" class="playlist-creator-tag">
49+
{{ t('user.playlist.mine') }}
50+
</div>
51+
</div>
4752
<div class="play-list-item-count">
4853
{{ t('user.playlist.trackCount', { count: item.trackCount }) }},{{
4954
t('user.playlist.playCount', { count: item.playCount })
@@ -353,11 +358,22 @@ const showFollowList = () => {
353358
}
354359
355360
&-info {
356-
@apply ml-2;
361+
@apply ml-2 flex-1;
357362
}
358363
359364
&-name {
360-
@apply text-gray-900 dark:text-white text-base;
365+
@apply text-gray-900 dark:text-white text-base flex items-center gap-2;
366+
367+
.playlist-creator-tag {
368+
@apply inline-flex items-center justify-center px-2 rounded-full text-xs;
369+
@apply bg-light-300 text-primary dark:bg-dark-300 dark:text-white;
370+
@apply border border-primary/20 dark:border-primary/30;
371+
height: 18px;
372+
font-size: 10px;
373+
font-weight: 500;
374+
backdrop-filter: blur(4px);
375+
-webkit-backdrop-filter: blur(4px);
376+
}
361377
}
362378
363379
&-count {

0 commit comments

Comments
 (0)