diff --git a/src/api/audio_content_series.js b/src/api/audio_content_series.js
index 02edbb5..8d940d6 100644
--- a/src/api/audio_content_series.js
+++ b/src/api/audio_content_series.js
@@ -24,11 +24,17 @@ async function searchSeriesList(searchWord) {
return Vue.axios.get("/admin/audio-content/series/search?search_word=" + searchWord)
}
+// 시리즈 수정
+async function updateAudioContentSeries(request) {
+ return Vue.axios.put('/admin/audio-content/series', request);
+}
+
export {
getAudioContentSeriesList,
getAudioContentSeriesGenreList,
createAudioContentSeriesGenre,
updateAudioContentSeriesGenre,
updateAudioContentSeriesGenreOrders,
- searchSeriesList
+ searchSeriesList,
+ updateAudioContentSeries
}
diff --git a/src/views/Series/ContentSeriesList.vue b/src/views/Series/ContentSeriesList.vue
index 41ef126..0747481 100644
--- a/src/views/Series/ContentSeriesList.vue
+++ b/src/views/Series/ContentSeriesList.vue
@@ -47,6 +47,9 @@
19금
|
+
+ 수정
+ |
@@ -73,13 +76,13 @@
|
|
{{ item.creatorNickname }} |
@@ -94,6 +97,17 @@
X
+
+
+ 수정
+
+ |
@@ -111,6 +125,165 @@
+
+
+
+
+ 시리즈 수정
+
+
+
+
+
+
+
+
+ {{ edit_target.title }}
+
+
+ {{ edit_target.introduction }}
+
+
+
+
+
+
+ 장르
+
+
+
+
+
+
+
+ 연재 요일
+
+
+
+
+
+
+
+
+
+
+
+ 오리지널
+
+
+
+
+
+
+
+ 19금
+
+
+
+
+
+
+
+
+
+ 취소
+
+
+ 저장
+
+
+
+
@@ -130,7 +303,52 @@ export default {
page: 1,
total_page: 0,
total_count: 0,
- series_list: []
+ series_list: [],
+ // 수정 다이얼로그 상태/데이터
+ show_edit_dialog: false,
+ is_saving: false,
+ is_loading_genres: false,
+ genre_list: [],
+ edit_target: {},
+ edit_form: {
+ genreId: null,
+ isOriginal: false,
+ isAdult: false,
+ publishedDaysOfWeek: []
+ },
+ daysOfWeekOptions: [
+ { value: 'RANDOM', text: '랜덤' },
+ { value: 'SUN', text: '일' },
+ { value: 'MON', text: '월' },
+ { value: 'TUE', text: '화' },
+ { value: 'WED', text: '수' },
+ { value: 'THU', text: '목' },
+ { value: 'FRI', text: '금' },
+ { value: 'SAT', text: '토' }
+ ]
+ }
+ },
+
+ watch: {
+ 'edit_form.publishedDaysOfWeek': {
+ handler(newVal, oldVal) {
+ if (!Array.isArray(newVal)) return;
+ const hasRandom = newVal.includes('RANDOM');
+ const hadRandom = Array.isArray(oldVal) && oldVal.includes('RANDOM');
+ const others = newVal.filter(v => v !== 'RANDOM');
+
+ // RANDOM과 특정 요일은 함께 설정될 수 없음
+ if (hasRandom && others.length > 0) {
+ if (hadRandom) {
+ // RANDOM 상태에서 다른 요일을 선택한 경우 → RANDOM 제거, 나머지만 유지
+ this.edit_form.publishedDaysOfWeek = others;
+ } else {
+ // 다른 요일이 선택된 상태에서 RANDOM을 선택한 경우 → RANDOM만 유지
+ this.edit_form.publishedDaysOfWeek = ['RANDOM'];
+ }
+ }
+ },
+ deep: true
}
},
@@ -176,6 +394,96 @@ export default {
async next() {
await this.getAudioContentSeries()
},
+
+ openEditDialog(item) {
+ this.edit_target = item
+ this.show_edit_dialog = true
+ this.is_saving = false
+ this.loadGenresThenInit()
+ },
+
+ async loadGenresThenInit() {
+ try {
+ this.is_loading_genres = true
+ if (!this.genre_list || this.genre_list.length === 0) {
+ const res = await api.getAudioContentSeriesGenreList()
+ if (res.status === 200 && res.data.success === true) {
+ this.genre_list = res.data.data || []
+ } else {
+ this.notifyError(res.data.message || '장르 목록을 불러오지 못했습니다.')
+ }
+ }
+ } catch (e) {
+ this.notifyError('장르 목록을 불러오지 못했습니다. 다시 시도해 주세요.')
+ } finally {
+ this.is_loading_genres = false
+ this.initEditForm()
+ }
+ },
+
+ initEditForm() {
+ const item = this.edit_target || {}
+ let genreId = item.genreId || null
+ if (!genreId && item.genre && this.genre_list && this.genre_list.length > 0) {
+ const found = this.genre_list.find(g => g.genre === item.genre)
+ if (found) genreId = found.id
+ }
+ // 초기 publishedDaysOfWeek 정규화 (RANDOM과 특정 요일 혼재 금지)
+ let published = Array.isArray(item.publishedDaysOfWeek) ? [...item.publishedDaysOfWeek] : []
+ if (published.includes('RANDOM')) {
+ const others = published.filter(v => v !== 'RANDOM')
+ published = others.length > 0 ? ['RANDOM'] : ['RANDOM']
+ }
+ this.edit_form = {
+ genreId: genreId,
+ isOriginal: typeof item.isOriginal === 'boolean' ? item.isOriginal : false,
+ isAdult: typeof item.isAdult === 'boolean' ? item.isAdult : false,
+ publishedDaysOfWeek: published
+ }
+ },
+
+ cancelEdit() {
+ this.show_edit_dialog = false
+ this.edit_target = {}
+ this.edit_form = {
+ genreId: null,
+ isOriginal: false,
+ isAdult: false,
+ publishedDaysOfWeek: []
+ }
+ },
+
+ async saveEdit() {
+ if (this.is_saving) return
+ if (!this.edit_form.genreId) {
+ this.notifyError('장르를 선택해 주세요.')
+ return
+ }
+ this.is_saving = true
+ try {
+ const days = Array.isArray(this.edit_form.publishedDaysOfWeek) ? this.edit_form.publishedDaysOfWeek : []
+ const payloadDays = days.includes('RANDOM') ? ['RANDOM'] : days
+ const request = {
+ seriesId: this.edit_target.id,
+ genreId: this.edit_form.genreId,
+ isOriginal: this.edit_form.isOriginal,
+ isAdult: this.edit_form.isAdult,
+ publishedDaysOfWeek: payloadDays
+ }
+ const res = await api.updateAudioContentSeries(request)
+ if (res.status === 200 && res.data.success === true) {
+ this.notifySuccess('수정되었습니다.')
+ this.show_edit_dialog = false
+ await this.getAudioContentSeries()
+ } else {
+ this.notifyError(res.data.message || '수정에 실패했습니다. 다시 시도해 주세요.')
+ }
+ } catch (e) {
+ this.notifyError('수정에 실패했습니다. 다시 시도해 주세요.')
+ } finally {
+ this.is_saving = false
+ }
+ },
}
}