mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 13:36:20 +08:00
parent
b501214c02
commit
a87686098c
|
@ -17,6 +17,7 @@ const table = {
|
|||
'/playlist/delete': require('../module/playlist_delete'),
|
||||
'/playlist/create': require('../module/playlist_create'),
|
||||
'/playlist/tracks': require('../module/playlist_tracks'),
|
||||
'/playmode/intelligence/list': require('../module/playmode_intelligence_list'),
|
||||
'/recommend/songs': require('../module/recommend_songs'),
|
||||
'/login/qr/create': require('../module/login_qr_create'),
|
||||
'/login/qr/check': require('../module/login_qr_check'),
|
||||
|
|
|
@ -206,3 +206,21 @@ export function dailyRecommendTracks() {
|
|||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 心动模式/智能播放
|
||||
* 说明 : 登录后调用此接口 , 可获取心动模式/智能播放列表 必选参数 : id : 歌曲 id
|
||||
* - id : 歌曲 id
|
||||
* - pid : 歌单 id
|
||||
* - sid : 要开始播放的歌曲的 id (可选参数)
|
||||
* @param {Object} params
|
||||
* @param {number=} params.id
|
||||
* @param {number=} params.pid
|
||||
*/
|
||||
export function intelligencePlaylist(params) {
|
||||
return request({
|
||||
url: '/playmode/intelligence/list',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import shuffle from 'lodash/shuffle';
|
|||
import { Howler, Howl } from 'howler';
|
||||
import { cacheTrackSource, getTrackSource } from '@/utils/db';
|
||||
import { getAlbum } from '@/api/album';
|
||||
import { getPlaylistDetail } from '@/api/playlist';
|
||||
import { getPlaylistDetail, intelligencePlaylist } from '@/api/playlist';
|
||||
import { getArtist } from '@/api/artist';
|
||||
import { personalFM, fmTrash } from '@/api/others';
|
||||
import store from '@/store';
|
||||
|
@ -606,6 +606,18 @@ export default class {
|
|||
}
|
||||
this._replaceCurrentTrack(id);
|
||||
}
|
||||
playIntelligenceListById(id, trackID = 'first', noCache = false) {
|
||||
getPlaylistDetail(id, noCache).then(data => {
|
||||
const randomId = Math.floor(
|
||||
Math.random() * (data.playlist.trackIds.length + 1)
|
||||
);
|
||||
const songId = data.playlist.trackIds[randomId].id;
|
||||
intelligencePlaylist({ id: songId, pid: id }).then(result => {
|
||||
let trackIDs = result.data.map(t => t.id);
|
||||
this.replacePlaylist(trackIDs, id, 'playlist', trackID);
|
||||
});
|
||||
});
|
||||
}
|
||||
addTrackToPlayNext(trackID, playNow = false) {
|
||||
this._playNextList.push(trackID);
|
||||
if (playNow) this.playNextTrack();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{{ liked.songs.length }} {{ $t('common.songs') }}
|
||||
</div>
|
||||
</div>
|
||||
<button @click.stop="playLikedSongs">
|
||||
<button @click.stop="openPlayModeTabMenu">
|
||||
<svg-icon icon-class="play" />
|
||||
</button>
|
||||
</div>
|
||||
|
@ -186,6 +186,14 @@
|
|||
$t('contextMenu.likedPlaylists')
|
||||
}}</div>
|
||||
</ContextMenu>
|
||||
|
||||
<ContextMenu ref="playModeTabMenu">
|
||||
<div class="item" @click="playLikedSongs">{{
|
||||
$t('library.likedSongs')
|
||||
}}</div>
|
||||
<hr />
|
||||
<div class="item" @click="playIntelligenceList"> 心动模式 </div>
|
||||
</ContextMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -318,6 +326,13 @@ export default {
|
|||
true
|
||||
);
|
||||
},
|
||||
playIntelligenceList() {
|
||||
this.$store.state.player.playIntelligenceListById(
|
||||
this.liked.playlists[0].id,
|
||||
'first',
|
||||
true
|
||||
);
|
||||
},
|
||||
updateCurrentTab(tab) {
|
||||
if (!isAccountLoggedIn() && tab !== 'playlists') {
|
||||
this.showToast(locale.t('toast.needToLogin'));
|
||||
|
@ -358,6 +373,9 @@ export default {
|
|||
openPlaylistTabMenu(e) {
|
||||
this.$refs.playlistTabMenu.openMenu(e);
|
||||
},
|
||||
openPlayModeTabMenu(e) {
|
||||
this.$refs.playModeTabMenu.openMenu(e);
|
||||
},
|
||||
changePlaylistFilter(type) {
|
||||
this.updateData({ key: 'libraryPlaylistFilter', value: type });
|
||||
window.scrollTo({ top: 375, behavior: 'smooth' });
|
||||
|
|
Loading…
Reference in New Issue
Block a user