diff --git a/src/components/Player.vue b/src/components/Player.vue index 9789a67..5458ff3 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -30,16 +30,19 @@ @click="goToAlbum" />
-
+
{{ currentTrack.name }}
- {{ ar.name }} {{ ar.name }} ,
@@ -173,6 +176,7 @@ import '@/assets/css/slider.css'; import ButtonIcon from '@/components/ButtonIcon.vue'; import VueSlider from 'vue-slider-component'; +import { goToListSource, hasListSource } from '@/utils/playList'; export default { name: 'Player', @@ -217,22 +221,11 @@ export default { let sec = (~~(value % 60)).toString().padStart(2, '0'); return `${min}:${sec}`; }, + hasList() { + return hasListSource(); + }, goToList() { - if (this.player.playlistSource.id === this.data.likedSongPlaylistID) { - this.$router.push({ path: '/library/liked-songs' }); - } else if (this.player.playlistSource.type === 'url') { - this.$router.push({ path: this.player.playlistSource.id }); - } else if (this.player.playlistSource.type === 'cloudDisk') { - this.$router.push({ path: '/library' }); - } else { - this.$router.push({ - path: - '/' + - this.player.playlistSource.type + - '/' + - this.player.playlistSource.id, - }); - } + goToListSource(); }, goToAlbum() { if (this.player.currentTrack.al.id === 0) return; @@ -319,12 +312,14 @@ export default { opacity: 0.88; color: var(--color-text); margin-bottom: 4px; - cursor: pointer; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; word-break: break-all; + } + .hasList { + cursor: pointer; &:hover { text-decoration: underline; } diff --git a/src/utils/playList.js b/src/utils/playList.js new file mode 100644 index 0000000..f476f28 --- /dev/null +++ b/src/utils/playList.js @@ -0,0 +1,22 @@ +import router from '../router'; +import state from '../store/state'; + +export function hasListSource() { + return !state.player.isPersonalFM && state.player.playlistSource.id !== 0; +} + +export function goToListSource() { + router.push({ path: getListSourcePath() }); +} + +export function getListSourcePath() { + if (state.player.playlistSource.id === state.data.likedSongPlaylistID) { + return '/library/liked-songs'; + } else if (state.player.playlistSource.type === 'url') { + return state.player.playlistSource.id; + } else if (state.player.playlistSource.type === 'cloudDisk') { + return '/library'; + } else { + return `/${state.player.playlistSource.type}/${state.player.playlistSource.id}`; + } +} diff --git a/src/views/lyrics.vue b/src/views/lyrics.vue index 13d4cd5..41763f6 100644 --- a/src/views/lyrics.vue +++ b/src/views/lyrics.vue @@ -46,10 +46,14 @@
{{ currentTrack.name }} + + {{ currentTrack.name }} +