diff --git a/ruoyi-ui/src/api/content/recommend.js b/ruoyi-ui/src/api/content/recommend.js new file mode 100644 index 0000000..4a4b7b2 --- /dev/null +++ b/ruoyi-ui/src/api/content/recommend.js @@ -0,0 +1,84 @@ +import request from '@/utils/request' + +// 查询推荐列表 +export function listRecommend(query) { + return request({ + url: '/back/re/list', + method: 'get', + params: query + }) +} + +// 查询推荐详细 +export function getRecommend(id) { + return request({ + url: '/back/re/' + id, + method: 'get' + }) +} + +// 新增推荐 +export function addRecommend(data) { + const formData = new FormData() + formData.append('name', data.name) + if (data.file) { + formData.append('file', data.file) + } + if (data.backImg) { + formData.append('backImg', data.backImg) + } + return request({ + url: '/back/re', + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 修改推荐 +export function updateRecommend(data) { + const formData = new FormData() + formData.append('id', data.id) + formData.append('name', data.name) + if (data.file) { + formData.append('file', data.file) + } + if (data.backImg) { + formData.append('backImg', data.backImg) + } + return request({ + url: '/back/re/update', + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 删除推荐 +export function delRecommend(id) { + return request({ + url: '/back/re/' + id, + method: 'delete' + }) +} + +// 获取推荐已绑定的音乐 +export function getRecommendBoundMusic(recommendId) { + return request({ + url: `/back/re/cate/music/${recommendId}`, + method: 'get' + }) +} + +// 绑定音乐到推荐 +export function bindMusicToRecommend(recommendId, musicIds) { + return request({ + url: `/back/re/bind/${recommendId}/${musicIds.join(',')}`, + method: 'put', + baseURL: 'http://60.205.107.210:8080' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/content/recommend/index.vue b/ruoyi-ui/src/views/content/recommend/index.vue new file mode 100644 index 0000000..bee5647 --- /dev/null +++ b/ruoyi-ui/src/views/content/recommend/index.vue @@ -0,0 +1,476 @@ + + + + +