Skip to content
Snippets Groups Projects
Commit d64e0233 authored by 张 达's avatar 张 达
Browse files

添加艺人组件

修复不同播放键状态不一致的问题
新增歌曲添加至我喜欢的歌曲的功能
parent 7fca645f
No related branches found
No related tags found
No related merge requests found
......@@ -7,4 +7,5 @@ export const COMMENT_MODULE = `${API_MODULE}/comments`
export const MANAGER_MODULE = `${API_MODULE}/manager`
export const SHARE_MODULE = `${API_MODULE}/share`
export const SEARCH_MODULE = `${API_MODULE}/search`
export const RESOLVE_MODULE = `${API_MODULE}/resolve`
\ No newline at end of file
export const RESOLVE_MODULE = `${API_MODULE}/resolve`
export const ARTIST_MODULE = `${API_MODULE}/artist`
\ No newline at end of file
import {axios} from '../utils/request';
import {ARTIST_MODULE} from './_prefix';
export const getArtistInfo = (artistName) => {
const encodedName = encodeURIComponent(artistName);
return axios.get(`${ARTIST_MODULE}/search/${encodedName}`)
.then(res => res);
};
export const getSongsByArtist = (artistName) => {
const encodedName = encodeURIComponent(artistName);
return axios.get(`${ARTIST_MODULE}/songs/${encodedName}`)
.then(res => res);
};
\ No newline at end of file
......@@ -56,12 +56,19 @@ export const modifyPlaylist = (playlistModifyInfo) => {
+ playlist_id: number
+ song_id: number
*/
export const addSongToPlaylist = (songInfo) => {
return axios.post(`${PLAYLIST_MODULE}/addSong`, songInfo,
{ headers: { 'Content-Type': 'application/json' } })
.then(res => {
return res;
});
export const addSongToPlaylist = (addInfo) => {
return axios.post(`${PLAYLIST_MODULE}/addSong`, null, {
params: {
user_id: addInfo.user_id,
playlist_id: addInfo.playlist_id,
song_id: addInfo.song_id
},
headers: {
'Content-Type': 'application/json'
}
}).then(res => {
return res;
});
}
/*
......
This diff is collapsed.
......@@ -8,7 +8,7 @@ import {backgroundColor, updateBackground} from "../utils/getBackgroundColor";
import pauseButton from "../icon/pauseButton.vue";
import {modifyPlaylist, removePlaylist, removeSongFromPlaylist} from "../api/playlist";
const emit = defineEmits();
const emit = defineEmits(['pauseSong']);
const props = defineProps({
albumInfo: { // 类型 :id, userid, title ,description ,picPath,createTime,updateTime,songNum
type: Object,
......@@ -19,7 +19,8 @@ const props = defineProps({
required: true,
},
playFromLeftBar: null,
currentSongId: Number
currentSongId: Number,
isPaused: Boolean,
});
const edit_title = ref("");
......@@ -216,6 +217,15 @@ const playFromId = (musicId) => {
emit('switchSongs', props.albumInfo, musicPlayIndex.value);
musicPauseIndex = null;
}
watch(() => props.isPaused, (newValue) => {
if (newValue) {
musicPauseIndex = musicPlayIndex;
} else {
musicPauseIndex = null;
}
});
const addToFavorite = (musicId) => {
}
const removeMusicFromAlbum = (albumId, songId) => {
......@@ -226,11 +236,13 @@ const removeMusicFromAlbum = (albumId, songId) => {
}
const enterMusicDescription = (musicId) => {
}
const enterAuthorDescription = (authorName) => {
const enterAuthorDescription = (artistName) => {
emit('switchToArtist', artistName);
}
const pauseMusic = (musicId) => {
musicPauseIndex = musicId;
emit('pauseSong');
}
const editAlbumDescription = (albumId) => {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment