diff --git a/src/api/album.js b/src/api/album.js index 18425d4..15dd5b9 100644 --- a/src/api/album.js +++ b/src/api/album.js @@ -21,8 +21,6 @@ export function getAlbum(id) { return data; }); }; - fetchLatest(); - return getAlbumFromCache(id).then(result => { return result ?? fetchLatest(); }); diff --git a/src/api/others.js b/src/api/others.js index 5c3cd63..2437120 100644 --- a/src/api/others.js +++ b/src/api/others.js @@ -20,7 +20,9 @@ export function search(params) { return request({ url: '/search', method: 'get', - params, + params: { + ...params, + }, }).then(data => { if (data.result?.song !== undefined) data.result.song.songs = mapTrackPlayableStatus(data.result.song.songs); diff --git a/src/api/playlist.js b/src/api/playlist.js index 08177ea..cbad59f 100644 --- a/src/api/playlist.js +++ b/src/api/playlist.js @@ -42,15 +42,21 @@ export function dailyRecommendPlaylist(params) { * @param {number} id * @param {boolean=} noCache */ -export function getPlaylistDetail(id, noCache = false) { +export function getPlaylistDetail(id, noCache = false, server) { let params = { id }; if (noCache) params.timestamp = new Date().getTime(); return request({ url: '/playlist/detail', method: 'get', - params, + params: { + ...params, + server, + }, }).then(data => { if (data.playlist) { + if (data.playlist.source) { + return data; + } data.playlist.tracks = mapTrackPlayableStatus( data.playlist.tracks, data.privileges || [] diff --git a/src/api/track.js b/src/api/track.js index 490c91c..40fb14a 100644 --- a/src/api/track.js +++ b/src/api/track.js @@ -53,8 +53,6 @@ export function getTrackDetail(ids) { return data; }); }; - fetchLatest(); - let idsInArray = [String(ids)]; if (typeof ids === 'string') { idsInArray = ids.split(','); @@ -71,25 +69,23 @@ export function getTrackDetail(ids) { /** * 获取歌词 * 说明 : 调用此接口 , 传入音乐 id 可获得对应音乐的歌词 ( 不需要登录 ) - * @param {number} id - 音乐 id + * @param id - 音乐 id */ -export function getLyric(id) { +export function getLyric(id, server) { const fetchLatest = () => { return request({ url: '/lyric', method: 'get', params: { id, + server: server ? server : undefined, }, }).then(result => { - cacheLyric(id, result); + cacheLyric(`${server ? server : ''}${id}`, result); return result; }); }; - - fetchLatest(); - - return getLyricFromCache(id).then(result => { + return getLyricFromCache(`${server ? server : ''}${id}`).then(result => { return result ?? fetchLatest(); }); } diff --git a/src/components/Cover.vue b/src/components/Cover.vue index 163022a..16c6815 100644 --- a/src/components/Cover.vue +++ b/src/components/Cover.vue @@ -16,7 +16,12 @@ > - +
+ + + - + +
+ + QQ音乐 +
+
@@ -155,6 +163,15 @@ export default { showUserProfileMenu(e) { this.$refs.userProfileMenu.openMenu(e); }, + showSearchList(e) { + this.$refs.showSearchList.openMenu(e); + }, + toCoSearch(item) { + this.$router.push({ + name: 'coSearch', + query: { server: item, keywords: this.keywords }, + }); + }, logout() { if (!confirm('确定要退出登录吗?')) return; doLogout(); diff --git a/src/components/Player.vue b/src/components/Player.vue index 0feb0a2..cd405f0 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -28,6 +28,7 @@
diff --git a/src/components/TrackList.vue b/src/components/TrackList.vue index c9f4138..d4971e3 100644 --- a/src/components/TrackList.vue +++ b/src/components/TrackList.vue @@ -62,11 +62,11 @@
@@ -101,8 +101,12 @@ export default { default: 'tracklist', }, // tracklist | album | playlist | cloudDisk id: { - type: Number, - default: 0, + type: String, + default: '0', + }, + maxSize: { + type: String, + default: '20', }, dbclickTrackFunc: { type: String, @@ -195,7 +199,17 @@ export default { }; this.rightClickedTrackIndex = -1; }, + playThisListByTrack(track) { + this.showToast('正在进行其他平台播放'); + let tracks = this.tracks.filter(_track => { + return _track.playable == 1; + }); + this.player.replacePlaylist(tracks, track, 'artist', track); + }, playThisList(trackID) { + if (trackID.constructor === Object) this.playThisListByTrack(trackID); + trackID = trackID.id || trackID.songId; + console.log(this.dbclickTrackFunc); if (this.dbclickTrackFunc === 'default') { this.playThisListDefault(trackID); } else if (this.dbclickTrackFunc === 'none') { diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue index 6df0f89..0bc352e 100644 --- a/src/components/TrackListItem.vue +++ b/src/components/TrackListItem.vue @@ -4,6 +4,7 @@ :class="trackClass" :style="trackStyle" :title="showUnavailableSongInGreyStyle ? track.reason : ''" + @click="playTrack" @mouseover="hover = true" @mouseleave="hover = false" > @@ -12,7 +13,8 @@ :src="imgUrl" loading="lazy" :class="{ hover: focus }" - @click="goToAlbum" + onerror="this.src = 'https://p2.music.126.net/UeTuwE7pvjBpypWLudqukA==/3132508627578625.jpg'; this.onerror=null;" + @click.stop="goToAlbum" />
- +
{ + getLyric(server) { + return getLyric(this.currentTrack.id, server).then(data => { if (!data?.lrc?.lyric) { this.lyric = []; this.tlyric = []; @@ -912,7 +919,6 @@ export default { .lyrics-page.no-lyric { .left-side { transition: all 0.5s; - transform: translateX(27vh); margin-right: 0; } } @@ -960,7 +966,6 @@ export default { .slide-fade-enter, .slide-fade-leave-to { - transform: translateX(27vh); opacity: 0; } diff --git a/src/views/playlist.vue b/src/views/playlist.vue index 32563ff..f394dd7 100644 --- a/src/views/playlist.vue +++ b/src/views/playlist.vue @@ -5,8 +5,8 @@ class="playlist-info" > -
- {{ playlist.description }} +
@@ -164,9 +167,10 @@
{ this.playlist = data.playlist; this.tracks = data.playlist.tracks; diff --git a/vue.config.js b/vue.config.js index a2daee3..cece704 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,7 +14,8 @@ module.exports = { proxy: { '^/api': { target: - 'https://service-osrz4um8-1257251314.gz.apigw.tencentcs.com/release/', + // 'https://service-osrz4um8-1257251314.gz.apigw.tencentcs.com/release/', + 'http://127.0.0.1:3000/', changeOrigin: true, pathRewrite: { '^/api': '/',