feat(series-banner): 배너 등록 언어 선택 추가
- 배너 등록/수정 다이얼로그에 언어 선택(ko/ja/en) UI를 추가
This commit is contained in:
@@ -43,7 +43,7 @@ async function getSeriesBannerList(page = 1, size = 20) {
|
||||
async function createSeriesBanner(bannerData) {
|
||||
const formData = new FormData();
|
||||
if (bannerData.image) formData.append("image", bannerData.image);
|
||||
const requestData = { seriesId: bannerData.seriesId };
|
||||
const requestData = { seriesId: bannerData.seriesId, lang: bannerData.lang };
|
||||
formData.append("request", JSON.stringify(requestData));
|
||||
return Vue.axios.post("/admin/audio-content/series/banner/register", formData, {
|
||||
headers: { "Content-Type": "multipart/form-data" }
|
||||
|
||||
@@ -66,6 +66,14 @@
|
||||
/>
|
||||
<v-card-text class="text-center">
|
||||
<div>{{ resolveSeriesTitle(banner) }}</div>
|
||||
<v-chip
|
||||
v-if="banner.lang"
|
||||
x-small
|
||||
label
|
||||
class="mt-1"
|
||||
>
|
||||
{{ banner.lang === 'ko' ? '한국어' : banner.lang === 'ja' ? '일본어' : '영어' }}
|
||||
</v-chip>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
@@ -146,6 +154,17 @@
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="!isEdit">
|
||||
<v-col cols="12">
|
||||
<v-select
|
||||
v-model="bannerForm.lang"
|
||||
:items="languages"
|
||||
label="언어 선택"
|
||||
outlined
|
||||
:rules="[v => !!v || '언어를 선택하세요']"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
@@ -293,11 +312,17 @@ export default {
|
||||
searchResults: [],
|
||||
searchPerformed: false,
|
||||
previewImage: null,
|
||||
languages: [
|
||||
{ text: '한국어', value: 'ko' },
|
||||
{ text: '일본어', value: 'ja' },
|
||||
{ text: '영어', value: 'en' }
|
||||
],
|
||||
bannerForm: {
|
||||
image: null,
|
||||
imageUrl: '',
|
||||
seriesId: null,
|
||||
bannerId: null
|
||||
bannerId: null,
|
||||
lang: 'ko'
|
||||
},
|
||||
imageRules: [
|
||||
v => !!v || this.isEdit || '이미지를 선택하세요'
|
||||
@@ -306,7 +331,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
isFormValid() {
|
||||
return (this.bannerForm.image || (this.isEdit && this.bannerForm.imageUrl)) && this.selectedSeries
|
||||
return (this.bannerForm.image || (this.isEdit && this.bannerForm.imageUrl)) && this.selectedSeries && (this.isEdit || this.bannerForm.lang)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -368,7 +393,7 @@ export default {
|
||||
showAddDialog() {
|
||||
this.isEdit = false
|
||||
this.selectedSeries = null
|
||||
this.bannerForm = { image: null, imageUrl: '', seriesId: null, bannerId: null }
|
||||
this.bannerForm = { image: null, imageUrl: '', seriesId: null, bannerId: null, lang: 'ko' }
|
||||
this.previewImage = null
|
||||
this.searchKeyword = ''
|
||||
this.searchResults = []
|
||||
@@ -387,7 +412,8 @@ export default {
|
||||
image: null,
|
||||
imageUrl: banner.imageUrl || banner.imagePath,
|
||||
seriesId: banner.seriesId,
|
||||
bannerId: banner.id
|
||||
bannerId: banner.id,
|
||||
lang: banner.lang || 'ko'
|
||||
}
|
||||
this.previewImage = null
|
||||
this.searchKeyword = ''
|
||||
@@ -398,7 +424,7 @@ export default {
|
||||
closeDialog() {
|
||||
this.showDialog = false
|
||||
this.selectedSeries = null
|
||||
this.bannerForm = { image: null, imageUrl: '', seriesId: null, bannerId: null }
|
||||
this.bannerForm = { image: null, imageUrl: '', seriesId: null, bannerId: null, lang: 'ko' }
|
||||
this.previewImage = null
|
||||
this.searchKeyword = ''
|
||||
this.searchResults = []
|
||||
@@ -450,13 +476,16 @@ export default {
|
||||
})
|
||||
if (response && response.status === 200 && response.data && response.data.success === true) {
|
||||
this.notifySuccess('배너가 수정되었습니다.')
|
||||
this.closeDialog()
|
||||
this.refreshBanners()
|
||||
} else {
|
||||
this.notifyError('배너 수정을 실패했습니다.')
|
||||
}
|
||||
} else {
|
||||
const response = await createSeriesBanner({
|
||||
image: this.bannerForm.image,
|
||||
seriesId: this.selectedSeries.id
|
||||
seriesId: this.selectedSeries.id,
|
||||
lang: this.bannerForm.lang
|
||||
})
|
||||
if (response && response.status === 200 && response.data && response.data.success === true) {
|
||||
this.notifySuccess('배너가 추가되었습니다.')
|
||||
|
||||
Reference in New Issue
Block a user