diff --git a/src/api/audio_content.js b/src/api/audio_content.js index f24d1af..767930f 100644 --- a/src/api/audio_content.js +++ b/src/api/audio_content.js @@ -31,9 +31,14 @@ async function createAudioContent(formData) { }); } +async function getAudioContentThemeList() { + return Vue.axios.get("/audio-content/theme") +} + export { createAudioContent, getAudioContentList, searchAudioContent, - modifyAudioContent + modifyAudioContent, + getAudioContentThemeList } diff --git a/src/views/Content/ContentList.vue b/src/views/Content/ContentList.vue index b110b23..3485bea 100644 --- a/src/views/Content/ContentList.vue +++ b/src/views/Content/ContentList.vue @@ -9,6 +9,20 @@
+ + + + + 콘텐츠 등록 + + + @@ -63,7 +77,6 @@ max-width="100" max-height="100" :src="item.coverImageUrl" - class="rounded-circle" /> {{ item.title }} @@ -149,11 +162,12 @@
@@ -194,7 +208,7 @@ - 19금 + 연령제한 + + + + + 콘텐츠 등록 + +
+ + +
+ +
+ + + + + + + + +
+ + + + 제목 + + + + + + + + + + 내용 + + + + + + + + + + 태그 + + + + + + + + + + 테마 + + + + + + + + + + 가격 + + + + + + + + + + 연령제한 + + + + + + + + + + 댓글 가능 + + + + + + + + + + 취소 + + + 등록 + + +
+
+
+ { + return {name: item.theme, value: item.id} + }) + } else { + this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + + this.is_loading = false + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + this.is_loading = false + } + }, + + async save() { + if ( + this.audio_content.title === null || + this.audio_content.title === undefined || + this.audio_content.title.trim().length <= 0 + ) { + this.notifyError("제목을 입력하세요") + return + } + + if ( + this.audio_content.detail === null || + this.audio_content.detail === undefined || + this.audio_content.detail.trim().length <= 0 + ) { + this.notifyError("내용을 입력하세요") + return + } + + if ( + this.audio_content.theme_id === null || + this.audio_content.theme_id === undefined || + this.audio_content.theme_id <= 0 + ) { + this.notifyError("테마를 선택하세요") + return + } + + if (this.is_loading) return; + + this.isLoading = true + + try { + const formData = new FormData() + const request = { + title: this.audio_content.title, + detail: this.audio_content.detail, + tags: this.audio_content.tags, + price: this.audio_content.price, + themeId: this.audio_content.theme_id, + isAdult: this.audio_content.is_adult, + isCommentAvailable: this.audio_content.is_comment_available, + } + + formData.append("coverImage", this.audio_content.cover_image) + formData.append("contentFile", this.audio_content.content_file) + formData.append("request", JSON.stringify(request)) + + const res = await api.createAudioContent(formData) + if (res.status === 200 && res.data.success === true) { + this.cancel() + this.notifySuccess("등록한 콘텐츠가 업로드 중입니다.\n" + + "콘텐츠 등록이 완료되면 알림을 보내드립니다.\n" + + "이 페이지를 나가도 콘텐츠는 자동으로 등록됩니다.") + + this.audio_contents = [] + await this.getAudioContent() + } else { + this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } finally { + this.is_loading = false + } + }, + async modify() { if ( this.audio_content.title === null || @@ -528,5 +828,43 @@ export default {