Merge pull request 'test' (#101) from test into main

Reviewed-on: #101
This commit is contained in:
2026-05-07 06:49:41 +00:00
5 changed files with 152 additions and 121 deletions

View File

@@ -1,7 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
async function login(email, password) { async function login(email, password) {
return Vue.axios.post('/member/login', { return Vue.axios.post('/admin/member/login', {
email, email,
password, password,
isAdmin: true, isAdmin: true,

View File

@@ -94,9 +94,16 @@ 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 : []
// 현재 사용자 역할 확인
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|| localStorage.role
// ADMIN 권한 전용 추가 메뉴들
if (role === 'ADMIN') {
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가 // '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
try { try {
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리') const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
@@ -173,7 +180,7 @@ export default {
// ignore // ignore
} }
// 정산현황 메뉴에 '채널 후원 정산' 추가 // 정산현황 메뉴에 '채널 후원 정산' 및 '오리지널 시리즈 정산' 추가
try { try {
const calculateMenu = this.items.find(m => m && m.title === '정산현황') const calculateMenu = this.items.find(m => m && m.title === '정산현황')
if (calculateMenu) { if (calculateMenu) {
@@ -189,7 +196,6 @@ export default {
}) })
} }
// '오리지널 시리즈 정산' 추가
const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series') const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series')
if (!existsOriginal) { if (!existsOriginal) {
calculateMenu.items.push({ calculateMenu.items.push({
@@ -202,6 +208,22 @@ export default {
} catch (e) { } catch (e) {
// ignore // ignore
} }
}
// 조회한 메뉴가 비어 있고, 콘텐츠 매니저라면 기본 메뉴 추가
if (this.items.length === 0 && role === 'CONTENT_MANAGER') {
this.items.push({
title: '콘텐츠 리스트',
route: '/content/list',
items: null
})
}
// 그래도 비어있다면 이전 동작과 동일하게 처리
if (this.items.length === 0) {
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
this.logout();
}
} else { } else {
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!") this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
this.logout(); this.logout();

View File

@@ -12,17 +12,13 @@ enhanceAccessToken();
const accountStore = { const accountStore = {
namespaced: true, namespaced: true,
state: { state: {
userId: '',
nickname: '',
accessToken: '', accessToken: '',
profileImage: '', role: '',
}, },
getters: { getters: {
isAuthenticated(state) { isAuthenticated(state) {
state.userId = state.userId || localStorage.userId
state.nickname = state.nickname || localStorage.nickname
state.profileImage = state.profileImage || localStorage.profileImage
state.accessToken = state.accessToken || localStorage.accessToken state.accessToken = state.accessToken || localStorage.accessToken
state.role = state.role || localStorage.role
return state.accessToken !== undefined && return state.accessToken !== undefined &&
state.accessToken !== null && state.accessToken !== null &&
@@ -31,27 +27,19 @@ const accountStore = {
} }
}, },
mutations: { mutations: {
LOGIN(state, {userId, nickname, token, profileImage}) { LOGIN(state, {token, role}) {
state.userId = userId
localStorage.userId = userId
state.nickname = nickname
localStorage.nickname = nickname
state.profileImage = profileImage
localStorage.profileImage = profileImage
state.accessToken = token state.accessToken = token
localStorage.accessToken = token localStorage.accessToken = token
state.role = role
localStorage.role = role
Vue.axios.defaults.headers.common['Authorization'] = `Bearer ${token}`; Vue.axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
}, },
LOGOUT(state) { LOGOUT(state) {
state.userId = ''
state.nickname = ''
state.profileImage = ''
state.accessToken = '' state.accessToken = ''
state.role = ''
localStorage.clear() localStorage.clear()
if (location.pathname === '/') { if (location.pathname === '/') {

View File

@@ -36,7 +36,7 @@
> >
<v-btn <v-btn
slot="append" slot="append"
color="#9970ff" color="#3bb9f1"
dark dark
@click="search" @click="search"
> >
@@ -96,7 +96,10 @@
<th class="text-center"> <th class="text-center">
오픈 예정일 오픈 예정일
</th> </th>
<th class="text-center"> <th
v-if="isAdmin"
class="text-center"
>
관리 관리
</th> </th>
</tr> </tr>
@@ -214,7 +217,7 @@
</td> </td>
<td>{{ item.date }}</td> <td>{{ item.date }}</td>
<td>{{ item.releaseDate }}</td> <td>{{ item.releaseDate }}</td>
<td> <td v-if="isAdmin">
<v-row> <v-row>
<v-col> <v-col>
<v-btn <v-btn
@@ -527,6 +530,14 @@ export default {
}; };
}, },
computed: {
isAdmin() {
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|| (typeof localStorage !== 'undefined' ? localStorage.role : '');
return role === 'ADMIN';
},
},
async created() { async created() {
this.audio_content = { this.audio_content = {
id: null, id: null,
@@ -539,7 +550,10 @@ export default {
is_settlement_ratio_deleted: false, is_settlement_ratio_deleted: false,
settlement_ratio: "", settlement_ratio: "",
}; };
// ADMIN 권한일 때만 테마 리스트 조회
if (this.isAdmin) {
await this.getAudioContentThemeList(); await this.getAudioContentThemeList();
}
await this.getAudioContent(); await this.getAudioContent();
}, },

View File

@@ -19,7 +19,7 @@
> >
<v-btn <v-btn
slot="append" slot="append"
color="#9970ff" color="#3bb9f1"
dark dark
@click="search" @click="search"
> >
@@ -171,7 +171,7 @@
<v-card-text> <v-card-text>
<v-row align="center"> <v-row align="center">
<v-col cols="4"> <v-col cols="4">
사용 여부 권한
</v-col> </v-col>
<v-col cols="8"> <v-col cols="8">
<v-radio-group <v-radio-group
@@ -191,6 +191,10 @@
value="USER" value="USER"
label="일반회원" label="일반회원"
/> />
<v-radio
value="CONTENT_MANAGER"
label="콘텐츠 관리자"
/>
<v-spacer /> <v-spacer />
</v-radio-group> </v-radio-group>
</v-col> </v-col>
@@ -451,6 +455,8 @@ export default {
this.user_type = 'CREATOR' this.user_type = 'CREATOR'
} else if (member.userType === '에이전트') { } else if (member.userType === '에이전트') {
this.user_type = 'AGENT' this.user_type = 'AGENT'
} else if (member.userType === '콘텐츠 관리자') {
this.user_type = 'CONTENT_MANAGER'
} }
this.email = member.email this.email = member.email
@@ -519,7 +525,8 @@ export default {
if ( if (
(this.user_type === 'CREATOR' && this.member.userType === '크리에이터') || (this.user_type === 'CREATOR' && this.member.userType === '크리에이터') ||
(this.user_type === 'USER' && this.member.userType === '일반회원') || (this.user_type === 'USER' && this.member.userType === '일반회원') ||
(this.user_type === 'AGENT' && this.member.userType === '에이전트') (this.user_type === 'AGENT' && this.member.userType === '에이전트') ||
(this.user_type === 'CONTENT_MANAGER' && this.member.userType === '콘텐츠 관리자')
) { ) {
this.notifyError("변경사항이 없습니다.") this.notifyError("변경사항이 없습니다.")
} else { } else {