mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 11:42:34 +08:00
fix: bugs
This commit is contained in:
parent
3822b498a1
commit
b2f758f0c4
17
src/App.vue
17
src/App.vue
|
@ -11,18 +11,14 @@
|
|||
<Player
|
||||
v-if="this.$store.state.player.enabled"
|
||||
ref="player"
|
||||
v-show="
|
||||
['mv', 'loginUsername', 'login', 'loginAccount'].includes(
|
||||
this.$route.name
|
||||
) === false
|
||||
"
|
||||
v-show="showPlayer"
|
||||
/></transition>
|
||||
<Toast />
|
||||
<ModalAddTrackToPlaylist v-if="isAccountLoggedIn" />
|
||||
<ModalNewPlaylist v-if="isAccountLoggedIn" />
|
||||
<transition name="slide-up">
|
||||
<Lyrics v-show="this.$store.state.showLyrics" /> </transition
|
||||
>">
|
||||
<Lyrics v-show="this.$store.state.showLyrics" />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -55,6 +51,13 @@ export default {
|
|||
isAccountLoggedIn() {
|
||||
return isAccountLoggedIn();
|
||||
},
|
||||
showPlayer() {
|
||||
return (
|
||||
["mv", "loginUsername", "login", "loginAccount"].includes(
|
||||
this.$route.name
|
||||
) === false
|
||||
);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.isElectron) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
:src="currentTrack.al && currentTrack.al.picUrl | resizeImage(224)"
|
||||
@click="goToAlbum"
|
||||
/>
|
||||
<div class="track-info">
|
||||
<div class="track-info" :title="audioSource">
|
||||
<div class="name" @click="goToList">
|
||||
{{ currentTrack.name }}
|
||||
</div>
|
||||
|
@ -155,8 +155,8 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
setInterval(() => {
|
||||
this.progress = ~~this.player.seek();
|
||||
}, 500);
|
||||
this.progress = this.player.seek();
|
||||
}, 1000);
|
||||
if (isAccountLoggedIn()) {
|
||||
userLikedSongsIDs(this.data.user.userId).then((data) => {
|
||||
this.updateLikedSongs(data.ids);
|
||||
|
@ -186,6 +186,11 @@ export default {
|
|||
isCurrentTrackLiked() {
|
||||
return this.liked.songs.includes(this.currentTrack.id);
|
||||
},
|
||||
audioSource() {
|
||||
return this.player._howler?._src.includes("kuwo.cn")
|
||||
? "音源来自酷我音乐"
|
||||
: "";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["updateLikedSongs", "toggleLyrics"]),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class="track"
|
||||
:class="trackClass"
|
||||
:style="trackStyle"
|
||||
:title="track.reason"
|
||||
:title="showUnavailableSongInGreyStyle ? track.reason : ''"
|
||||
@mouseover="hover = true"
|
||||
@mouseleave="hover = false"
|
||||
>
|
||||
|
@ -147,6 +147,9 @@ export default {
|
|||
this.isMenuOpened
|
||||
);
|
||||
},
|
||||
showUnavailableSongInGreyStyle() {
|
||||
return this.$store.state.settings.showUnavailableSongInGreyStyle;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
goToAlbum() {
|
||||
|
|
|
@ -122,6 +122,11 @@ const router = new VueRouter({
|
|||
},
|
||||
});
|
||||
|
||||
const originalPush = VueRouter.prototype.push;
|
||||
VueRouter.prototype.push = function push(location) {
|
||||
return originalPush.call(this, location).catch((err) => err);
|
||||
};
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 需要登录的逻辑
|
||||
if (to.meta.requireLogin) {
|
||||
|
|
|
@ -24,6 +24,7 @@ let localStorage = {
|
|||
|
||||
if (process.env.IS_ELECTRON === true) {
|
||||
localStorage.settings.automaticallyCacheSongs = true;
|
||||
localStorage.settings.showUnavailableSongInGreyStyle = false;
|
||||
}
|
||||
|
||||
export default localStorage;
|
||||
|
|
|
@ -184,21 +184,18 @@ export default class {
|
|||
_getAudioSourceFromUnblockMusic(track) {
|
||||
if (process.env.IS_ELECTRON !== true) return null;
|
||||
const source = ipcRenderer.sendSync("unblock-music", track);
|
||||
if (store.state.settings.automaticallyCacheSongs && source?.url) {
|
||||
cacheTrack(track.id, source.url);
|
||||
}
|
||||
return source?.url;
|
||||
}
|
||||
_getAudioSource(track) {
|
||||
return this._getAudioSourceFromCache(String(track.id))
|
||||
.then((source) => {
|
||||
if (!source) return null;
|
||||
return source;
|
||||
return source ?? this._getAudioSourceFromNetease(track);
|
||||
})
|
||||
.then((source) => {
|
||||
if (source) return source;
|
||||
return this._getAudioSourceFromNetease(track);
|
||||
})
|
||||
.then((source) => {
|
||||
if (source) return source;
|
||||
return this._getAudioSourceFromUnblockMusic(track);
|
||||
return source ?? this._getAudioSourceFromUnblockMusic(track);
|
||||
});
|
||||
}
|
||||
_replaceCurrentTrack(
|
||||
|
@ -216,6 +213,7 @@ export default class {
|
|||
this._playAudioSource(source, autoplay);
|
||||
return source;
|
||||
} else {
|
||||
store.dispatch("showToast", `无法播放 ${track.name}`);
|
||||
ifUnplayableThen === "playNextTrack"
|
||||
? this.playNextTrack()
|
||||
: this.playPrevTrack();
|
||||
|
|
|
@ -22,16 +22,16 @@ export function isTrackPlayable(track) {
|
|||
}
|
||||
} else if (track.fee === 4 || track.privilege?.fee === 4) {
|
||||
result.playable = false;
|
||||
result.reason = "Paid Album";
|
||||
result.reason = "付费专辑";
|
||||
} else if (
|
||||
track.noCopyrightRcmd !== null &&
|
||||
track.noCopyrightRcmd !== undefined
|
||||
) {
|
||||
result.playable = false;
|
||||
result.reason = "No Copyright";
|
||||
result.reason = "无版权";
|
||||
} else if (track.privilege?.st < 0 && isAccountLoggedIn()) {
|
||||
result.playable = false;
|
||||
result.reason = "The song has been removed from the shelves";
|
||||
result.reason = "已下架";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
import store from "@/store";
|
||||
|
||||
export function initMediaSession() {
|
||||
if ("mediaSession" in navigator) {
|
||||
navigator.mediaSession.setActionHandler("play", function () {
|
||||
store.state.howler.play();
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("pause", function () {
|
||||
store.state.howler.pause();
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("previoustrack", function () {
|
||||
store.dispatch("previousTrack");
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("nexttrack", function () {
|
||||
store.dispatch("nextTrack");
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("stop", () => {
|
||||
store.state.howler.stop();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function updateMediaSessionMetaData(track) {
|
||||
if ("mediaSession" in navigator) {
|
||||
let artists = track.ar.map((a) => a.name);
|
||||
navigator.mediaSession.metadata = new window.MediaMetadata({
|
||||
title: track.name,
|
||||
artist: artists.join(","),
|
||||
album: track.al.name,
|
||||
artwork: [
|
||||
{
|
||||
src: track.al.picUrl + "?param=512y512",
|
||||
type: "image/jpg",
|
||||
sizes: "512x512",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
|
@ -198,9 +198,6 @@ export default {
|
|||
...mapMutations(["appendTrackToPlayerList"]),
|
||||
...mapActions(["playFirstTrackOnList", "playTrackOnListByID", "showToast"]),
|
||||
playAlbumByID(id, trackID = "first") {
|
||||
if (this.tracks.find((t) => t.playable !== false) === undefined) {
|
||||
return;
|
||||
}
|
||||
this.$store.state.player.playAlbumByID(id, trackID);
|
||||
},
|
||||
likeAlbum(toast = false) {
|
||||
|
|
|
@ -106,9 +106,9 @@
|
|||
<div class="section-title">相似歌手</div>
|
||||
<CoverRow
|
||||
type="artist"
|
||||
:columnNumber="7"
|
||||
:columnNumber="6"
|
||||
gap="36px 28px"
|
||||
:items="similarArtists.slice(0, 14)"
|
||||
:items="similarArtists.slice(0, 12)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -118,7 +118,7 @@ export default {
|
|||
this.player = new Plyr(this.$refs.videoPlayer, videoOptions);
|
||||
this.player.volume = this.$store.state.player.volume;
|
||||
this.player.on("playing", () => {
|
||||
this.$store.state.howler.pause();
|
||||
this.$store.state.player.pause();
|
||||
});
|
||||
this.getData(this.$route.params.id);
|
||||
console.log("网易云你这mv音频码率也太糊了吧🙄");
|
||||
|
|
Loading…
Reference in New Issue
Block a user