feat: enhance (#1016)

This commit is contained in:
Hawtim 2021-10-28 01:09:00 +08:00 committed by GitHub
parent 9b565c41c2
commit ee59479ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 12 deletions

View file

@ -53,6 +53,7 @@
<input
ref="searchInput"
v-model="keywords"
type="search"
:placeholder="inputFocus ? '' : $t('nav.search')"
@keydown.enter="doSearch"
@focus="inputFocus = true"

View file

@ -60,7 +60,9 @@
</div>
<div v-if="showAlbumName" class="album">
<router-link :to="`/album/${album.id}`">{{ album.name }}</router-link>
<router-link v-if="album && album.id" :to="`/album/${album.id}`">{{
album.name
}}</router-link>
<div></div>
</div>
@ -85,6 +87,7 @@
import ArtistsInLine from '@/components/ArtistsInLine.vue';
import ExplicitSymbol from '@/components/ExplicitSymbol.vue';
import { mapState } from 'vuex';
import { isNil } from 'lodash';
export default {
name: 'TrackListItem',
@ -117,8 +120,9 @@ export default {
return image + '?param=224y224';
},
artists() {
if (this.track.ar !== undefined) return this.track.ar;
if (this.track.artists !== undefined) return this.track.artists;
const { ar, artists } = this.track;
if (!isNil(ar)) return ar;
if (!isNil(artists)) return artists;
return [];
},
album() {

View file

@ -100,7 +100,7 @@ export default {
if (!isLooseLoggedIn()) return;
if (isAccountLoggedIn()) {
return userPlaylist({
uid: state.data.user.userId,
uid: state.data.user?.userId,
limit: 2000, // 最多只加载2000个歌单等有用户反馈问题再修
timestamp: new Date().getTime(),
}).then(result => {

View file

@ -235,7 +235,9 @@ export default class {
});
if (autoplay) {
this.play();
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
if (this._currentTrack.name) {
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
}
}
this.setOutputDevice();
this._howler.once('end', () => {
@ -485,7 +487,9 @@ export default class {
if (this._howler?.playing()) return;
this._howler?.play();
this._playing = true;
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
if (this._currentTrack.name) {
document.title = `${this._currentTrack.name} · ${this._currentTrack.ar[0].name} - YesPlayMusic`;
}
this._playDiscordPresence(this._currentTrack, this.seek());
if (store.state.lastfm.key !== undefined) {
trackUpdateNowPlaying({