From de2f89bff1affd3ac73b53b214b57203887b326f Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 3 Feb 2025 20:52:23 +0900 Subject: [PATCH] =?UTF-8?q?=ED=81=90=EB=A0=88=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/audio_content.js | 33 +- src/views/Content/ContentCuration.vue | 1 - src/views/Content/ContentCurationDetail.vue | 520 +++++++++++++++++++- 3 files changed, 550 insertions(+), 4 deletions(-) diff --git a/src/api/audio_content.js b/src/api/audio_content.js index 09f44ac..aeb8bc8 100644 --- a/src/api/audio_content.js +++ b/src/api/audio_content.js @@ -67,6 +67,32 @@ async function getAudioContentMainTabList() { return Vue.axios.get("/admin/audio-content/main/tab") } +async function getCurationItems(curationId) { + return Vue.axios.get("/admin/audio-content/curation/items?curationId=" + curationId) +} + +async function searchContentItem(curationId, searchWord) { + return Vue.axios.get("/admin/audio-content/curation/search/content?curationId=" + curationId + "&searchWord=" + searchWord) +} + +async function searchSeriesItem(curationId, searchWord) { + return Vue.axios.get("/admin/audio-content/curation/search/series?curationId=" + curationId + "&searchWord=" + searchWord) +} + +async function addItemToCuration(curationId, itemIdList){ + return Vue.axios.post( + "/admin/audio-content/curation/add/item", + {curationId: curationId, itemIdList: itemIdList} + ) +} + +async function removeItemInCuration(curationId, itemId){ + return Vue.axios.put( + "/admin/audio-content/curation/remove/item", + {curationId: curationId, itemId: itemId} + ) +} + export { getAudioContentList, searchAudioContent, @@ -80,5 +106,10 @@ export { modifyCuration, updateCurationOrders, getAudioContentThemeList, - getAudioContentMainTabList + getAudioContentMainTabList, + getCurationItems, + searchSeriesItem, + searchContentItem, + addItemToCuration, + removeItemInCuration } diff --git a/src/views/Content/ContentCuration.vue b/src/views/Content/ContentCuration.vue index 9deae66..f57eec5 100644 --- a/src/views/Content/ContentCuration.vue +++ b/src/views/Content/ContentCuration.vue @@ -358,7 +358,6 @@ export default { }, handleItemClick(item) { - console.log(item) this.$router.push( { name: 'ContentCurationDetail', diff --git a/src/views/Content/ContentCurationDetail.vue b/src/views/Content/ContentCurationDetail.vue index c0e7217..1d89fcb 100644 --- a/src/views/Content/ContentCurationDetail.vue +++ b/src/views/Content/ContentCurationDetail.vue @@ -17,7 +17,6 @@ 19금 :
@@ -27,6 +26,29 @@ X
+ + + + 시리즈 등록 + + + 콘텐츠 등록 + + + + + + + + + + + + + + 콘텐츠 추가 + + + + + 검색 + + + + + + + 검색결과 + + + + + + 추가할 콘텐츠 + + + + + + + + + + 취소 + + + 추가 + + + + + + + + + 시리즈 추가 + + + + + 검색 + + + + + + + 검색결과 + + + + + + 추가할 시리즈 + + + + + + + + + + 취소 + + + 추가 + + + + + + + + + + {{ selected_item.title }} 삭제하시겠습니까? + + + 삭제하시겠습니까? + + + + + 취소 + + + 확인 + + + + @@ -68,8 +419,16 @@ export default { is_series: false, is_adult: false, - show_write_dialog: false, + items: [], + + show_add_series_dialog: false, + show_add_content_dialog: false, show_delete_confirm_dialog: false, + + search_word: '', + selected_item: null, + add_item_list: [], + search_item_list: [], } }, @@ -79,6 +438,163 @@ export default { this.curation_description = this.$route.params.description this.is_series = this.$route.params.is_series this.is_adult = this.$route.params.is_adult + await this.getCurationItems() + }, + + methods: { + notifyError(message) { + this.$dialog.notify.error(message) + }, + + notifySuccess(message) { + this.$dialog.notify.success(message) + }, + + cancel() { + this.search_word = '' + this.add_item_list = [] + this.search_item_list = [] + this.selected_item = null + this.show_add_series_dialog = false + this.show_add_content_dialog = false + this.show_delete_confirm_dialog = false + }, + + deleteConfirm(item) { + this.selected_item = item + this.show_delete_confirm_dialog = true + }, + + showAddContent() { + this.show_add_content_dialog = true + }, + + showAddSeries() { + this.show_add_series_dialog = true + }, + + addItem(item) { + this.search_item_list = this.search_item_list.filter((t) => { + return t.id !== item.id + }); + this.add_item_list.push(item) + }, + + removeItem(item) { + this.add_item_list = this.add_item_list.filter((t) => { + return t.id !== item.id + }); + this.search_item_list.push(item) + }, + + async searchContentItem() { + if (this.search_word.length < 2) { + this.notifyError('검색어를 2글자 이상 입력하세요.') + return + } + + this.is_loading = true + + try { + const res = await api.searchContentItem(this.curation_id, this.search_word) + + if (res.data.success === true) { + this.search_item_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 searchSeriesItem() { + if (this.search_word.length < 2) { + this.notifyError('검색어를 2글자 이상 입력하세요.') + return + } + + this.is_loading = true + + try { + const res = await api.searchSeriesItem(this.curation_id, this.search_word) + + if (res.data.success === true) { + this.search_item_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 addItemInCuration() { + this.is_loading = true + const itemIdList = this.add_item_list.map((item) => { + return item.id + }) + + try { + const res = await api.addItemToCuration(this.curation_id, itemIdList) + + if (res.status === 200 && res.data.success === true) { + this.cancel() + await this.getCurationItems() + } else { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + + async removeItemInCuration() { + this.is_loading = true + + try { + const res = await api.removeItemInCuration(this.curation_id, this.selected_item.id) + if (res.status === 200 && res.data.success === true) { + this.cancel() + await this.getCurationItems() + } else { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + + async getCurationItems() { + this.is_loading = true + + try { + const res = await api.getCurationItems(this.curation_id) + if (res.status === 200 && res.data.success === true) { + this.items = res.data.data + } else { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, }, }