|
92 | 92 | import { ref, computed, onMounted } from 'vue' |
93 | 93 | import { useRouter } from 'vue-router' |
94 | 94 | import GlassCard from '@/components/ui/GlassCard.vue' |
| 95 | +import { artistApi } from '@/api/client' |
95 | 96 |
|
96 | 97 | interface Artist { |
97 | 98 | id: number |
@@ -120,20 +121,13 @@ const filteredArtists = computed(() => { |
120 | 121 | const loadArtists = async () => { |
121 | 122 | loading.value = true |
122 | 123 | try { |
123 | | - // TODO: 调用 API 获取艺术家列表 |
124 | | - artists.value = [ |
125 | | - { id: 1, name: '周杰伦', image_url: '', trackCount: 234 }, |
126 | | - { id: 2, name: '林俊杰', image_url: '', trackCount: 156 }, |
127 | | - { id: 3, name: '陈奕迅', image_url: '', trackCount: 189 }, |
128 | | - { id: 4, name: '张学友', image_url: '', trackCount: 267 }, |
129 | | - { id: 5, name: '邓紫棋', image_url: '', trackCount: 98 }, |
130 | | - { id: 6, name: 'Ed Sheeran', image_url: '', trackCount: 145 }, |
131 | | - { id: 7, name: 'Taylor Swift', image_url: '', trackCount: 178 }, |
132 | | - { id: 8, name: 'The Weeknd', image_url: '', trackCount: 123 }, |
133 | | - ] |
134 | | - total.value = artists.value.length |
| 124 | + const res = await artistApi.list({ limit: 100 }) |
| 125 | + artists.value = res.data || [] |
| 126 | + total.value = res.total || 0 |
135 | 127 | } catch (error) { |
136 | 128 | console.error('Failed to load artists:', error) |
| 129 | + artists.value = [] |
| 130 | + total.value = 0 |
137 | 131 | } finally { |
138 | 132 | loading.value = false |
139 | 133 | } |
|
0 commit comments