Compare commits

..

4 Commits

Author SHA1 Message Date
Yu Sung a0a80bf626 오디션 배역 상세 페이지 추가 2024-12-28 05:31:22 +09:00
Yu Sung 4b9259c525 오디션 배역 등록/수정 - 배역 정보 추가 2024-12-28 03:53:48 +09:00
Yu Sung d5d365d0ad 오디션 상세페이지 - 배역 리스트/등록/수정/삭제 추가 2024-12-28 02:34:28 +09:00
Yu Sung 521345b9c8 오디션 상세 페이지 추가 2024-12-27 23:43:42 +09:00
5 changed files with 890 additions and 3 deletions

View File

@ -24,6 +24,31 @@ async function getAuditionDetail(id) {
return Vue.axios.get("/admin/audition/" + id);
}
export {
getAuditionList, createAudition, updateAudition, getAuditionDetail
async function createAuditionRole(formData) {
return Vue.axios.post("/admin/audition/role", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
});
}
async function updateAuditionRole(formData) {
return Vue.axios.put("/admin/audition/role", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
});
}
async function getAuditionRoleDetail(id) {
return Vue.axios.get("/admin/audition/role/" + id);
}
async function getAuditionApplicantList(id, page) {
return Vue.axios.get("/admin/audition/role/" + id + "/applicant?page=" + (page - 1) + "&size=20");
}
export {
getAuditionList, createAudition, updateAudition, getAuditionDetail,
createAuditionRole, updateAuditionRole, getAuditionRoleDetail, getAuditionApplicantList
}

View File

