diff --git a/src/api/track.js b/src/api/track.js index 1fe0be9..1b50eea 100644 --- a/src/api/track.js +++ b/src/api/track.js @@ -3,7 +3,8 @@ import request from "@/utils/request"; import { mapTrackPlayableStatus } from "@/utils/common"; /** * 获取音乐 url - * 说明 : 使用歌单详情接口后 , 能得到的音乐的 id, 但不能得到的音乐 url, 调用此接口, 传入的音乐 id( 可多个 , 用逗号隔开 ), 可以获取对应的音乐的 url,未登录状态返回试听片段(返回字段包含被截取的正常歌曲的开始时间和结束时间) + * 说明 : 使用歌单详情接口后 , 能得到的音乐的 id, 但不能得到的音乐 url, 调用此接口, 传入的音乐 id( 可多个 , 用逗号隔开 ), 可以获取对应的音乐的 url, + * !!!未登录状态返回试听片段(返回字段包含被截取的正常歌曲的开始时间和结束时间) * @param {string} id - 音乐的 id,例如 id=405998841,33894312 */ export function getMP3(id) { diff --git a/src/components/Player.vue b/src/components/Player.vue index 12f661e..53c84fe 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -36,7 +36,8 @@ -
+ +
import { updateMediaSessionMetaData } from "@/utils/mediaSession"; import { mapState, mapMutations, mapActions } from "vuex"; -import { isLoggedIn } from "@/utils/auth"; +import { isAccountLoggedIn } from "@/utils/auth"; import { userLikedSongsIDs } from "@/api/user"; import { likeATrack } from "@/api/track"; import "@/assets/css/slider.css"; @@ -144,14 +145,14 @@ export default { setInterval(() => { this.progress = ~~this.howler.seek(); }, 1000); - if (this.isLoggedIn) { + if (isAccountLoggedIn()) { userLikedSongsIDs(this.settings.user.userId).then((data) => { this.updateLikedSongs(data.ids); }); } }, computed: { - ...mapState(["player", "howler", "settings", "liked"]), + ...mapState(["player", "howler", "settings", "liked", "accountLogin"]), currentTrack() { return this.player.currentTrack; }, @@ -174,9 +175,6 @@ export default { let max = ~~(this.currentTrack.dt / 1000); return max > 1 ? max - 1 : max; }, - isLoggedIn() { - return isLoggedIn(); - }, }, methods: { ...mapMutations([ diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue index bb574ae..ab44583 100644 --- a/src/components/TrackListItem.vue +++ b/src/components/TrackListItem.vue @@ -60,7 +60,7 @@
-
+ +
{{ $t("login.confirm") }} + {{ $t("login.confirm") }} +
@@ -73,7 +74,7 @@ export default { NProgress.done(); }, methods: { - ...mapMutations(["updateUser", "updateUserInfo"]), + ...mapMutations(["updateUser", "updateUserInfo", "updateUsernameLogin"]), search() { if (!this.keyword) return; search({ keywords: this.keyword, limit: 9, type: 1002 }).then((data) => { @@ -83,6 +84,7 @@ export default { }, confirm() { this.updateUser(this.activeUser); + this.updateUsernameLogin(true); Cookies.set("loginMode", "username", { expires: 3650 }); userPlaylist({ uid: this.activeUser.userId, diff --git a/src/views/playlist.vue b/src/views/playlist.vue index cf3d9c2..f7a6e59 100644 --- a/src/views/playlist.vue +++ b/src/views/playlist.vue @@ -46,7 +46,7 @@