mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-25 17:56:39 +08:00
fix: bug #578
This commit is contained in:
parent
fa9acc9c89
commit
1f02f6c71f
|
@ -30,7 +30,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapMutations, mapState } from 'vuex';
|
import { mapActions, mapMutations, mapState } from 'vuex';
|
||||||
import Modal from '@/components/Modal.vue';
|
import Modal from '@/components/Modal.vue';
|
||||||
import { userPlaylist } from '@/api/user';
|
|
||||||
import { addOrRemoveTrackFromPlaylist } from '@/api/playlist';
|
import { addOrRemoveTrackFromPlaylist } from '@/api/playlist';
|
||||||
import { disableScrolling, enableScrolling } from '@/utils/ui';
|
import { disableScrolling, enableScrolling } from '@/utils/ui';
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['modals', 'data']),
|
...mapState(['modals', 'data', 'liked']),
|
||||||
show: {
|
show: {
|
||||||
get() {
|
get() {
|
||||||
return this.modals.addTrackToPlaylistModal.show;
|
return this.modals.addTrackToPlaylistModal.show;
|
||||||
|
@ -64,31 +63,19 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ownPlaylists() {
|
ownPlaylists() {
|
||||||
return this.playlists.filter(
|
return this.liked.playlists.filter(
|
||||||
p =>
|
p =>
|
||||||
p.creator.userId === this.data.user.userId &&
|
p.creator.userId === this.data.user.userId &&
|
||||||
p.id !== this.data.likedSongPlaylistID
|
p.id !== this.data.likedSongPlaylistID
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.getUserPlaylists();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateModal']),
|
...mapMutations(['updateModal']),
|
||||||
...mapActions(['showToast']),
|
...mapActions(['showToast']),
|
||||||
close() {
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
},
|
},
|
||||||
getUserPlaylists() {
|
|
||||||
userPlaylist({
|
|
||||||
timestamp: new Date().getTime(),
|
|
||||||
limit: 1000,
|
|
||||||
uid: this.data.user.userId,
|
|
||||||
}).then(data => {
|
|
||||||
this.playlists = data.playlist;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addTrackToPlaylist(playlistID) {
|
addTrackToPlaylist(playlistID) {
|
||||||
addOrRemoveTrackFromPlaylist({
|
addOrRemoveTrackFromPlaylist({
|
||||||
op: 'add',
|
op: 'add',
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Modal from '@/components/Modal.vue';
|
import Modal from '@/components/Modal.vue';
|
||||||
import { mapMutations, mapState } from 'vuex';
|
import { mapMutations, mapState, mapActions } from 'vuex';
|
||||||
import { createPlaylist, addOrRemoveTrackFromPlaylist } from '@/api/playlist';
|
import { createPlaylist, addOrRemoveTrackFromPlaylist } from '@/api/playlist';
|
||||||
import { disableScrolling, enableScrolling } from '@/utils/ui';
|
import { disableScrolling, enableScrolling } from '@/utils/ui';
|
||||||
|
|
||||||
|
@ -66,7 +66,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateModal']),
|
...mapMutations(['updateModal', 'updateData']),
|
||||||
|
...mapActions(['showToast', 'fetchLikedPlaylist']),
|
||||||
close() {
|
close() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.title = '';
|
this.title = '';
|
||||||
|
@ -94,6 +95,8 @@ export default {
|
||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
this.showToast('成功创建歌单');
|
this.showToast('成功创建歌单');
|
||||||
|
this.updateData({ key: 'libraryPlaylistFilter', value: 'mine' });
|
||||||
|
this.fetchLikedPlaylist();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user