test #57
|
@ -93,6 +93,58 @@ async function removeItemInCuration(curationId, itemId){
|
|||
)
|
||||
}
|
||||
|
||||
async function updateItemInCurationOrders(curationId, itemIds) {
|
||||
return Vue.axios.put(
|
||||
"/admin/audio-content/curation/orders/item",
|
||||
{curationId: curationId, itemIds: itemIds}
|
||||
)
|
||||
}
|
||||
|
||||
async function getHashTagCurations() {
|
||||
return Vue.axios.get("/admin/audio-content/tag/curation")
|
||||
}
|
||||
|
||||
async function saveHashTagCuration(request) {
|
||||
return Vue.axios.post("/admin/audio-content/tag/curation", request)
|
||||
}
|
||||
|
||||
async function modifyHashTagCuration(request) {
|
||||
return Vue.axios.put("/admin/audio-content/tag/curation", request)
|
||||
}
|
||||
|
||||
async function updateHashTagCurationOrders(ids) {
|
||||
return Vue.axios.put('/admin/audio-content/tag/curation/orders', {ids: ids})
|
||||
}
|
||||
|
||||
async function getHashTagCurationItems(curationId) {
|
||||
return Vue.axios.get('/admin/audio-content/tag/curation/items?curationId=' + curationId)
|
||||
}
|
||||
|
||||
async function addItemToHashTagCuration(curationId, itemIdList) {
|
||||
return Vue.axios.post(
|
||||
"/admin/audio-content/tag/curation/add/item",
|
||||
{curationId: curationId, itemIdList: itemIdList}
|
||||
)
|
||||
}
|
||||
|
||||
async function removeItemInHashTagCuration(curationId, itemId) {
|
||||
return Vue.axios.put(
|
||||
"/admin/audio-content/tag/curation/remove/item",
|
||||
{curationId: curationId, itemId: itemId}
|
||||
)
|
||||
}
|
||||
|
||||
async function searchHashTagContentItem(curationId, searchWord) {
|
||||
return Vue.axios.get("/admin/audio-content/tag/curation/search/content?curationId=" + curationId + "&searchWord=" + searchWord)
|
||||
}
|
||||
|
||||
async function updateItemInHashTagCurationOrders(curationId, itemIds) {
|
||||
return Vue.axios.put(
|
||||
"/admin/audio-content/tag/curation/orders/item",
|
||||
{curationId: curationId, itemIds: itemIds}
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
getAudioContentList,
|
||||
searchAudioContent,
|
||||
|
@ -111,5 +163,15 @@ export {
|
|||
searchSeriesItem,
|
||||
searchContentItem,
|
||||
addItemToCuration,
|
||||
removeItemInCuration
|
||||
removeItemInCuration,
|
||||
updateItemInCurationOrders,
|
||||
getHashTagCurations,
|
||||
saveHashTagCuration,
|
||||
modifyHashTagCuration,
|
||||
updateHashTagCurationOrders,
|
||||
getHashTagCurationItems,
|
||||
addItemToHashTagCuration,
|
||||
removeItemInHashTagCuration,
|
||||
searchHashTagContentItem,
|
||||
updateItemInHashTagCurationOrders
|
||||
}
|
||||
|
|
|
@ -85,6 +85,16 @@ const routes = [
|
|||
name: 'ContentCurationDetail',
|
||||
component: () => import(/* webpackChunkName: "content" */ '../views/Content/ContentCurationDetail.vue')
|
||||
},
|
||||
{
|
||||
path: '/content/tag/curation',
|
||||
name: 'ContentHashTagCuration',
|
||||
component: () => import(/* webpackChunkName: "content" */ '../views/Content/ContentHashTagCuration.vue')
|
||||
},
|
||||
{
|
||||
path: '/content/tag/curation/detail',
|
||||
name: 'ContentHashTagCurationDetail',
|
||||
component: () => import(/* webpackChunkName: "content" */ '../views/Content/ContentHashTagCurationDetail.vue')
|
||||
},
|
||||
{
|
||||
path: '/content/series/list',
|
||||
name: 'ContentSeriesList',
|
||||
|
|
|
@ -421,7 +421,7 @@ export default {
|
|||
if (res.status === 200 && res.data.success === true) {
|
||||
const data = res.data.data
|
||||
|
||||
this.tabs = data.filter(item => item.title !== '홈' && item.title !== '단편')
|
||||
this.tabs = data.filter(item => item.title !== '홈')
|
||||
this.selected_tab_id = this.tabs[0].tabId
|
||||
await this.getCurations()
|
||||
} else {
|
||||
|
|
|
@ -94,7 +94,11 @@
|
|||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<draggable
|
||||
v-model="items"
|
||||
tag="tbody"
|
||||
@end="onDropCallback(items)"
|
||||
>
|
||||
<tr
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
|
@ -115,7 +119,7 @@
|
|||
</td>
|
||||
<td style="max-width: 200px !important; word-break:break-all; height: auto;">
|
||||
<vue-show-more-text
|
||||
:text="item.detail"
|
||||
:text="item.desc"
|
||||
:lines="3"
|
||||
/>
|
||||
</td>
|
||||
|
@ -137,7 +141,7 @@
|
|||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</draggable>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
|
@ -402,13 +406,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Draggable from 'vuedraggable';
|
||||
import * as api from "@/api/audio_content"
|
||||
import VueShowMoreText from 'vue-show-more-text'
|
||||
|
||||
export default {
|
||||
name: 'ContentCurationDetail',
|
||||
|
||||
components: {VueShowMoreText},
|
||||
components: {VueShowMoreText, Draggable},
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
@ -487,6 +492,26 @@ export default {
|
|||
this.search_item_list.push(item)
|
||||
},
|
||||
|
||||
async onDropCallback(items) {
|
||||
const ids = items.map((item) => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
try {
|
||||
this.is_loading = true
|
||||
const res = await api.updateItemInCurationOrders(this.curation_id, ids)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.notifySuccess(res.data.message)
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async searchContentItem() {
|
||||
if (this.search_word.length < 2) {
|
||||
this.notifyError('검색어를 2글자 이상 입력하세요.')
|
||||
|
@ -586,6 +611,7 @@ export default {
|
|||
const res = await api.getCurationItems(this.curation_id)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.items = res.data.data
|
||||
console.log(this.items)
|
||||
} else {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
|
|
|
@ -0,0 +1,429 @@
|
|||
<template>
|
||||
<div>
|
||||
<v-toolbar dark>
|
||||
<v-spacer />
|
||||
<v-toolbar-title>태그 큐레이션</v-toolbar-title>
|
||||
<v-spacer />
|
||||
</v-toolbar>
|
||||
|
||||
<br>
|
||||
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-spacer />
|
||||
<v-col cols="3">
|
||||
<v-btn
|
||||
block
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
depressed
|
||||
@click="showWriteDialog"
|
||||
>
|
||||
태그 등록
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="curations"
|
||||
:loading="is_loading"
|
||||
item-key="id"
|
||||
class="elevation-1"
|
||||
hide-default-footer
|
||||
disable-pagination
|
||||
>
|
||||
<template v-slot:body="props">
|
||||
<draggable
|
||||
v-model="props.items"
|
||||
tag="tbody"
|
||||
@end="onDropCallback(props.items)"
|
||||
>
|
||||
<tr
|
||||
v-for="(item, index) in props.items"
|
||||
:key="index"
|
||||
>
|
||||
<td
|
||||
@click="handleItemClick(item)"
|
||||
>
|
||||
{{ item.tag }}
|
||||
</td>
|
||||
<td>
|
||||
<h3 v-if="item.isAdult">
|
||||
O
|
||||
</h3>
|
||||
<h3 v-else>
|
||||
X
|
||||
</h3>
|
||||
</td>
|
||||
<td>
|
||||
<v-row>
|
||||
<v-col />
|
||||
<v-col>
|
||||
<v-btn
|
||||
:disabled="is_loading"
|
||||
@click="showModifyDialog(item)"
|
||||
>
|
||||
수정
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col>
|
||||
<v-btn
|
||||
:disabled="is_loading"
|
||||
@click="deleteConfirm(item)"
|
||||
>
|
||||
삭제
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col />
|
||||
</v-row>
|
||||
</td>
|
||||
</tr>
|
||||
</draggable>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<v-row>
|
||||
<v-dialog
|
||||
v-model="show_write_dialog"
|
||||
max-width="1000px"
|
||||
persistent
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title v-if="is_modify === true">
|
||||
태그 큐레이션 수정
|
||||
</v-card-title>
|
||||
<v-card-title v-else>
|
||||
태그 큐레이션 등록
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row align="center">
|
||||
<v-col cols="4">
|
||||
태그
|
||||
</v-col>
|
||||
<v-col cols="8">
|
||||
<v-text-field
|
||||
v-model="curation.tag"
|
||||
label="태그"
|
||||
required
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col cols="4">
|
||||
19금
|
||||
</v-col>
|
||||
<v-col cols="8">
|
||||
<input
|
||||
v-model="curation.is_adult"
|
||||
type="checkbox"
|
||||
>
|
||||
</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="is_modify === true"
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="modify"
|
||||
>
|
||||
수정
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-else
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="submit"
|
||||
>
|
||||
등록
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-row>
|
||||
|
||||
<v-dialog
|
||||
v-model="show_delete_confirm_dialog"
|
||||
max-width="400px"
|
||||
persistent
|
||||
>
|
||||
<v-card>
|
||||
<v-card-text />
|
||||
<v-card-text>
|
||||
"{{ selected_curation.tag }}"을 삭제하시겠습니까?
|
||||
</v-card-text>
|
||||
<v-card-actions v-show="!is_loading">
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="deleteCancel"
|
||||
>
|
||||
취소
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="deleteCuration"
|
||||
>
|
||||
확인
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Draggable from 'vuedraggable';
|
||||
import * as api from "@/api/audio_content"
|
||||
|
||||
export default {
|
||||
name: "ContentHashTagCuration",
|
||||
components: {Draggable},
|
||||
data() {
|
||||
return {
|
||||
is_loading: false,
|
||||
is_modify: false,
|
||||
show_delete_confirm_dialog: false,
|
||||
show_write_dialog: false,
|
||||
selected_curation: {},
|
||||
curation: {is_adult: false},
|
||||
curations: [],
|
||||
headers: [
|
||||
{
|
||||
text: '태그',
|
||||
align: 'center',
|
||||
sortable: false,
|
||||
value: 'tag',
|
||||
},
|
||||
{
|
||||
text: '19금',
|
||||
align: 'center',
|
||||
sortable: false,
|
||||
value: 'isAdult',
|
||||
},
|
||||
{
|
||||
text: '관리',
|
||||
align: 'center',
|
||||
sortable: false,
|
||||
value: 'management'
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
await this.getHashTagCurations();
|
||||
},
|
||||
|
||||
methods: {
|
||||
notifyError(message) {
|
||||
this.$dialog.notify.error(message)
|
||||
},
|
||||
|
||||
notifySuccess(message) {
|
||||
this.$dialog.notify.success(message)
|
||||
},
|
||||
|
||||
showWriteDialog() {
|
||||
this.show_write_dialog = true
|
||||
},
|
||||
|
||||
showModifyDialog(item) {
|
||||
this.is_modify = true
|
||||
this.selected_curation = item
|
||||
|
||||
this.curation.id = item.id
|
||||
this.curation.tag = item.tag
|
||||
this.curation.is_adult = item.isAdult
|
||||
|
||||
this.show_write_dialog = true
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.curation = {is_adult: false}
|
||||
this.selected_curation = {}
|
||||
|
||||
this.is_modify = false
|
||||
this.show_write_dialog = false
|
||||
},
|
||||
|
||||
handleItemClick(item) {
|
||||
this.$router.push(
|
||||
{
|
||||
name: 'ContentHashTagCurationDetail',
|
||||
params: {
|
||||
curation_id: item.id,
|
||||
tag: item.tag,
|
||||
is_adult: item.isAdult
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
|
||||
validate() {
|
||||
if (
|
||||
this.curation.tag === null ||
|
||||
this.curation.tag === undefined ||
|
||||
this.curation.tag.trim().length <= 0
|
||||
) {
|
||||
this.notifyError("태그를 입력하세요")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
|
||||
deleteConfirm(curation) {
|
||||
this.selected_curation = curation
|
||||
this.show_delete_confirm_dialog = true
|
||||
},
|
||||
|
||||
deleteCancel() {
|
||||
this.selected_curation = {}
|
||||
this.show_delete_confirm_dialog = false
|
||||
},
|
||||
|
||||
async getHashTagCurations() {
|
||||
this.is_loading = true
|
||||
|
||||
try {
|
||||
const res = await api.getHashTagCurations()
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.curations = res.data.data
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (!this.validate()) return;
|
||||
if (this.is_loading) return;
|
||||
|
||||
this.isLoading = true
|
||||
|
||||
try {
|
||||
const request = {
|
||||
tag: this.curation.tag,
|
||||
isAdult: this.curation.is_adult
|
||||
}
|
||||
|
||||
const res = await api.saveHashTagCuration(request)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.cancel()
|
||||
this.notifySuccess('등록되었습니다.')
|
||||
|
||||
this.curations = []
|
||||
await this.getHashTagCurations()
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async modify() {
|
||||
if (!this.validate()) return;
|
||||
if (this.is_loading) return;
|
||||
this.isLoading = true
|
||||
|
||||
try {
|
||||
let request = {id: this.curation.id}
|
||||
if (this.selected_curation.tag !== this.curation.tag && this.curation.tag.trim().length > 0) {
|
||||
request.tag = this.curation.tag
|
||||
}
|
||||
|
||||
if (this.selected_curation.isAdult !== this.curation.is_adult) {
|
||||
request.isAdult = this.curation.is_adult
|
||||
}
|
||||
|
||||
const res = await api.modifyHashTagCuration(request)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.cancel()
|
||||
this.notifySuccess('수정되었습니다.')
|
||||
|
||||
this.curations = []
|
||||
await this.getHashTagCurations()
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async deleteCuration() {
|
||||
if (this.is_loading) return;
|
||||
this.is_loading = true
|
||||
|
||||
try {
|
||||
let request = {id: this.selected_curation.id, isActive: false}
|
||||
|
||||
const res = await api.modifyHashTagCuration(request)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.show_delete_confirm_dialog = false
|
||||
this.cancel()
|
||||
this.notifySuccess('삭제되었습니다.')
|
||||
|
||||
this.curations = []
|
||||
await this.getHashTagCurations()
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async onDropCallback(items) {
|
||||
this.curations = items
|
||||
const ids = items.map((item) => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
try {
|
||||
this.is_loading = true
|
||||
const res = await api.updateHashTagCurationOrders(ids)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.notifySuccess(res.data.message)
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,450 @@
|
|||
<template>
|
||||
<div>
|
||||
<v-toolbar dark>
|
||||
<v-spacer />
|
||||
<v-toolbar-title>{{ tag }}</v-toolbar-title>
|
||||
<v-spacer />
|
||||
</v-toolbar>
|
||||
|
||||
<br>
|
||||
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
cols="4"
|
||||
align="right"
|
||||
>
|
||||
19금 :
|
||||
</v-col>
|
||||
<v-col
|
||||
align="left"
|
||||
>
|
||||
<div v-if="is_adult">
|
||||
O
|
||||
</div>
|
||||
<div v-else>
|
||||
X
|
||||
</div>
|
||||
</v-col>
|
||||
<v-spacer />
|
||||
<v-col>
|
||||
<v-btn
|
||||
block
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
depressed
|
||||
@click="showAddContent"
|
||||
>
|
||||
콘텐츠 등록
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<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">
|
||||
19금
|
||||
</th>
|
||||
<th class="text-center">
|
||||
관리
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<draggable
|
||||
v-model="items"
|
||||
tag="tbody"
|
||||
@end="onDropCallback(items)"
|
||||
>
|
||||
<tr
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
>
|
||||
<td align="center">
|
||||
<v-img
|
||||
max-width="70"
|
||||
max-height="70"
|
||||
:src="item.coverImageUrl"
|
||||
class="rounded-circle"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<vue-show-more-text
|
||||
:text="item.title"
|
||||
:lines="3"
|
||||
/>
|
||||
</td>
|
||||
<td style="max-width: 200px !important; word-break:break-all; height: auto;">
|
||||
<vue-show-more-text
|
||||
:text="item.desc"
|
||||
:lines="3"
|
||||
/>
|
||||
</td>
|
||||
<td>{{ item.creatorNickname }}</td>
|
||||
<td>
|
||||
<div v-if="item.isAdult">
|
||||
O
|
||||
</div>
|
||||
<div v-else>
|
||||
X
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<v-btn
|
||||
:disabled="is_loading"
|
||||
@click="deleteConfirm(item)"
|
||||
>
|
||||
삭제
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</draggable>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<v-dialog
|
||||
v-model="show_add_content_dialog"
|
||||
max-width="1000px"
|
||||
persistent
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
콘텐츠 추가
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-text-field
|
||||
v-model="search_word"
|
||||
label="콘텐츠 제목"
|
||||
@keyup.enter="searchContentItem"
|
||||
>
|
||||
<v-btn
|
||||
slot="append"
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
@click="searchContentItem"
|
||||
>
|
||||
검색
|
||||
</v-btn>
|
||||
</v-text-field>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="search_item_list.length > 0 || add_item_list.length > 0">
|
||||
<v-row>
|
||||
<v-col>
|
||||
검색결과
|
||||
<v-simple-table>
|
||||
<template v-slot:default>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
제목
|
||||
</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in search_item_list"
|
||||
:key="item.id"
|
||||
>
|
||||
<td>{{ item.title }}</td>
|
||||
<td>
|
||||
<v-btn
|
||||
color="#3bb9f1"
|
||||
@click="addItem(item)"
|
||||
>
|
||||
추가
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</v-col>
|
||||
<v-col v-if="add_item_list.length > 0">
|
||||
추가할 콘텐츠
|
||||
<v-simple-table>
|
||||
<template>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
제목
|
||||
</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in add_item_list"
|
||||
:key="item.id"
|
||||
>
|
||||
<td>{{ item.title }}</td>
|
||||
<td>
|
||||
<v-btn
|
||||
color="#3bb9f1"
|
||||
@click="removeItem(item)"
|
||||
>
|
||||
제거
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
</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
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="addItemInHashTagCuration"
|
||||
>
|
||||
추가
|
||||
</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-if="selected_item !== null">
|
||||
{{ selected_item.title }} 삭제하시겠습니까?
|
||||
</v-card-text>
|
||||
<v-card-text v-else>
|
||||
삭제하시겠습니까?
|
||||
</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="removeItemInHashTagCuration"
|
||||
>
|
||||
확인
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Draggable from 'vuedraggable';
|
||||
import * as api from "@/api/audio_content"
|
||||
import VueShowMoreText from 'vue-show-more-text'
|
||||
|
||||
export default {
|
||||
name: "ContentHashTagCurationDetail",
|
||||
|
||||
components: {VueShowMoreText, Draggable},
|
||||
|
||||
data() {
|
||||
return {
|
||||
is_loading: false,
|
||||
curation_id: 0,
|
||||
tag: '',
|
||||
is_adult: false,
|
||||
|
||||
items: [],
|
||||
|
||||
show_add_content_dialog: false,
|
||||
show_delete_confirm_dialog: false,
|
||||
|
||||
search_word: '',
|
||||
selected_item: null,
|
||||
add_item_list: [],
|
||||
search_item_list: [],
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
this.curation_id = this.$route.params.curation_id
|
||||
this.tag = this.$route.params.tag
|
||||
this.is_adult = this.$route.params.is_adult
|
||||
await this.getHashTagCurationItems()
|
||||
},
|
||||
|
||||
methods: {
|
||||
notifyError(message) {
|
||||
this.$dialog.notify.error(message)
|
||||
},
|
||||
|
||||
notifySuccess(message) {
|
||||
this.$dialog.notify.success(message)
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.search_word = ''
|
||||
this.add_item_list = []
|
||||
this.search_item_list = []
|
||||
this.selected_item = null
|
||||
this.show_add_content_dialog = false
|
||||
this.show_delete_confirm_dialog = false
|
||||
},
|
||||
|
||||
deleteConfirm(item) {
|
||||
this.selected_item = item
|
||||
this.show_delete_confirm_dialog = true
|
||||
},
|
||||
|
||||
showAddContent() {
|
||||
this.show_add_content_dialog = true
|
||||
},
|
||||
|
||||
addItem(item) {
|
||||
this.search_item_list = this.search_item_list.filter((t) => {
|
||||
return t.id !== item.id
|
||||
});
|
||||
this.add_item_list.push(item)
|
||||
},
|
||||
|
||||
removeItem(item) {
|
||||
this.add_item_list = this.add_item_list.filter((t) => {
|
||||
return t.id !== item.id
|
||||
});
|
||||
this.search_item_list.push(item)
|
||||
},
|
||||
|
||||
async onDropCallback(items) {
|
||||
const ids = items.map((item) => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
try {
|
||||
this.is_loading = true
|
||||
const res = await api.updateItemInHashTagCurationOrders(this.curation_id, ids)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.notifySuccess(res.data.message)
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async searchContentItem() {
|
||||
if (this.search_word.length < 2) {
|
||||
this.notifyError('검색어를 2글자 이상 입력하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
this.is_loading = true
|
||||
|
||||
try {
|
||||
const res = await api.searchHashTagContentItem(this.curation_id, this.search_word)
|
||||
|
||||
if (res.data.success === true) {
|
||||
this.search_item_list = res.data.data
|
||||
if (res.data.data.length <= 0) {
|
||||
this.notifyError('검색결과가 없습니다.')
|
||||
}
|
||||
} else {
|
||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async addItemInHashTagCuration() {
|
||||
this.is_loading = true
|
||||
const itemIdList = this.add_item_list.map((item) => {
|
||||
return item.id
|
||||
})
|
||||
|
||||
try {
|
||||
const res = await api.addItemToHashTagCuration(this.curation_id, itemIdList)
|
||||
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.cancel()
|
||||
await this.getHashTagCurationItems()
|
||||
} else {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async removeItemInHashTagCuration() {
|
||||
this.is_loading = true
|
||||
|
||||
try {
|
||||
const res = await api.removeItemInHashTagCuration(this.curation_id, this.selected_item.id)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.cancel()
|
||||
await this.getHashTagCurationItems()
|
||||
} else {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async getHashTagCurationItems() {
|
||||
this.is_loading = true
|
||||
|
||||
try {
|
||||
const res = await api.getHashTagCurationItems(this.curation_id)
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
this.items = res.data.data
|
||||
console.log(this.items)
|
||||
} else {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
||||
} catch (e) {
|
||||
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
} finally {
|
||||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue