diff --git a/src/api/audio_content.js b/src/api/audio_content.js index c171395..09f44ac 100644 --- a/src/api/audio_content.js +++ b/src/api/audio_content.js @@ -43,8 +43,8 @@ async function updateBannerOrders(ids) { return Vue.axios.put('/admin/audio-content/banner/orders', {ids: ids}) } -async function getCurations() { - return Vue.axios.get("/admin/audio-content/curation") +async function getCurations(tabId) { + return Vue.axios.get("/admin/audio-content/curation?tabId=" + tabId) } async function saveCuration(request) { diff --git a/src/views/Content/ContentCuration.vue b/src/views/Content/ContentCuration.vue index ddc8558..4c53e3f 100644 --- a/src/views/Content/ContentCuration.vue +++ b/src/views/Content/ContentCuration.vue @@ -10,11 +10,25 @@ - + + + + + + 콘텐츠 큐레이션 등록 + + + + 메인 탭 + + + + + + + + @@ -222,6 +256,8 @@ export default { selected_curation: {}, curation: {is_adult: false}, curations: [], + tabs: [], + selected_tab_id: 1, headers: [ { text: '제목', @@ -252,7 +288,7 @@ export default { }, async created() { - await this.getCurations() + await this.getAudioContentMainTabList() }, methods: { @@ -273,6 +309,7 @@ export default { this.selected_curation = item this.curation.id = item.id + this.curation.tab_id = item.tabId this.curation.title = item.title this.curation.description = item.description this.curation.is_adult = item.isAdult @@ -289,6 +326,15 @@ export default { }, validate() { + if ( + this.curation.tab_id === null || + this.curation.tab_id === undefined || + this.curation.tab_id <= 0 + ) { + this.notifyError("메인 탭을 선택하세요") + return false + } + if ( this.curation.title === null || this.curation.title === undefined || @@ -320,6 +366,27 @@ export default { this.show_delete_confirm_dialog = false }, + async getAudioContentMainTabList() { + this.is_loading = true + + try { + const res = await api.getAudioContentMainTabList() + if (res.status === 200 && res.data.success === true) { + const data = res.data.data + + this.tabs = data.filter(item => item.title !== '홈' && item.title !== '단편') + this.selected_tab_id = this.tabs[0].tabId + await this.getCurations() + } else { + this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + async submit() { if (!this.validate()) return; if (this.is_loading) return; @@ -328,6 +395,7 @@ export default { try { const request = { + tabId: this.curation.tab_id, title: this.curation.title, description: this.curation.description, isAdult: this.curation.is_adult @@ -357,6 +425,10 @@ export default { try { let request = {id: this.curation.id} + if (this.selected_curation.tab_id !== this.curation.tab_id) { + request.tabId = this.curation.tab_id + } + if (this.selected_curation.title !== this.curation.title && this.curation.title.trim().length > 0) { request.title = this.curation.title } @@ -439,7 +511,7 @@ export default { this.is_loading = true try { - const res = await api.getCurations() + const res = await api.getCurations(this.selected_tab_id) if (res.status === 200 && res.data.success === true) { this.curations = res.data.data } else {