diff --git a/src/api/audio_content_series.js b/src/api/audio_content_series.js index a2c19c5..b7bfbe6 100644 --- a/src/api/audio_content_series.js +++ b/src/api/audio_content_series.js @@ -34,6 +34,13 @@ async function getSeriesContent(seriesId, page) { ); } +async function searchContentNotInSeries(seriesId, searchWord) { + return Vue.axios.get( + "/creator-admin/audio-content/series/content/search?series_id=" + seriesId + + "&search_word=" + searchWord + ) +} + async function addingContentToTheSeries(seriesId, contentIdList) { return Vue.axios.post( "/creator-admin/audio-content/series/add/content", @@ -56,5 +63,6 @@ export { getSeriesDetail, getSeriesContent, addingContentToTheSeries, - removeContentInTheSeries + removeContentInTheSeries, + searchContentNotInSeries } diff --git a/src/views/Content/ContentSeriesDetail.vue b/src/views/Content/ContentSeriesDetail.vue index b0263b7..2810713 100644 --- a/src/views/Content/ContentSeriesDetail.vue +++ b/src/views/Content/ContentSeriesDetail.vue @@ -12,7 +12,8 @@ 제목 : {{ series_detail.title }} - 소개 : @@ -42,27 +43,18 @@ - - + + 콘텐츠 추가 - - - 콘텐츠 등록 - - @@ -91,9 +83,9 @@ > @@ -110,7 +102,7 @@ 삭제 @@ -119,6 +111,20 @@ +

+ + + + +
+ + + + 콘텐츠 추가 + + + + + 검색 + + + + + + + 검색결과 + + + + + + 추가할 콘텐츠 + + + + + + + + + + 취소 + + + 추가 + + + + + + + + + + {{ selected_series_content.title }} 삭제하시겠습니까? + + + 삭제하시겠습니까? + + + + + 취소 + + + 확인 + + + + + 0) { + await this.getSeriesDetail() + await this.getSeriesContentList() + } else { + this.$router.go(-1); + } }, methods: { @@ -184,6 +345,91 @@ export default { this.$dialog.notify.success(message) }, + cancel() { + this.search_word = '' + this.add_content_list = [] + this.search_content_list = [] + this.selected_series_content = null + this.show_add_series_content = false + this.show_delete_confirm_dialog = false + }, + + deleteConfirm(series_content) { + this.selected_series_content = series_content + this.show_delete_confirm_dialog = true + }, + + deleteCancel() { + this.cancel(); + }, + + showAddContent() { + this.show_add_series_content = true + }, + + addContent(content) { + this.search_content_list = this.search_content_list.filter((item) => { + return item.contentId !== content.contentId + }); + this.add_content_list.push(content) + }, + + removeContent(content) { + this.add_content_list = this.add_content_list.filter((item) => { + return item.contentId !== content.contentId + }); + this.search_content_list.push(content) + }, + + async searchContentNotInSeries() { + if (this.search_word.length < 2) { + this.notifyError('검색어를 2글자 이상 입력하세요.') + return + } + + this.is_loading = true + + try { + const res = await api.searchContentNotInSeries(this.series_id, this.search_word) + + if (res.data.success === true) { + this.search_content_list = res.data.data + if (res.data.data.length <= 0) { + this.notifyError('검색결과가 없습니다.') + } + } else { + this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + + async addContentInSeries() { + this.is_loading = true + const contentIdList = this.add_content_list.map((item) => { + return item.contentId + }) + + try { + const res = await api.addingContentToTheSeries(this.series_id, contentIdList) + if (res.status === 200 && res.data.success === true) { + this.cancel() + this.page = 1 + this.total_page = 0 + await this.getSeriesContentList() + } else { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + async getSeriesDetail() { this.is_loading = true @@ -201,6 +447,10 @@ export default { } }, + async next() { + await this.getSeriesContentList() + }, + async getSeriesContentList() { try { const res = await api.getSeriesContent(this.series_id, this.page) @@ -221,16 +471,17 @@ export default { } }, - async removeContentInSeries(content) { + async removeContentInSeries() { this.is_loading = true try { - const res = await api.removeContentInTheSeries(this.series_id, content.contentId) + const res = await api.removeContentInTheSeries(this.series_id, this.selected_series_content.contentId) if (res.status === 200 && res.data.success === true) { this.page = 1 this.total_page = 0 this.series_content_list = [] + this.cancel() this.notifySuccess('삭제되었습니다.') await this.getSeriesContentList() } else { @@ -255,6 +506,10 @@ export default { aspect-ratio: 1/1.4; } +.content-cover-image { + aspect-ratio: 1; +} + .no-series-content { height: 50vh; margin-top: 100px;