Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.

Commit 0dccefa

Browse files
committed
更新 - 添加验证
1 parent 34b0f83 commit 0dccefa

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

src/components/parts-artist-item/parts-artist-item.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ export default {
3232
}
3333
getArtistDetail(this.artist.id).then(res => {
3434
if (res.code === ERR_OK) {
35+
this.songs = this._normalizeSongs(res.data.list)
36+
} else {
37+
throw new Error('Check ERR_OK failed')
3538
}
36-
this.songs = this._normalizeSongs(res.data.list)
3739
})
3840
},
3941

src/components/parts-recom-item/parts-recom-item.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export default {
2727
if (res.code === ERR_OK) {
2828
this.itemSongs = this._normalizeSongs(res.cdlist[0].songlist)
2929
console.info('%c Loading recommend songs', 'color: dodgerblue')
30+
} else {
31+
throw new Error('Check ERR_OK failed')
3032
}
3133
})
3234
},

src/components/the-artist/artist.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export default {
3838
getArtistList().then(res => {
3939
if (res.code === ERR_OK) {
4040
this.artistList = this._normalizeArtistList(res.data.list)
41+
} else {
42+
throw new Error('Check ERR_OK failed')
4143
}
4244
})
4345
},

src/components/the-ranking/ranking.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="ranking-list">
3-
<BaseScroll class="list-wrapper" :data="topList" v-show="topList.length > 0">
2+
<div class="ranking-list" ref="list">
3+
<BaseScroll class="list-wrapper" :data="topList" ref="scroll">
44
<ul>
55
<li
66
class="ranking-item"
@@ -16,15 +16,16 @@
1616
v-for="(song, songIndex) of list.songList"
1717
:key="songIndex"
1818
>
19-
<span class="song-num">{{ songIndex + 1 }}</span>
20-
<span class="song-text">{{ song.songname }} - {{ song.singername }}</span>
19+
<span>{{ songIndex + 1 }}</span>
20+
<span>{{ song.songname }} - {{ song.singername }}</span>
2121
</li>
2222
</ul>
2323

2424
</li>
2525
</ul>
26+
<BaseLoading v-show="topList.length === 0"/>
2627
</BaseScroll>
27-
<BaseLoading v-show="topList.length === 0"/>
28+
<router-view/>
2829
</div>
2930
</template>
3031

@@ -33,19 +34,30 @@ import BaseScroll from 'base/base-scroll'
3334
import BaseLoading from 'base/base-loading/base-loading'
3435
import { getRankingList } from 'api/the-ranking'
3536
import { ERR_OK } from 'api/config'
37+
import { playlistMixin } from 'common/js/mixin'
3638
3739
export default {
40+
mixins: [playlistMixin],
3841
data () {
3942
return {
4043
topList: []
4144
}
4245
},
4346
4447
methods: {
48+
handlePlaylist (playlist) {
49+
const bottom = this.playlist.length > 0 ? '60px' : ''
50+
51+
this.$refs.list.style.bottom = bottom
52+
this.$refs.scroll.refresh()
53+
},
54+
4555
_getRankingList () {
4656
getRankingList().then(res => {
4757
if (res.code === ERR_OK) {
4858
this.topList = res.data.topList
59+
} else {
60+
throw new Error('Check ERR_OK failed')
4961
}
5062
})
5163
}

src/components/the-recommend/recommend.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export default {
7777
getRecommend().then(res => {
7878
if (res.code === ERR_OK) {
7979
this.sliderList = res.data.slider
80+
} else {
81+
throw new Error('Check ERR_OK failed')
8082
}
8183
})
8284
},

0 commit comments

Comments
 (0)