fix: ask before remove track from playlist

master
qier222 4 years ago
parent 80a324524a
commit 70ef845572

@ -11,19 +11,20 @@
<hr /> <hr />
<div class="item" @click="play">{{ $t("contextMenu.play") }}</div> <div class="item" @click="play">{{ $t("contextMenu.play") }}</div>
<div class="item" @click="playNext">{{ $t("contextMenu.playNext") }}</div> <div class="item" @click="playNext">{{ $t("contextMenu.playNext") }}</div>
<hr />
<div class="item" @click="like" v-show="!isRightClickedTrackLiked"> <div class="item" @click="like" v-show="!isRightClickedTrackLiked">
{{ $t("contextMenu.saveToMyLikedSongs") }} {{ $t("contextMenu.saveToMyLikedSongs") }}
</div> </div>
<div class="item" @click="like" v-show="isRightClickedTrackLiked"> <div class="item" @click="like" v-show="isRightClickedTrackLiked">
{{ $t("contextMenu.removeFromMyLikedSongs") }} {{ $t("contextMenu.removeFromMyLikedSongs") }}
</div> </div>
<div class="item" @click="addTrackToPlaylist"></div>
<div <div
v-if="extraContextMenuItem.includes('removeTrackFromPlaylist')" v-if="extraContextMenuItem.includes('removeTrackFromPlaylist')"
class="item" class="item"
@click="removeTrackFromPlaylist" @click="removeTrackFromPlaylist"
>从歌单中删除</div >从歌单中删除</div
> >
<div class="item" @click="addTrackToPlaylist"></div>
</ContextMenu> </ContextMenu>
<TrackListItem <TrackListItem
v-for="track in tracks" v-for="track in tracks"
@ -195,17 +196,19 @@ export default {
this.showToast("此操作需要登录网易云账号"); this.showToast("此操作需要登录网易云账号");
return; return;
} }
let trackID = this.rightClickedTrack.id; if (confirm(`确定要从歌单删除 ${this.rightClickedTrack.name}`)) {
addOrRemoveTrackFromPlaylist({ let trackID = this.rightClickedTrack.id;
op: "del", addOrRemoveTrackFromPlaylist({
pid: this.id, op: "del",
tracks: trackID, pid: this.id,
}).then((data) => { tracks: trackID,
this.showToast( }).then((data) => {
data.body.code === 200 ? "已从歌单中删除" : data.body.message this.showToast(
); data.body.code === 200 ? "已从歌单中删除" : data.body.message
this.$parent.removeTrack(trackID); );
}); this.$parent.removeTrack(trackID);
});
}
}, },
}, },
}; };

Loading…
Cancel
Save