Compare commits
5 Commits
00b12d0edb
...
test
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c28367be9 | ||
![]() |
8f0958848d | ||
![]() |
a4cf43b88a | ||
![]() |
40c5a6593e | ||
![]() |
edab727c22 |
@@ -24,7 +24,7 @@ async function getCalculateCommunityPost(startDate, endDate, page, size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getSettlementRatio(page) {
|
async function getSettlementRatio(page) {
|
||||||
return Vue.axios.get('/admin/calculate/ratio?page=' + (page - 1) + "&size=20'");
|
return Vue.axios.get('/admin/calculate/ratio?page=' + (page - 1) + "&size=20");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createCreatorSettlementRatio(creatorSettlementRatio) {
|
async function createCreatorSettlementRatio(creatorSettlementRatio) {
|
||||||
@@ -57,6 +57,21 @@ async function getCalculateCommunityByCreator(startDate, endDate, page, size) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateCreatorSettlementRatio(creatorSettlementRatio) {
|
||||||
|
const request = {
|
||||||
|
memberId: creatorSettlementRatio.creator_id,
|
||||||
|
subsidy: creatorSettlementRatio.subsidy,
|
||||||
|
liveSettlementRatio: creatorSettlementRatio.liveSettlementRatio,
|
||||||
|
contentSettlementRatio: creatorSettlementRatio.contentSettlementRatio,
|
||||||
|
communitySettlementRatio: creatorSettlementRatio.communitySettlementRatio
|
||||||
|
};
|
||||||
|
return Vue.axios.post('/admin/calculate/ratio/update', request);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteCreatorSettlementRatio(memberId) {
|
||||||
|
return Vue.axios.post('/admin/calculate/ratio/delete/' + memberId);
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getCalculateLive,
|
getCalculateLive,
|
||||||
getCalculateContent,
|
getCalculateContent,
|
||||||
@@ -65,6 +80,8 @@ export {
|
|||||||
getCalculateCommunityPost,
|
getCalculateCommunityPost,
|
||||||
getSettlementRatio,
|
getSettlementRatio,
|
||||||
createCreatorSettlementRatio,
|
createCreatorSettlementRatio,
|
||||||
|
updateCreatorSettlementRatio,
|
||||||
|
deleteCreatorSettlementRatio,
|
||||||
getCalculateLiveByCreator,
|
getCalculateLiveByCreator,
|
||||||
getCalculateContentByCreator,
|
getCalculateContentByCreator,
|
||||||
getCalculateCommunityByCreator
|
getCalculateCommunityByCreator
|
||||||
|
@@ -7,13 +7,20 @@ async function getCharacterList(page = 1, size = 20) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 캐릭터 검색
|
// 캐릭터 검색 (배너용 기존 함수)
|
||||||
async function searchCharacters(searchTerm, page = 1, size = 20) {
|
async function searchCharacters(searchTerm, page = 1, size = 20) {
|
||||||
return Vue.axios.get('/admin/chat/banner/search-character', {
|
return Vue.axios.get('/admin/chat/banner/search-character', {
|
||||||
params: { searchTerm, page: page - 1, size }
|
params: { searchTerm, page: page - 1, size }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 캐릭터 리스트 검색 (요구사항: /admin/chat/character/search)
|
||||||
|
async function searchCharacterList(searchTerm, page = 1, size = 20) {
|
||||||
|
return Vue.axios.get('/admin/chat/character/search', {
|
||||||
|
params: { searchTerm, page: page - 1, size }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 캐릭터 상세 조회
|
// 캐릭터 상세 조회
|
||||||
async function getCharacter(id) {
|
async function getCharacter(id) {
|
||||||
return Vue.axios.get(`/admin/chat/character/${id}`)
|
return Vue.axios.get(`/admin/chat/character/${id}`)
|
||||||
@@ -257,6 +264,7 @@ async function getCharacterCalculateList({ startDateStr, endDateStr, sort = 'TOT
|
|||||||
export {
|
export {
|
||||||
getCharacterList,
|
getCharacterList,
|
||||||
searchCharacters,
|
searchCharacters,
|
||||||
|
searchCharacterList,
|
||||||
getCharacter,
|
getCharacter,
|
||||||
createCharacter,
|
createCharacter,
|
||||||
updateCharacter,
|
updateCharacter,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
// 공통: 빈 문자열 -> null
|
// 공통: 값 그대로 전달 (빈 문자열 유지)
|
||||||
function toNullIfBlank(value) {
|
function toNullIfBlank(value) {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
return value.trim() === '' ? null : value;
|
return value.trim() === '' ? null : value;
|
||||||
@@ -25,7 +25,12 @@ export async function createOriginal(data) {
|
|||||||
category: toNullIfBlank(data.category),
|
category: toNullIfBlank(data.category),
|
||||||
isAdult: !!data.isAdult,
|
isAdult: !!data.isAdult,
|
||||||
description: toNullIfBlank(data.description),
|
description: toNullIfBlank(data.description),
|
||||||
originalLink: toNullIfBlank(data.originalLink)
|
originalLink: toNullIfBlank(data.originalLink), // 원천 원작 링크
|
||||||
|
originalWork: toNullIfBlank(data.originalWork),
|
||||||
|
writer: toNullIfBlank(data.writer),
|
||||||
|
studio: toNullIfBlank(data.studio),
|
||||||
|
originalLinks: Array.isArray(data.originalLinks) ? data.originalLinks : [],
|
||||||
|
tags: Array.isArray(data.tags) ? data.tags : []
|
||||||
};
|
};
|
||||||
formData.append('request', JSON.stringify(request));
|
formData.append('request', JSON.stringify(request));
|
||||||
return Vue.axios.post('/admin/chat/original/register', formData, {
|
return Vue.axios.post('/admin/chat/original/register', formData, {
|
||||||
@@ -39,12 +44,7 @@ export async function updateOriginal(data, image = null) {
|
|||||||
if (image) formData.append('image', image);
|
if (image) formData.append('image', image);
|
||||||
const processed = {};
|
const processed = {};
|
||||||
Object.keys(data).forEach(key => {
|
Object.keys(data).forEach(key => {
|
||||||
const value = data[key];
|
processed[key] = data[key];
|
||||||
if (typeof value === 'string' || value === '') {
|
|
||||||
processed[key] = toNullIfBlank(value)
|
|
||||||
} else {
|
|
||||||
processed[key] = value
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
formData.append('request', JSON.stringify(processed));
|
formData.append('request', JSON.stringify(processed));
|
||||||
return Vue.axios.put('/admin/chat/original/update', formData, {
|
return Vue.axios.put('/admin/chat/original/update', formData, {
|
||||||
|
@@ -60,7 +60,7 @@
|
|||||||
max-width="300"
|
max-width="300"
|
||||||
>
|
>
|
||||||
<v-img
|
<v-img
|
||||||
:src="banner.imageUrl"
|
:src="banner.imagePath"
|
||||||
height="200"
|
height="200"
|
||||||
contain
|
contain
|
||||||
/>
|
/>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-row>
|
<v-row align="center">
|
||||||
<v-col cols="4">
|
<v-col cols="4">
|
||||||
<v-btn
|
<v-btn
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -19,6 +19,29 @@
|
|||||||
캐릭터 추가
|
캐릭터 추가
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
<v-col
|
||||||
|
cols="8"
|
||||||
|
class="d-flex justify-end align-center"
|
||||||
|
>
|
||||||
|
<v-text-field
|
||||||
|
v-model="searchTerm"
|
||||||
|
label="검색어"
|
||||||
|
placeholder="캐릭터명, 태그, mbti 검색"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
hide-details
|
||||||
|
style="max-width: 320px;"
|
||||||
|
class="mr-2"
|
||||||
|
@keyup.enter="onSearch"
|
||||||
|
/>
|
||||||
|
<v-btn
|
||||||
|
:style="{ backgroundColor: '#3bb9f1', color: 'white' }"
|
||||||
|
:disabled="is_loading"
|
||||||
|
@click="onSearch"
|
||||||
|
>
|
||||||
|
검색
|
||||||
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<v-col>
|
||||||
@@ -244,7 +267,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCharacterList, updateCharacter } from '@/api/character'
|
import { getCharacterList, updateCharacter, searchCharacterList } from '@/api/character'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CharacterList",
|
name: "CharacterList",
|
||||||
@@ -260,7 +283,8 @@ export default {
|
|||||||
page: 1,
|
page: 1,
|
||||||
total_page: 0,
|
total_page: 0,
|
||||||
characters: [],
|
characters: [],
|
||||||
selected_character: {}
|
selected_character: {},
|
||||||
|
searchTerm: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -369,10 +393,18 @@ export default {
|
|||||||
await this.getCharacters()
|
await this.getCharacters()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSearch() {
|
||||||
|
this.page = 1;
|
||||||
|
this.getCharacters();
|
||||||
|
},
|
||||||
|
|
||||||
async getCharacters() {
|
async getCharacters() {
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
try {
|
try {
|
||||||
const response = await getCharacterList(this.page);
|
const hasSearch = this.searchTerm && this.searchTerm.trim() !== '';
|
||||||
|
const response = hasSearch
|
||||||
|
? await searchCharacterList(this.searchTerm.trim(), this.page, 20)
|
||||||
|
: await getCharacterList(this.page);
|
||||||
|
|
||||||
if (response && response.status === 200) {
|
if (response && response.status === 200) {
|
||||||
if (response.data.success === true) {
|
if (response.data.success === true) {
|
||||||
|
@@ -44,8 +44,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>카테고리(장르): {{ detail.category || '-' }}</div>
|
<div>카테고리(장르): {{ detail.category || '-' }}</div>
|
||||||
<div>19금 여부: {{ detail.isAdult ? '예' : '아니오' }}</div>
|
<div>19금 여부: {{ detail.isAdult ? '예' : '아니오' }}</div>
|
||||||
<div>
|
<div>원천 원작: {{ detail.originalWork || '-' }}</div>
|
||||||
원작 링크:
|
<div class="mt-1">
|
||||||
|
원천 원작 링크:
|
||||||
<a
|
<a
|
||||||
v-if="detail.originalLink"
|
v-if="detail.originalLink"
|
||||||
:href="detail.originalLink"
|
:href="detail.originalLink"
|
||||||
@@ -54,6 +55,40 @@
|
|||||||
>{{ detail.originalLink }}</a>
|
>{{ detail.originalLink }}</a>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>글/그림: {{ detail.writer || '-' }}</div>
|
||||||
|
<div>제작사: {{ detail.studio || '-' }}</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
원작 링크:
|
||||||
|
<template v-if="detail.originalLinks && detail.originalLinks.length">
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
v-for="(link, idx) in detail.originalLinks"
|
||||||
|
:key="idx"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
:href="link"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>{{ link }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
태그:
|
||||||
|
<template v-if="detail.tags && detail.tags.length">
|
||||||
|
<v-chip
|
||||||
|
v-for="(t, i) in detail.tags"
|
||||||
|
:key="i"
|
||||||
|
small
|
||||||
|
class="mr-1 mb-1"
|
||||||
|
>
|
||||||
|
{{ t }}
|
||||||
|
</v-chip>
|
||||||
|
</template>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
작품 소개:
|
작품 소개:
|
||||||
</div>
|
</div>
|
||||||
|
@@ -93,15 +93,42 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 추가 메타 정보 (요구 순서: 글/그림, 제작사, 원천원작, 원천 원작 링크) -->
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col
|
<v-col
|
||||||
cols="12"
|
cols="12"
|
||||||
md="6"
|
md="6"
|
||||||
>
|
>
|
||||||
<v-switch
|
<v-text-field
|
||||||
v-model="form.isAdult"
|
v-model="form.writer"
|
||||||
label="19금 여부"
|
label="글/그림"
|
||||||
inset
|
outlined
|
||||||
|
dense
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
|
>
|
||||||
|
<v-text-field
|
||||||
|
v-model="form.studio"
|
||||||
|
label="제작사"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
|
>
|
||||||
|
<v-text-field
|
||||||
|
v-model="form.originalWork"
|
||||||
|
label="원천 원작"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col
|
<v-col
|
||||||
@@ -110,7 +137,7 @@
|
|||||||
>
|
>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="form.originalLink"
|
v-model="form.originalLink"
|
||||||
label="원작 링크"
|
label="원천 원작 링크"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
:rules="originalLinkRules"
|
:rules="originalLinkRules"
|
||||||
@@ -119,6 +146,116 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="12"
|
||||||
|
>
|
||||||
|
<v-switch
|
||||||
|
v-model="form.isAdult"
|
||||||
|
label="19금 여부"
|
||||||
|
inset
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 원작 링크(여러 개) 추가 -->
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-divider class="my-4" />
|
||||||
|
<h3 class="mb-2">
|
||||||
|
원작 링크
|
||||||
|
</h3>
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="11">
|
||||||
|
<v-text-field
|
||||||
|
v-model="newOriginalLink"
|
||||||
|
label="원작 링크 추가"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
@keyup.enter="addOriginalLink"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="1">
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
class="mt-1"
|
||||||
|
block
|
||||||
|
:disabled="!newOriginalLink || !newOriginalLink.trim()"
|
||||||
|
@click="addOriginalLink"
|
||||||
|
>
|
||||||
|
추가
|
||||||
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-card
|
||||||
|
outlined
|
||||||
|
class="mt-2"
|
||||||
|
>
|
||||||
|
<v-list v-if="form.originalLinks && form.originalLinks.length > 0">
|
||||||
|
<v-list-item
|
||||||
|
v-for="(link, idx) in form.originalLinks"
|
||||||
|
:key="idx"
|
||||||
|
>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title class="text-truncate">
|
||||||
|
{{ link }}
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
<v-list-item-action>
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="error"
|
||||||
|
@click="removeOriginalLink(idx)"
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
<v-card-text
|
||||||
|
v-else
|
||||||
|
class="grey--text"
|
||||||
|
>
|
||||||
|
추가된 원작 링크가 없습니다.
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 태그 -->
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-divider class="my-4" />
|
||||||
|
<h3 class="mb-2">
|
||||||
|
태그
|
||||||
|
</h3>
|
||||||
|
<v-combobox
|
||||||
|
v-model="form.tags"
|
||||||
|
multiple
|
||||||
|
chips
|
||||||
|
small-chips
|
||||||
|
deletable-chips
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
label="태그를 입력 후 엔터로 추가"
|
||||||
|
@keydown.space.prevent="onTagSpace"
|
||||||
|
>
|
||||||
|
<template v-slot:selection="{ attrs, item, select, selected }">
|
||||||
|
<v-chip
|
||||||
|
v-bind="attrs"
|
||||||
|
:input-value="selected"
|
||||||
|
close
|
||||||
|
@click="select"
|
||||||
|
@click:close="removeTag(item)"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</v-chip>
|
||||||
|
</template>
|
||||||
|
</v-combobox>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-textarea
|
<v-textarea
|
||||||
@@ -159,6 +296,7 @@ export default {
|
|||||||
isEdit: false,
|
isEdit: false,
|
||||||
isFormValid: false,
|
isFormValid: false,
|
||||||
previewImage: null,
|
previewImage: null,
|
||||||
|
newOriginalLink: '',
|
||||||
form: {
|
form: {
|
||||||
id: null,
|
id: null,
|
||||||
image: null,
|
image: null,
|
||||||
@@ -168,13 +306,18 @@ export default {
|
|||||||
category: '',
|
category: '',
|
||||||
isAdult: false,
|
isAdult: false,
|
||||||
description: '',
|
description: '',
|
||||||
originalLink: ''
|
originalLink: '', // 원천 원작 링크(파라미터명 유지)
|
||||||
|
originalWork: '',
|
||||||
|
writer: '',
|
||||||
|
studio: '',
|
||||||
|
originalLinks: [], // 추가 원작 링크들
|
||||||
|
tags: []
|
||||||
},
|
},
|
||||||
originalInitial: null,
|
originalInitial: null,
|
||||||
imageRules: [v => (this.isEdit ? true : (!!v || '이미지를 선택하세요'))],
|
imageRules: [v => (this.isEdit ? true : (!!v || '이미지를 선택하세요'))],
|
||||||
contentTypeRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '콘텐츠 타입은 필수입니다'))],
|
contentTypeRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '콘텐츠 타입은 필수입니다'))],
|
||||||
categoryRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '카테고리는 필수입니다'))],
|
categoryRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '카테고리는 필수입니다'))],
|
||||||
originalLinkRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '원작 링크는 필수입니다'))],
|
originalLinkRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '원천 원작 링크는 필수입니다'))],
|
||||||
descriptionRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '작품 소개는 필수입니다'))]
|
descriptionRules: [v => (this.isEdit ? true : (!!(v && v.toString().trim()) || '작품 소개는 필수입니다'))]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -184,8 +327,11 @@ export default {
|
|||||||
},
|
},
|
||||||
hasNonImageChanges() {
|
hasNonImageChanges() {
|
||||||
if (!this.isEdit || !this.originalInitial) return false;
|
if (!this.isEdit || !this.originalInitial) return false;
|
||||||
const fields = ['title', 'contentType', 'category', 'isAdult', 'description', 'originalLink'];
|
const fields = ['title', 'contentType', 'category', 'isAdult', 'description', 'originalLink', 'originalWork', 'writer', 'studio'];
|
||||||
return fields.some(f => this.form[f] !== this.originalInitial[f]);
|
const basicChanged = fields.some(f => this.form[f] !== this.originalInitial[f]);
|
||||||
|
const arraysChanged = !this.arraysEqual(this.form.originalLinks, this.originalInitial.originalLinks)
|
||||||
|
|| !this.arraysEqual(this.form.tags, this.originalInitial.tags);
|
||||||
|
return basicChanged || arraysChanged;
|
||||||
},
|
},
|
||||||
hasEditChanges() {
|
hasEditChanges() {
|
||||||
return this.imageChanged || this.hasNonImageChanges;
|
return this.imageChanged || this.hasNonImageChanges;
|
||||||
@@ -219,6 +365,44 @@ export default {
|
|||||||
notifyError(message) { this.$dialog.notify.error(message) },
|
notifyError(message) { this.$dialog.notify.error(message) },
|
||||||
notifySuccess(message) { this.$dialog.notify.success(message) },
|
notifySuccess(message) { this.$dialog.notify.success(message) },
|
||||||
goBack() { this.$router.push('/original-work') },
|
goBack() { this.$router.push('/original-work') },
|
||||||
|
arraysEqual(a, b) {
|
||||||
|
const arrA = Array.isArray(a) ? a : [];
|
||||||
|
const arrB = Array.isArray(b) ? b : [];
|
||||||
|
if (arrA.length !== arrB.length) return false;
|
||||||
|
for (let i = 0; i < arrA.length; i++) {
|
||||||
|
if (arrA[i] !== arrB[i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
addOriginalLink() {
|
||||||
|
if (!this.newOriginalLink || !this.newOriginalLink.trim()) return;
|
||||||
|
const val = this.newOriginalLink.trim();
|
||||||
|
if (!this.form.originalLinks) this.form.originalLinks = [];
|
||||||
|
if (!this.form.originalLinks.includes(val)) {
|
||||||
|
this.form.originalLinks.push(val);
|
||||||
|
}
|
||||||
|
this.newOriginalLink = '';
|
||||||
|
},
|
||||||
|
removeOriginalLink(index) {
|
||||||
|
if (!this.form.originalLinks) return;
|
||||||
|
this.form.originalLinks.splice(index, 1);
|
||||||
|
},
|
||||||
|
onTagSpace() {
|
||||||
|
// CharacterForm의 태그 방식과 유사: 마지막 항목을 공백 기준으로 확정
|
||||||
|
if (!Array.isArray(this.form.tags)) this.form.tags = [];
|
||||||
|
const last = this.form.tags[this.form.tags.length - 1];
|
||||||
|
if (typeof last === 'string' && last.trim()) {
|
||||||
|
let processed = last.trim().replace(/\s+/g, '');
|
||||||
|
if (processed.length > 50) processed = processed.substring(0, 50);
|
||||||
|
this.form.tags.splice(this.form.tags.length - 1, 1, processed);
|
||||||
|
this.$nextTick(() => this.form.tags.push(''));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeTag(item) {
|
||||||
|
if (!Array.isArray(this.form.tags)) return;
|
||||||
|
const idx = this.form.tags.indexOf(item);
|
||||||
|
if (idx >= 0) this.form.tags.splice(idx, 1);
|
||||||
|
},
|
||||||
async load(id) {
|
async load(id) {
|
||||||
try {
|
try {
|
||||||
const res = await getOriginal(id);
|
const res = await getOriginal(id);
|
||||||
@@ -233,7 +417,12 @@ export default {
|
|||||||
category: d.category || '',
|
category: d.category || '',
|
||||||
isAdult: !!d.isAdult,
|
isAdult: !!d.isAdult,
|
||||||
description: d.description || '',
|
description: d.description || '',
|
||||||
originalLink: d.originalLink || ''
|
originalLink: d.originalLink || '',
|
||||||
|
originalWork: d.originalWork || '',
|
||||||
|
writer: d.writer || '',
|
||||||
|
studio: d.studio || '',
|
||||||
|
originalLinks: Array.isArray(d.originalLinks) ? d.originalLinks.slice() : [],
|
||||||
|
tags: Array.isArray(d.tags) ? d.tags.slice() : []
|
||||||
}
|
}
|
||||||
this.originalInitial = {
|
this.originalInitial = {
|
||||||
id: d.id,
|
id: d.id,
|
||||||
@@ -243,7 +432,12 @@ export default {
|
|||||||
category: d.category || '',
|
category: d.category || '',
|
||||||
isAdult: !!d.isAdult,
|
isAdult: !!d.isAdult,
|
||||||
description: d.description || '',
|
description: d.description || '',
|
||||||
originalLink: d.originalLink || ''
|
originalLink: d.originalLink || '',
|
||||||
|
originalWork: d.originalWork || '',
|
||||||
|
writer: d.writer || '',
|
||||||
|
studio: d.studio || '',
|
||||||
|
originalLinks: Array.isArray(d.originalLinks) ? d.originalLinks.slice() : [],
|
||||||
|
tags: Array.isArray(d.tags) ? d.tags.slice() : []
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notifyError('상세 조회 실패');
|
this.notifyError('상세 조회 실패');
|
||||||
@@ -261,7 +455,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
const fields = ['title', 'contentType', 'category', 'isAdult', 'description', 'originalLink'];
|
const fields = ['title', 'contentType', 'category', 'isAdult', 'description', 'originalLink', 'originalWork', 'writer', 'studio'];
|
||||||
const patch = { id: this.form.id };
|
const patch = { id: this.form.id };
|
||||||
if (this.originalInitial) {
|
if (this.originalInitial) {
|
||||||
fields.forEach(f => {
|
fields.forEach(f => {
|
||||||
@@ -269,6 +463,12 @@ export default {
|
|||||||
patch[f] = this.form[f];
|
patch[f] = this.form[f];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (!this.arraysEqual(this.form.originalLinks, this.originalInitial.originalLinks)) {
|
||||||
|
patch.originalLinks = this.form.originalLinks;
|
||||||
|
}
|
||||||
|
if (!this.arraysEqual(this.form.tags, this.originalInitial.tags)) {
|
||||||
|
patch.tags = this.form.tags;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const image = this.form.image || null;
|
const image = this.form.image || null;
|
||||||
if (Object.keys(patch).length === 1 && !image) {
|
if (Object.keys(patch).length === 1 && !image) {
|
||||||
|
@@ -53,6 +53,24 @@
|
|||||||
<template v-slot:item.communitySettlementRatio="{ item }">
|
<template v-slot:item.communitySettlementRatio="{ item }">
|
||||||
{{ item.communitySettlementRatio }}%
|
{{ item.communitySettlementRatio }}%
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:item.actions="{ item }">
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="primary"
|
||||||
|
text
|
||||||
|
@click="openEdit(item)"
|
||||||
|
>
|
||||||
|
수정
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="red"
|
||||||
|
text
|
||||||
|
@click="confirmDelete(item)"
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -73,13 +91,20 @@
|
|||||||
persistent
|
persistent
|
||||||
>
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>크리에이터 정산비율</v-card-title>
|
<v-card-title>{{ is_edit ? '크리에이터 정산비율 수정' : '크리에이터 정산비율' }}</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text v-show="!is_edit">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="creator_settlement_ratio.creator_id"
|
v-model="creator_settlement_ratio.creator_id"
|
||||||
label="크리에이터 번호"
|
label="크리에이터 번호"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<v-card-text v-show="is_edit">
|
||||||
|
<v-text-field
|
||||||
|
v-model="creator_settlement_ratio.nickname"
|
||||||
|
disabled
|
||||||
|
label="크리에이터 닉네임"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="creator_settlement_ratio.subsidy"
|
v-model="creator_settlement_ratio.subsidy"
|
||||||
@@ -118,7 +143,7 @@
|
|||||||
text
|
text
|
||||||
@click="validate"
|
@click="validate"
|
||||||
>
|
>
|
||||||
등록하기
|
{{ is_edit ? '수정하기' : '등록하기' }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -142,6 +167,8 @@ export default {
|
|||||||
items: [],
|
items: [],
|
||||||
creator_settlement_ratio: {},
|
creator_settlement_ratio: {},
|
||||||
show_write_dialog: false,
|
show_write_dialog: false,
|
||||||
|
is_edit: false,
|
||||||
|
editing_item_id: null,
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
text: '닉네임',
|
text: '닉네임',
|
||||||
@@ -173,6 +200,12 @@ export default {
|
|||||||
sortable: false,
|
sortable: false,
|
||||||
value: 'communitySettlementRatio',
|
value: 'communitySettlementRatio',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: '관리',
|
||||||
|
align: 'center',
|
||||||
|
sortable: false,
|
||||||
|
value: 'actions',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -191,11 +224,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
showWriteDialog() {
|
showWriteDialog() {
|
||||||
|
this.is_edit = false
|
||||||
|
this.editing_item_id = null
|
||||||
|
this.creator_settlement_ratio = {}
|
||||||
this.show_write_dialog = true
|
this.show_write_dialog = true
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.creator_settlement_ratio = {}
|
this.creator_settlement_ratio = {}
|
||||||
|
this.is_edit = false
|
||||||
|
this.editing_item_id = null
|
||||||
this.show_write_dialog = false
|
this.show_write_dialog = false
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -225,7 +263,11 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createCreatorSettlementRatio();
|
if (this.is_edit) {
|
||||||
|
this.updateCreatorSettlementRatio();
|
||||||
|
} else {
|
||||||
|
this.createCreatorSettlementRatio();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async createCreatorSettlementRatio() {
|
async createCreatorSettlementRatio() {
|
||||||
@@ -253,6 +295,71 @@ export default {
|
|||||||
this.is_loading = false
|
this.is_loading = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateCreatorSettlementRatio() {
|
||||||
|
if (this.is_loading) return;
|
||||||
|
this.is_loading = true
|
||||||
|
try {
|
||||||
|
// 수정은 생성과 동일한 파라미터를 전송 (memberId 기준)
|
||||||
|
const payload = { ...this.creator_settlement_ratio }
|
||||||
|
const res = await api.updateCreatorSettlementRatio(payload)
|
||||||
|
if (res.status === 200 && res.data.success === true) {
|
||||||
|
this.cancel()
|
||||||
|
this.notifySuccess(res.data.message || '수정되었습니다.')
|
||||||
|
this.items = []
|
||||||
|
await this.getSettlementRatio()
|
||||||
|
} else {
|
||||||
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
} finally {
|
||||||
|
this.is_loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
openEdit(item) {
|
||||||
|
this.is_edit = true
|
||||||
|
this.editing_item_id = null
|
||||||
|
this.creator_settlement_ratio = {
|
||||||
|
creator_id: item.memberId,
|
||||||
|
nickname: item.nickname,
|
||||||
|
subsidy: item.subsidy,
|
||||||
|
liveSettlementRatio: item.liveSettlementRatio,
|
||||||
|
contentSettlementRatio: item.contentSettlementRatio,
|
||||||
|
communitySettlementRatio: item.communitySettlementRatio,
|
||||||
|
}
|
||||||
|
this.show_write_dialog = true
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmDelete(item) {
|
||||||
|
try {
|
||||||
|
const ok = await this.$dialog.confirm({ text: '삭제하시겠습니까?', title: '확인', actions: { false: '취소', true: '삭제' } })
|
||||||
|
if (!ok) return
|
||||||
|
} catch (e) {
|
||||||
|
// 일부 구현체는 confirm이 boolean이 아닌 경우가 있음
|
||||||
|
}
|
||||||
|
this.deleteCreatorSettlementRatio(item)
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteCreatorSettlementRatio(item) {
|
||||||
|
if (this.is_loading) return;
|
||||||
|
this.is_loading = true
|
||||||
|
try {
|
||||||
|
const memberId = item.memberId
|
||||||
|
const res = await api.deleteCreatorSettlementRatio(memberId)
|
||||||
|
if (res.status === 200 && res.data.success === true) {
|
||||||
|
this.notifySuccess(res.data.message || '삭제되었습니다.')
|
||||||
|
this.items = this.items.filter(x => (x.memberId) !== memberId)
|
||||||
|
} else {
|
||||||
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
} finally {
|
||||||
|
this.is_loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async getSettlementRatio() {
|
async getSettlementRatio() {
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
|
|
||||||
@@ -279,10 +386,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async next() {
|
async next() {
|
||||||
if (this.search_word.length < 2) {
|
|
||||||
this.search_word = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.getSettlementRatio()
|
await this.getSettlementRatio()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user