File tree Expand file tree Collapse file tree 7 files changed +153
-7
lines changed Expand file tree Collapse file tree 7 files changed +153
-7
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,24 @@ export function getDiscList() {
36
36
return Promise . resolve ( res . data )
37
37
} )
38
38
}
39
+
40
+ export function getSongList ( disstid ) {
41
+ const url = '/api/getSongList'
42
+
43
+ const data = Object . assign ( { } , commonParams , {
44
+ disstid,
45
+ type : 1 ,
46
+ json : 1 ,
47
+ utf8 : 1 ,
48
+ onlysong : 0 ,
49
+ platform : 'yqq' ,
50
+ hostUin : 0 ,
51
+ needNewCode : 0 ,
52
+ g_tk : 67232076
53
+ } )
54
+ return axios . get ( url , {
55
+ params : data
56
+ } ) . then ( res => {
57
+ return Promise . resolve ( res . data )
58
+ } )
59
+ }
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <transition name =" slide" >
3
+ <music-list :title =" title" :bg-image =" bgImage" :songs =" songs" />
4
+ </transition >
5
+ </template >
6
+
7
+ <script >
8
+ import MusicList from " ../music-list/music-list" ;
9
+ import {mapGetters } from ' vuex'
10
+ import {getSongList } from ' api/recommend'
11
+ import {createSong } from ' common/js/song'
12
+ import {ERR_OK } from " api/config" ;
13
+
14
+ export default {
15
+ name: " disc" ,
16
+ components: {MusicList},
17
+ data () {
18
+ return {
19
+ songs: []
20
+ }
21
+ },
22
+ computed: {
23
+ title (){
24
+ return this .disc .dissname
25
+ },
26
+ bgImage () {
27
+ return this .disc .imgurl
28
+ },
29
+ ... mapGetters ([
30
+ ' disc'
31
+ ])
32
+ },
33
+ created () {
34
+ this ._getSongList ()
35
+ },
36
+ methods: {
37
+ _getSongList () {
38
+ if (! this .disc .dissid ) {
39
+ this .$router .push (' /recommend' )
40
+ return
41
+ }
42
+ getSongList (this .disc .dissid ).then ((res ) => {
43
+ if (res .code === ERR_OK ) {
44
+ this .songs = this ._normalizeSongs (res .cdlist [0 ].songlist )
45
+ }
46
+ })
47
+ },
48
+ _normalizeSongs (list ) {
49
+ let ret = []
50
+ list .forEach ((musicData ) => {
51
+ if (musicData .songid && musicData .albummid ) {
52
+ ret .push (createSong (musicData))
53
+ }
54
+ })
55
+ return ret
56
+ }
57
+ },
58
+ }
59
+ </script >
60
+
61
+ <style scoped lang="stylus" rel="stylesheet/stylus">
62
+ .slide-enter-active , .slide-leave-active
63
+ transition : all 0.3s
64
+
65
+ .slide-enter , .slide-leave-to
66
+ transform : translate3d (100% , 0 , 0 )
67
+ </style >
Original file line number Diff line number Diff line change 14
14
<div class =" recommend-list" >
15
15
<h1 class =" list-title" >热门歌单推荐</h1 >
16
16
<ul >
17
- <li v-for =" (item,index) in discList" :key =" index" class =" item" >
17
+ <li @click = " selectItem(item) " v-for =" (item,index) in discList" :key =" index" class =" item" >
18
18
<div class =" icon" >
19
19
<img width =" 60" height =" 60" v-lazy =" item.imgurl" />
20
20
</div >
30
30
<loading ></loading >
31
31
</div >
32
32
</scroll >
33
+ <router-view />
33
34
</div >
34
35
</template >
35
36
40
41
import Scroll from " base/scroll/scroll" ;
41
42
import Loading from " base/loading/loading" ;
42
43
import {playlistMixin } from " common/js/mixin" ;
44
+ import {mapMutations } from ' vuex'
43
45
44
46
export default {
45
47
name: " recommend" ,
46
- mixins: [playlistMixin],
48
+ mixins: [playlistMixin],
47
49
data () {
48
50
return {
49
51
recommends: [],
63
65
this .$refs .recommend .style .bottom = bottom
64
66
this .$refs .scroll .refresh ()
65
67
},
68
+ selectItem (item ) {
69
+ this .$router .push ({
70
+ path: ` /recommend/${ item .dissid } `
71
+ })
72
+ this .setDisc (item)
73
+ },
66
74
_getRecommend () {
67
75
getRecommend ().then ((res ) => {
68
76
if (res .code === ERR_OK ) {
82
90
this .$refs .scroll .refresh ()
83
91
this .checkLoaded = true
84
92
}
85
- }
93
+ },
94
+ ... mapMutations ({
95
+ setDisc: ' SET_DISC'
96
+ })
86
97
}
87
98
}
88
99
</script >
Original file line number Diff line number Diff line change @@ -12,7 +12,14 @@ export default new Router({
12
12
{
13
13
path : '/recommend' ,
14
14
name : 'recommend' ,
15
- component : ( ) => import ( 'components/recommend/recommend.vue' )
15
+ component : ( ) => import ( 'components/recommend/recommend.vue' ) ,
16
+ children : [
17
+ {
18
+ path :':id' ,
19
+ name :'disc' ,
20
+ component : ( ) => import ( 'components/disc/disc.vue' )
21
+ }
22
+ ]
16
23
} ,
17
24
{
18
25
path : '/rank' ,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const mutations = {
4
4
[ types . SET_SINGER ] ( state , singer ) {
5
5
state . singer = singer
6
6
} ,
7
- [ types . SET_PLAYING_STATE ] ( state , flag ) {
7
+ [ types . SET_PLAYING_STATE ] ( state , flag ) {
8
8
state . playing = flag
9
9
} ,
10
10
[ types . SET_FULL_SCREEN ] ( state , flag ) {
@@ -21,6 +21,21 @@ const mutations = {
21
21
} ,
22
22
[ types . SET_CURRENT_INDEX ] ( state , index ) {
23
23
state . currentIndex = index
24
+ } ,
25
+ [ types . SET_DISC ] ( state , disc ) {
26
+ state . disc = disc
27
+ } ,
28
+ [ types . SET_TOP_LIST ] ( state , topList ) {
29
+ state . topList = topList
30
+ } ,
31
+ [ types . SET_SEARCH_HISTORY ] ( state , history ) {
32
+ state . searchHistory = history
33
+ } ,
34
+ [ types . SET_PLAY_HISTORY ] ( state , history ) {
35
+ state . playHistory = history
36
+ } ,
37
+ [ types . SET_FAVORITE_LIST ] ( state , list ) {
38
+ state . favoriteList = list
24
39
}
25
40
}
26
41
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const state = {
7
7
playlist : [ ] ,
8
8
sequenceList : [ ] ,
9
9
mode : playMode . sequence ,
10
- currentIndex : - 1
10
+ currentIndex : - 1 ,
11
+ disc :{ }
11
12
}
12
13
export default state
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ module.exports = {
16
16
} ,
17
17
devServer : {
18
18
before ( app ) {
19
- var url = "https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg" ;
20
19
app . get ( '/api/getDiscList' , function ( req , res ) {
20
+ var url = "https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg" ;
21
21
axios . get ( url , {
22
22
headers : {
23
23
referer : 'https://c.y.qq.com/' ,
@@ -53,6 +53,30 @@ module.exports = {
53
53
console . log ( e )
54
54
} )
55
55
} )
56
+ app . get ( '/api/getSongList' , function ( req , res ) {
57
+ var url = 'https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg'
58
+
59
+ axios . get ( url , {
60
+ headers : {
61
+ referer : 'https://c.y.qq.com/' ,
62
+ host : 'c.y.qq.com'
63
+ } ,
64
+ params : req . query
65
+ } ) . then ( ( response ) => {
66
+ var ret = response . data
67
+ if ( typeof ret === 'string' ) {
68
+ // var reg = /^\w+\(({[^()]+})\)$/
69
+ var reg = / { .* } /
70
+ var matches = ret . match ( reg )
71
+ if ( matches ) {
72
+ ret = JSON . parse ( matches [ 0 ] )
73
+ }
74
+ }
75
+ res . json ( ret )
76
+ } ) . catch ( ( e ) => {
77
+ console . log ( e )
78
+ } )
79
+ } )
56
80
}
57
81
}
58
82
}
You can’t perform that action at this time.
0 commit comments