연령제한 표시 추가 #16

Merged
klaus merged 1 commits from test into main 2023-11-21 16:25:22 +00:00
1 changed files with 305 additions and 266 deletions

View File

@ -41,16 +41,6 @@
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
<v-row class="text-center">
<v-col>
<v-pagination
v-model="page"
:length="total_page"
circle
@input="next"
/>
</v-col>
</v-row>
</v-container> </v-container>
<v-row> <v-row>
<v-dialog <v-dialog
@ -147,6 +137,50 @@
</v-col> </v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-card-text>
<v-row>
<v-col cols="4">
연령제한
</v-col>
<v-col cols="8">
<v-row>
<v-col>
<input
id="no-auth"
v-model="event.isAdult"
type="radio"
value="false"
>
<label for="no-auth">
본인인증을 하지 않은 유저만
</label>
</v-col>
<v-col>
<input
id="auth"
v-model="event.isAdult"
type="radio"
value="true"
>
<label for="auth">
본인인증을 유저만
</label>
</v-col>
<v-col>
<input
id="both"
v-model="event.isAdult"
type="radio"
value=""
>
<label for="both">
상관없음
</label>
</v-col>
</v-row>
</v-col>
</v-row>
</v-card-text>
<v-card-actions v-show="!is_loading"> <v-card-actions v-show="!is_loading">
<v-btn <v-btn
v-show="is_modify" v-show="is_modify"
@ -228,9 +262,8 @@ export default {
return { return {
is_loading: false, is_loading: false,
is_modify: false, is_modify: false,
page: 1,
events: [], events: [],
event: {}, event: { isAdult: '' },
show_write_dialog: false, show_write_dialog: false,
show_delete_confirm_dialog: false, show_delete_confirm_dialog: false,
} }
@ -296,11 +329,8 @@ export default {
} }
}, },
async next() {
await this.getEvents()
},
showWriteDialog() { showWriteDialog() {
this.event.isAdult = ''
this.show_write_dialog = true this.show_write_dialog = true
}, },
@ -312,13 +342,14 @@ export default {
this.event.link = item.link this.event.link = item.link
this.event.title = item.title this.event.title = item.title
this.event.isPopup = item.isPopup this.event.isPopup = item.isPopup
this.event.isAdult = item.isAdult === null ? '' : item.isAdult
this.event.popupImageUrl = item.popupImageUrl this.event.popupImageUrl = item.popupImageUrl
this.show_write_dialog = true this.show_write_dialog = true
}, },
cancel() { cancel() {
this.is_modify = false this.is_modify = false
this.event = {} this.event = { isAdult: '' }
this.show_write_dialog = false this.show_write_dialog = false
}, },
@ -365,13 +396,17 @@ export default {
formData.append("link", this.event.link) formData.append("link", this.event.link)
} }
if (this.event.isAdult !== undefined && this.event.isAdult !== null && this.event.isAdult !== '') {
formData.append("isAdult", JSON.parse(this.event.isAdult))
}
const res = await api.save(formData) const res = await api.save(formData)
if (res.status === 200 && res.data.success === true) { if (res.status === 200 && res.data.success === true) {
this.show_write_dialog = false this.show_write_dialog = false
this.notifySuccess('등록되었습니다.') this.notifySuccess('등록되었습니다.')
this.page = 1 this.page = 1
await this.getEvents() await this.getEvents()
this.event = {} this.event = { isAdult: '' }
} }
} catch (e) { } catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
@ -412,13 +447,17 @@ export default {
formData.append("link", this.event.link) formData.append("link", this.event.link)
} }
if (this.event.isAdult !== undefined && this.event.isAdult !== null && this.event.isAdult !== '') {
formData.append("isAdult", JSON.parse(this.event.isAdult))
}
const res = await api.modify(formData) const res = await api.modify(formData)
if (res.status === 200 && res.data.success === true) { if (res.status === 200 && res.data.success === true) {
this.show_write_dialog = false this.show_write_dialog = false
this.notifySuccess('수정되었습니다.') this.notifySuccess('수정되었습니다.')
this.page = 1 this.page = 1
await this.getEvents() await this.getEvents()
this.event = {} this.event = { isAdult: '' }
this.is_modify = false this.is_modify = false
} else { } else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')