@ -197,9 +197,19 @@ const routes = [
},
{
path: '/audition',
name: 'AuditionListView',
name: 'AuditionView',
component: () => import(/* webpackChunkName: "audition" */ '../views/Audition/AuditionView.vue')
},
{
path: '/audition/detail',
name: 'AuditionDetailView',
component: () => import(/* webpackChunkName: "audition" */ '../views/Audition/AuditionDetailView.vue')
},
{
path: '/audition/role/detail',
name: 'AuditionRoleDetailView',
component: () => import(/* webpackChunkName: "audition" */ '../views/Audition/AuditionRoleDetailView.vue')
},
]
},
{

View File

@ -0,0 +1,606 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>{{ audition_title }}</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-container>
<v-row>
<v-col cols="4">
<v-card>
<v-img
:src="audition_detail.imageUrl"
class="audition-image"
/>
<v-card-text
v-if="
audition_detail.originalWorkUrl !== undefined &&
audition_detail.originalWorkUrl.length > 0
"
>
<a
:href="audition_detail.originalWorkUrl"
class="original-work-link"
>
원작링크
</a>
</v-card-text>
<v-card-text>
<b>오디션 정보</b>
<vue-show-more-text
:text="audition_detail.information"
:lines="3"
/>
</v-card-text>
</v-card>
</v-col>
<v-col cols="8">
<v-row>
<v-col cols="8" />
<v-col cols="4">
<v-btn
block
color="#3bb9f1"
dark
depressed
@click="showWriteDialog"
>
배역 등록
</v-btn>
</v-col>
</v-row>
<v-row v-if="audition_role_list.length > 0">
<v-col
v-for="(item, i) in audition_role_list"
:key="i"
cols="4"
>
<v-card>
<v-card-title>
<v-spacer />
<v-img
:src="item.imageUrl"
class="audition-image"
@click="selectAuditionRole(item)"
/>
<v-spacer />
</v-card-title>
<v-card-text class="audition-title-container">
{{ item.name }}
</v-card-text>
<v-card-text>
상태 : {{ getStatusStr(item.status) }}
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
text
@click="showModifyDialog(item)"
>
수정
</v-btn>
<v-btn
text
@click="deleteConfirm(item)"
>
삭제
</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
<v-row v-else>
<v-col>
등록된 배역이 없습니다.
</v-col>
</v-row>
</v-col>
</v-row>
</v-container>
<v-dialog
v-model="show_write_dialog"
max-width="1000px"
persistent
>
<v-card>
<v-card-title>
오디션 배역 등록
</v-card-title>
<div class="image-select">
<label for="image">
배역 이미지 등록
</label>
<v-file-input
id="image"
v-model="audition_role.image"
accept="image/*"
@change="imageAdd"
/>
</div>
<img
v-if="audition_role.image_url"
:src="audition_role.image_url"
alt=""
class="image-preview"
>
<v-card-text>
<v-row align="center">
<v-col cols="4">
배역 이름*
</v-col>
<v-col cols="8">
<v-text-field
v-model="audition_role.name"
label="배역 이름"
required
/>
</v-col>
</v-row>
</v-card-text>
<v-card-text>
<v-row align="center">
<v-col cols="4">
오디션 배역 정보*
</v-col>
<v-col cols="8">
<v-textarea
v-model="audition_role.information"
label="오디션 배역 정보"
required
/>
</v-col>
</v-row>
</v-card-text>
<v-card-text>
<v-row align="center">
<v-col cols="4">
오디션 대본 URL*
</v-col>
<v-col cols="8">
<v-text-field
v-model="audition_role.audition_script_url"
label="오디션 대본 URL"
required
/>
</v-col>
</v-row>
</v-card-text>
<v-card-text v-if="selected_role !== null">
<v-row>
<v-col cols="4">
모집상태
</v-col>
<v-col
cols="8"
align="left"
>
<v-row>
<v-col>
<input
id="radio_in_progress"
v-model="audition_role.status"
type="radio"
value="IN_PROGRESS"
>
<label for="radio_in_progress"> 모집중</label>
</v-col>
<v-col>
<input
id="radio_complete"
v-model="audition_role.status"
type="radio"
value="COMPLETED"
>
<label for="radio_complete"> 모집완료</label>
</v-col>
</v-row>
</v-col>
</v-row>
</v-card-text>
<v-card-actions v-show="!is_loading">
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="cancel"
>
취소
</v-btn>
<v-btn
v-if="selected_role !== null"
color="blue darken-1"
text
@click="modify"
>
수정
</v-btn>
<v-btn
v-else
color="blue darken-1"
text
@click="validate"
>
등록
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog
v-model="show_delete_confirm_dialog"
max-width="400px"
persistent
>
<v-card>
<v-card-text />
<v-card-text>
삭제하시겠습니까?
</v-card-text>
<v-card-actions v-show="!is_loading">
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="cancel"
>
취소
</v-btn>
<v-btn
color="blue darken-1"
text
@click="deleteAuditionRole"
>
확인
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
import * as api from '@/api/audition'
import VueShowMoreText from 'vue-show-more-text'
export default {
name: "AuditionDetailView",
components: {VueShowMoreText},
data() {
return {
is_loading: false,
audition_id: 0,
audition_title: '',
audition_detail: {},
audition_role_list: [],
show_write_dialog: false,
show_delete_confirm_dialog: false,
audition_role: {},
selected_role: null,
}
},
async created() {
this.audition_id = this.$route.params.audition_id
this.audition_title = this.$route.params.audition_title
if (this.audition_id !== undefined && this.audition_id > 0) {
await this.getAuditionDetail()
} else {
this.$router.go(-1)
}
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
getStatusStr(status) {
if (status === 'NOT_STARTED') {
return "모집전"
} else if (status === 'COMPLETED') {
return "모집완료"
} else {
return "모집중"
}
},
isValidUrl(string) {
try {
new URL(string); // URL URL
return true;
} catch (_) {
return false;
}
},
async getAuditionDetail() {
this.is_loading = true
try {
const res = await api.getAuditionDetail(this.audition_id)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
this.audition_title = data.title
this.audition_detail.imageUrl = data.imageUrl
this.audition_detail.information = data.information
this.audition_role_list = data.roleList
if (this.isValidUrl(data.originalWorkUrl)) {
this.audition_detail.originalWorkUrl = data.originalWorkUrl
}
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
imageAdd(payload) {
const file = payload;
if (file) {
this.audition_role.image_url = URL.createObjectURL(file)
URL.revokeObjectURL(file)
} else {
this.audition_role.image_url = null
}
},
showWriteDialog() {
this.show_write_dialog = true
},
showModifyDialog(auditionRole) {
this.audition_role = {
name: auditionRole.name,
image_url: auditionRole.imageUrl,
information: auditionRole.information,
audition_script_url: auditionRole.auditionScriptUrl,
status: auditionRole.status
}
this.selected_role = auditionRole
this.show_write_dialog = true
},
cancel() {
this.audition_role = {}
this.selected_role = null
this.show_write_dialog = false
this.show_delete_confirm_dialog = false
},
deleteConfirm(auditionRole) {
this.selected_role = auditionRole
this.show_delete_confirm_dialog = true
},
validate() {
if (this.audition_role.image === undefined || this.audition_role.image === null) {
this.notifyError('배역 이미지를 선택하세요')
return
}
if (this.audition_role.name.trim().length <= 0) {
this.notifyError('배역 이름을 입력하세요')
return
}
if (
this.audition_role.information === undefined ||
this.audition_role.information === null ||
this.audition_role.information.trim().length <= 10
) {
this.notifyError('오디션 배역 정보를 입력하세요')
return
}
if (
this.audition_role.audition_script_url === undefined ||
this.audition_role.audition_script_url === null ||
this.audition_role.audition_script_url.trim().length <= 10
) {
this.notifyError('오디션 대본 URL을 입력하세요')
return
}
this.submit()
},
async submit() {
if (this.is_loading) return;
this.is_loading = true
try {
const request = {
auditionId: this.audition_id,
name: this.audition_role.name,
information: this.audition_role.information,
auditionScriptUrl: this.audition_role.audition_script_url
}
const formData = new FormData()
formData.append("image", this.audition_role.image);
formData.append("request", JSON.stringify(request))
const res = await api.createAuditionRole(formData);
if (res.status === 200 && res.data.success === true) {
this.cancel();
this.notifySuccess(res.data.message || '등록되었습니다.')
this.is_loading = false
await this.getAuditionDetail()
} else {
this.is_loading = false
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
async modify() {
if (this.is_loading) return;
this.is_loading = true
try {
const request = {id: this.selected_role.id}
if (this.audition_role.name !== this.selected_role.name) {
request.name = this.audition_role.name
}
if (this.audition_role.information !== this.selected_role.information) {
request.information = this.audition_role.information
}
if (this.audition_role.audition_script_url !== this.selected_role.audition_script_url) {
request.auditionScriptUrl = this.audition_role.audition_script_url
}
if (this.audition_role.status !== this.selected_role.status) {
request.status = this.audition_role.status
}
const formData = new FormData()
formData.append("request", JSON.stringify(request))
if (this.audition_role.image !== undefined && this.audition_role.image !== null) {
formData.append("image", this.audition_role.image)
}
const res = await api.updateAuditionRole(formData);
if (res.status === 200 && res.data.success === true) {
this.cancel();
this.notifySuccess(res.data.message || '등록되었습니다.')
this.is_loading = false
await this.getAuditionDetail()
} else {
this.is_loading = false
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
async deleteAuditionRole() {
if (this.is_loading) return;
this.is_loading = true
try {
const request = {id: this.selected_role.id, isActive: false}
const formData = new FormData()
formData.append("request", JSON.stringify(request))
const res = await api.updateAuditionRole(formData)
if (res.status === 200 && res.data.success === true) {
this.cancel();
this.notifySuccess('오디션 배역이 삭제되었습니다.')
this.is_loading = false
await this.getAuditionDetail()
} else {
this.is_loading = false
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
this.is_loading = false
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
selectAuditionRole(auditionRole) {
this.$router.push(
{
name: 'AuditionRoleDetailView',
params: {
audition_role_id: auditionRole.id,
audition_title: this.audition_title
}
}
)
},
},
}
</script>
<style scoped>
.image-select label {
display: inline-block;
padding: 10px 20px;
background-color: #232d4a;
color: #fff;
vertical-align: middle;
font-size: 15px;
cursor: pointer;
border-radius: 5px;
}
.v-file-input {
position: absolute;
width: 0;
height: 0;
padding: 0;
overflow: hidden;
border: 0;
}
.image-preview {
max-width: 100%;
width: 300px;
object-fit: cover;
margin-top: 10px;
}
.original-work-link {
text-decoration: none;
}
.audition-image {
aspect-ratio: 1000 / 530;
}
.audition-title-container {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
max-height: 2em;
}
.no-audition_role {
height: 50vh;
margin-top: 100px;
}
</style>

View File

@ -0,0 +1,234 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>{{ audition_title }} - {{ audition_role_name }}</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-container>
<v-row>
<v-col cols="4">
<v-card>
<v-img
:src="audition_role_detail.imageUrl"
class="audition-image"
/>
<v-card-text
v-if="
audition_role_detail.auditionScriptUrl !== undefined &&
audition_role_detail.auditionScriptUrl.length > 0
"
>
<a
:href="audition_role_detail.auditionScriptUrl"
class="audition-script-link"
>
오디션 대본 링크
</a>
</v-card-text>
<v-card-text>
<b>오디션 배역 정보</b>
<vue-show-more-text
:text="audition_role_detail.information"
:lines="3"
/>
</v-card-text>
</v-card>
</v-col>
<v-col cols="8">
<v-row>
<v-col>
<v-simple-table class="elevation-10">
<template>
<thead>
<tr>
<th class="text-center">
지원 번호
</th>
<th class="text-center">
프로필
</th>
<th class="text-center">
닉네임
</th>
<th class="text-center">
듣기
</th>
<th class="text-center">
추천수
</th>
</tr>
</thead>
<tbody>
<tr
v-for="item in audition_role_applicant_list"
:key="item.applicantId"
>
<td>{{ item.applicantId }}</td>
<td align="center">
<v-img
max-width="70"
max-height="70"
:src="item.profileImageUrl"
class="rounded-circle"
/>
<br>
<a
:href="item.profileImageUrl"
class="v-btn v-btn--outlined"
>
다운로드
</a>
</td>
<td>{{ item.nickname }}</td>
<td>
<vuetify-audio
:file="item.voiceUrl"
:downloadable="true"
:auto-play="false"
/>
</td>
<td>{{ item.voteCount }}</td>
</tr>
</tbody>
</template>
</v-simple-table>
</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-col>
</v-row>
</v-container>
</div>
</template>
<script>
import * as api from '@/api/audition'
import VueShowMoreText from 'vue-show-more-text'
import VuetifyAudio from "vuetify-audio";
export default {
name: "AuditionDetailView",
components: {VuetifyAudio, VueShowMoreText},
data() {
return {
is_loading: false,
audition_role_id: 0,
audition_title: '',
audition_role_name: '',
audition_role_detail: {},
audition_role_applicant_list: [],
page: 1,
total_page: 0,
}
},
async created() {
this.audition_role_id = this.$route.params.audition_role_id
this.audition_title = this.$route.params.audition_title
if (this.audition_role_id !== undefined && this.audition_role_id > 0) {
await this.getAuditionRoleDetail()
await this.getAuditionRoleApplicant()
} else {
this.$router.go(-1)
}
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
isValidUrl(string) {
try {
new URL(string); // URL URL
return true;
} catch (_) {
return false;
}
},
async getAuditionRoleDetail() {
try {
const res = await api.getAuditionRoleDetail(this.audition_role_id)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
this.audition_role_name = data.name
this.audition_role_detail.imageUrl = data.imageUrl
this.audition_role_detail.information = data.information
if (this.isValidUrl(data.auditionScriptUrl)) {
this.audition_role_detail.auditionScriptUrl = data.auditionScriptUrl
}
} else {
this.is_loading = false
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
async getAuditionRoleApplicant() {
this.is_loading = true
try {
const res = await api.getAuditionApplicantList(this.audition_role_id, this.page)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
const total_page = Math.ceil(data.totalCount / 20)
this.audition_role_applicant_list = data.items
if (total_page <= 0) {
this.total_page = 1
} else {
this.total_page = total_page
}
} else {
this.is_loading = false
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
} finally {
this.is_loading = false
}
},
async next() {
await this.getAuditionRoleApplicant()
},
}
}
</script>
<style scoped>
</style>

View File

@ -34,6 +34,7 @@
<v-img
:src="item.imageUrl"
class="cover-image"
@click="selectAudition(item)"
/>
<v-spacer />
</v-card-title>
@ -467,6 +468,17 @@ export default {
}
},
selectAudition(audition) {
this.$router.push(
{
name: 'AuditionDetailView',
params: {
audition_id: audition.id, audition_title: audition.title
}
}
)
},
async next() {
await this.getAuditionList()
},