Merge pull request '연령제한 표시 추가' (#16) from test into main

Reviewed-on: #16
This commit is contained in:
klaus 2023-11-21 16:25:21 +00:00
commit ff83041585
1 changed files with 305 additions and 266 deletions

View File

@ -41,16 +41,6 @@
</v-card>
</v-col>
</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-row>
<v-dialog
@ -147,6 +137,50 @@
</v-col>
</v-row>
</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-btn
v-show="is_modify"
@ -228,9 +262,8 @@ export default {
return {
is_loading: false,
is_modify: false,
page: 1,
events: [],
event: {},
event: { isAdult: '' },
show_write_dialog: false,
show_delete_confirm_dialog: false,
}
@ -296,11 +329,8 @@ export default {
}
},
async next() {
await this.getEvents()
},
showWriteDialog() {
this.event.isAdult = ''
this.show_write_dialog = true
},
@ -312,13 +342,14 @@ export default {
this.event.link = item.link
this.event.title = item.title
this.event.isPopup = item.isPopup
this.event.isAdult = item.isAdult === null ? '' : item.isAdult
this.event.popupImageUrl = item.popupImageUrl
this.show_write_dialog = true
},
cancel() {
this.is_modify = false
this.event = {}
this.event = { isAdult: '' }
this.show_write_dialog = false
},
@ -365,13 +396,17 @@ export default {
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)
if (res.status === 200 && res.data.success === true) {
this.show_write_dialog = false
this.notifySuccess('등록되었습니다.')
this.page = 1
await this.getEvents()
this.event = {}
this.event = { isAdult: '' }
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
@ -412,13 +447,17 @@ export default {
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)
if (res.status === 200 && res.data.success === true) {
this.show_write_dialog = false
this.notifySuccess('수정되었습니다.')
this.page = 1
await this.getEvents()
this.event = {}
this.event = { isAdult: '' }
this.is_modify = false
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')