test #101
@@ -94,113 +94,135 @@ export default {
|
|||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
let res = await api.getMenus();
|
let res = await api.getMenus();
|
||||||
if (res.status === 200 && res.data.success === true && res.data.data.length > 0) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
this.items = res.data.data
|
// 기본 메뉴 설정 (API 결과가 비어있을 수 있음)
|
||||||
|
this.items = Array.isArray(res.data.data) ? res.data.data : []
|
||||||
|
|
||||||
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
|
// 현재 사용자 역할 확인
|
||||||
try {
|
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|
||||||
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
|
|| localStorage.role
|
||||||
if (seriesMenu) {
|
|
||||||
if (!Array.isArray(seriesMenu.items)) {
|
// ADMIN 권한 전용 추가 메뉴들
|
||||||
seriesMenu.items = seriesMenu.items ? [].concat(seriesMenu.items) : []
|
if (role === 'ADMIN') {
|
||||||
}
|
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
|
||||||
const exists = seriesMenu.items.some(ci => ci && ci.route === '/content/series/banner')
|
try {
|
||||||
if (!exists) {
|
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
|
||||||
seriesMenu.items.push({
|
if (seriesMenu) {
|
||||||
title: '배너 등록',
|
if (!Array.isArray(seriesMenu.items)) {
|
||||||
route: '/content/series/banner',
|
seriesMenu.items = seriesMenu.items ? [].concat(seriesMenu.items) : []
|
||||||
items: null
|
}
|
||||||
})
|
const exists = seriesMenu.items.some(ci => ci && ci.route === '/content/series/banner')
|
||||||
|
if (!exists) {
|
||||||
|
seriesMenu.items.push({
|
||||||
|
title: '배너 등록',
|
||||||
|
route: '/content/series/banner',
|
||||||
|
items: null
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
// 캐릭터 챗봇 메뉴 추가
|
// 캐릭터 챗봇 메뉴 추가
|
||||||
this.items.push({
|
this.items.push({
|
||||||
title: '캐릭터 챗봇',
|
title: '캐릭터 챗봇',
|
||||||
route: null,
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
title: '배너 등록',
|
|
||||||
route: '/character/banner',
|
|
||||||
items: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '캐릭터 리스트',
|
|
||||||
route: '/character',
|
|
||||||
items: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '큐레이션',
|
|
||||||
route: '/character/curation',
|
|
||||||
items: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '정산',
|
|
||||||
route: '/character/calculate',
|
|
||||||
items: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '원작',
|
|
||||||
route: '/original-work',
|
|
||||||
items: null
|
|
||||||
},
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
// 에이전트 관리 메뉴를 '크리에이터 관리' 바로 아래에 추가
|
|
||||||
try {
|
|
||||||
const insertAfterTitle = '크리에이터 관리'
|
|
||||||
const agentMenu = {
|
|
||||||
title: '에이전트 관리',
|
|
||||||
route: null,
|
route: null,
|
||||||
items: [
|
items: [
|
||||||
{ title: '에이전트 리스트', route: '/agent/list', items: null },
|
{
|
||||||
{ title: '에이전트 정산 비율', route: '/agent/settlement-ratio', items: null },
|
title: '배너 등록',
|
||||||
|
route: '/character/banner',
|
||||||
|
items: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '캐릭터 리스트',
|
||||||
|
route: '/character',
|
||||||
|
items: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '큐레이션',
|
||||||
|
route: '/character/curation',
|
||||||
|
items: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '정산',
|
||||||
|
route: '/character/calculate',
|
||||||
|
items: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '원작',
|
||||||
|
route: '/original-work',
|
||||||
|
items: null
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 에이전트 관리 메뉴를 '크리에이터 관리' 바로 아래에 추가
|
||||||
|
try {
|
||||||
|
const insertAfterTitle = '크리에이터 관리'
|
||||||
|
const agentMenu = {
|
||||||
|
title: '에이전트 관리',
|
||||||
|
route: null,
|
||||||
|
items: [
|
||||||
|
{ title: '에이전트 리스트', route: '/agent/list', items: null },
|
||||||
|
{ title: '에이전트 정산 비율', route: '/agent/settlement-ratio', items: null },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const idx = this.items.findIndex(m => m && m.title === insertAfterTitle)
|
||||||
|
if (idx >= 0) {
|
||||||
|
this.items.splice(idx + 1, 0, agentMenu)
|
||||||
|
} else {
|
||||||
|
// 기준 메뉴가 없으면 하단에 추가
|
||||||
|
this.items.push(agentMenu)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
const idx = this.items.findIndex(m => m && m.title === insertAfterTitle)
|
// 정산현황 메뉴에 '채널 후원 정산' 및 '오리지널 시리즈 정산' 추가
|
||||||
if (idx >= 0) {
|
try {
|
||||||
this.items.splice(idx + 1, 0, agentMenu)
|
const calculateMenu = this.items.find(m => m && m.title === '정산현황')
|
||||||
} else {
|
if (calculateMenu) {
|
||||||
// 기준 메뉴가 없으면 하단에 추가
|
if (!Array.isArray(calculateMenu.items)) {
|
||||||
this.items.push(agentMenu)
|
calculateMenu.items = calculateMenu.items ? [].concat(calculateMenu.items) : []
|
||||||
|
}
|
||||||
|
const exists = calculateMenu.items.some(ci => ci && ci.route === '/calculate/channel-donation')
|
||||||
|
if (!exists) {
|
||||||
|
calculateMenu.items.push({
|
||||||
|
title: '채널 후원 정산',
|
||||||
|
route: '/calculate/channel-donation',
|
||||||
|
items: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series')
|
||||||
|
if (!existsOriginal) {
|
||||||
|
calculateMenu.items.push({
|
||||||
|
title: '오리지널 시리즈 정산',
|
||||||
|
route: '/calculate/original-series',
|
||||||
|
items: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 정산현황 메뉴에 '채널 후원 정산' 추가
|
// 조회한 메뉴가 비어 있고, 콘텐츠 매니저라면 기본 메뉴 추가
|
||||||
try {
|
if (this.items.length === 0 && role === 'CONTENT_MANAGER') {
|
||||||
const calculateMenu = this.items.find(m => m && m.title === '정산현황')
|
this.items.push({
|
||||||
if (calculateMenu) {
|
title: '콘텐츠 리스트',
|
||||||
if (!Array.isArray(calculateMenu.items)) {
|
route: '/content/list',
|
||||||
calculateMenu.items = calculateMenu.items ? [].concat(calculateMenu.items) : []
|
items: null
|
||||||
}
|
})
|
||||||
const exists = calculateMenu.items.some(ci => ci && ci.route === '/calculate/channel-donation')
|
}
|
||||||
if (!exists) {
|
|
||||||
calculateMenu.items.push({
|
|
||||||
title: '채널 후원 정산',
|
|
||||||
route: '/calculate/channel-donation',
|
|
||||||
items: null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// '오리지널 시리즈 정산' 추가
|
// 그래도 비어있다면 이전 동작과 동일하게 처리
|
||||||
const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series')
|
if (this.items.length === 0) {
|
||||||
if (!existsOriginal) {
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||||
calculateMenu.items.push({
|
this.logout();
|
||||||
title: '오리지널 시리즈 정산',
|
|
||||||
route: '/calculate/original-series',
|
|
||||||
items: null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||||
|
|||||||
Reference in New Issue
Block a user