feat(sub-banner): 서브 배너 생성·수정 폼에 언어 선택 추가

- 생성·수정 폼에 KO/JA/EN 언어 select 추가 (신규 기본값 KO, 수정은 저장된 lang 유지)
- multipart request JSON 파트에 정규 대문자 lang 을 항상 포함해 전송
- 목록에 언어 열 추가, lang 누락 응답은 KO 로 간주하지 않고 계약 미충족 안내
- EN 은 현재 앱 공개 국가 매핑에서 미노출됨을 폼에 안내
- 400 등 4xx 거부 시 입력값·선택 파일·날짜를 보존하고 재전송을 막지 않도록 처리
- 언어 관련 focused test 추가
This commit is contained in:
Yu Sung
2026-11-03 02:17:03 +09:00
parent 1ec55506b2
commit 1ba1311373
3 changed files with 238 additions and 10 deletions
+68 -6
View File
@@ -66,6 +66,9 @@
<th class="text-center">
이미지
</th>
<th class="text-center">
언어
</th>
<th class="text-center">
웹 URL
</th>
@@ -99,6 +102,7 @@
class="list-image"
>
</td>
<td>{{ langText(item) }}</td>
<td>{{ item.webUrl || '-' }}</td>
<td>{{ item.androidDeepLink || '-' }}</td>
<td>{{ item.iosDeepLink || '-' }}</td>
@@ -121,7 +125,7 @@
</tr>
<tr v-if="sub_banners.length === 0">
<td
colspan="8"
colspan="9"
class="text-center"
>
등록된 배너가 없습니다.
@@ -162,6 +166,30 @@
</v-col>
</v-row>
</v-card-text>
<v-card-text>
<v-row align="center">
<v-col cols="4">
<label for="sub-banner-lang">언어</label>
</v-col>
<v-col cols="8">
<v-select
id="sub-banner-lang"
v-model="sub_banner.lang"
:items="langs"
item-text="text"
item-value="value"
label="언어 선택"
:error-messages="form_errors.lang"
/>
</v-col>
</v-row>
<v-row>
<v-col class="guide-text">
영어(EN)는 저장과 목록 조회는 가능하지만 현재 앱 공개 국가 매핑(JP → 일본어, 그 외 → 한국어)에서는 노출되지 않습니다.
배너 소재 언어와 연결된 이벤트 언어는 운영자가 직접 맞춰 주세요.
</v-col>
</v-row>
</v-card-text>
<v-card-text>
<v-row align="center">
<v-col cols="4">
@@ -339,7 +367,9 @@ import {
buildSubBannerUpdateRequest,
createSubBannerForm,
formatScheduleRange,
langLabel,
scheduleStatus,
SUB_BANNER_LANGS,
SUB_BANNER_PLACEMENTS,
validateSubBannerForm
} from "@/utils/sub_banner"
@@ -355,6 +385,7 @@ export default {
show_write_dialog: false,
show_delete_confirm_dialog: false,
placements: SUB_BANNER_PLACEMENTS,
langs: SUB_BANNER_LANGS,
selected_placement: SUB_BANNER_PLACEMENTS[0].value,
sub_banners: [],
selected_sub_banner: {},
@@ -376,6 +407,16 @@ export default {
this.$dialog.notify.success(message)
},
// 400 등 4xx 는 ApiResponse 가 아닌 표준 Spring Boot body 일 수 있어 단정하지 않는다.
clientErrorMessage(error) {
const response = error && error.response
if (!response || response.status < 400 || response.status >= 500) return null
const body = response.data
const message = body && typeof body === 'object' ? (body.message || body.error) : null
return message || '입력값을 서버가 거부했습니다. 값을 확인한 뒤 다시 시도해 주세요.'
},
imageAdd(payload) {
const file = payload
@@ -427,6 +468,11 @@ export default {
return scheduleStatus(subBanner)
},
langText(subBanner) {
// lang 이 없는 응답을 KO 로 간주하지 않는다.
return langLabel(subBanner.lang) || '-'
},
validate() {
const errors = validateSubBannerForm(
this.sub_banner,
@@ -480,9 +526,15 @@ export default {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
// 결과가 불명확하므로 자동 재시도 없이 중복 전송을 막고 목록으로 상태를 확인한다.
this.submit_blocked = true
this.notifyError('응답을 받지 못했습니다. 등록 여부를 목록에서 확인해 주세요.')
const clientError = this.clientErrorMessage(e)
if (clientError !== null) {
// 서버가 확실히 거부했으므로 입력값·선택 파일·날짜를 그대로 두고 재전송도 막지 않는다.
this.notifyError(clientError)
} else {
// 결과가 불명확하므로 자동 재시도 없이 중복 전송을 막고 목록으로 상태를 확인한다.
this.submit_blocked = true
this.notifyError('응답을 받지 못했습니다. 등록 여부를 목록에서 확인해 주세요.')
}
} finally {
this.is_loading = false
}
@@ -521,8 +573,13 @@ export default {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.submit_blocked = true
this.notifyError('응답을 받지 못했습니다. 수정 여부를 목록에서 확인해 주세요.')
const clientError = this.clientErrorMessage(e)
if (clientError !== null) {
this.notifyError(clientError)
} else {
this.submit_blocked = true
this.notifyError('응답을 받지 못했습니다. 수정 여부를 목록에서 확인해 주세요.')
}
} finally {
this.is_loading = false
}
@@ -561,6 +618,11 @@ export default {
if (res.status === 200 && res.data.success === true) {
// 서버가 id 오름차순으로 내려주므로 재정렬하지 않고 전부 표시한다.
this.sub_banners = Array.isArray(res.data.data) ? res.data.data : []
// 응답에 lang 이 없으면 KO 로 간주하지 않고 계약 미충족을 알린다.
if (this.sub_banners.some((item) => !item || item.lang === undefined)) {
this.notifyError('목록 응답에 lang 이 없습니다. 언어 계약이 적용된 서버인지 확인해 주세요.')
}
} else {
// 조회 실패를 빈 목록으로 오인하지 않는다.
this.notifyError(res.data.message || '목록을 불러오지 못했습니다. 다시 시도해 주세요.')