큐레이션 - 조회, 등록, 수정
- 탭 추가
This commit is contained in:
		| @@ -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) { | ||||
|   | ||||
| @@ -10,11 +10,25 @@ | ||||
|  | ||||
|     <v-container> | ||||
|       <v-row> | ||||
|         <v-col cols="10" /> | ||||
|         <v-col cols="9"> | ||||
|           <v-radio-group | ||||
|             v-model="selected_tab_id" | ||||
|             row | ||||
|             @change="getCurations" | ||||
|           > | ||||
|             <v-radio | ||||
|               v-for="tab in tabs" | ||||
|               :key="tab.tabId" | ||||
|               :label="tab.title" | ||||
|               :value="tab.tabId" | ||||
|             /> | ||||
|           </v-radio-group> | ||||
|         </v-col> | ||||
|         <v-spacer /> | ||||
|         <v-col> | ||||
|           <v-btn | ||||
|             block | ||||
|             color="#9970ff" | ||||
|             color="#3bb9f1" | ||||
|             dark | ||||
|             depressed | ||||
|             @click="showWriteDialog" | ||||
| @@ -103,6 +117,26 @@ | ||||
|           <v-card-title v-else> | ||||
|             콘텐츠 큐레이션 등록 | ||||
|           </v-card-title> | ||||
|           <v-card-text> | ||||
|             <v-row align="center"> | ||||
|               <v-col cols="4"> | ||||
|                 메인 탭 | ||||
|               </v-col> | ||||
|               <v-col cols="8"> | ||||
|                 <v-radio-group | ||||
|                   v-model="curation.tab_id" | ||||
|                   row | ||||
|                 > | ||||
|                   <v-radio | ||||
|                     v-for="tab in tabs" | ||||
|                     :key="tab.tabId" | ||||
|                     :label="tab.title" | ||||
|                     :value="tab.tabId" | ||||
|                   /> | ||||
|                 </v-radio-group> | ||||
|               </v-col> | ||||
|             </v-row> | ||||
|           </v-card-text> | ||||
|           <v-card-text> | ||||
|             <v-row align="center"> | ||||
|               <v-col cols="4"> | ||||
| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung