Compare commits

..

No commits in common. "main" and "250408_park" have entirely different histories.

19 changed files with 207 additions and 653 deletions

View File

@ -55,11 +55,8 @@
<script setup> <script setup>
import Quill from 'quill'; import Quill from 'quill';
import 'quill/dist/quill.snow.css'; import 'quill/dist/quill.snow.css';
import $api from '@api';
import { onMounted, ref, watch, defineEmits, defineProps } from 'vue'; import { onMounted, ref, watch, defineEmits, defineProps } from 'vue';
import { useToastStore } from '@s/toastStore'; import $api from '@api';
const toastStore = useToastStore();
const props = defineProps({ const props = defineProps({
isAlert: { isAlert: {
@ -135,36 +132,15 @@
initCheckImageIndex(); initCheckImageIndex();
} }
// // .
quillInstance.getModule('toolbar').addHandler('video', () => { quillInstance.getModule('toolbar').addHandler('video', () => {
const url = prompt('YouTube 영상 URL을 입력하세요:'); const url = prompt('영상 URL을 입력하세요:');
let src = ''; if (url) {
if (!url || url.trim() == '') return; // iframe
const index = quillInstance.getSelection().index; //
// youtube url quillInstance.insertEmbed(index, 'video', url);
if (url.indexOf('watch?v=') !== -1) { quillInstance.setSelection(index + 1); //
src = url.replace('watch?v=', 'embed/');
// youtu.be URL (ex : https://youtu.be/CfiojceAaeQ?si=G7eM56sdDjIEw-Tz)
} else if (url.indexOf('youtu.be/') !== -1) {
const videoId = url.split('youtu.be/')[1].split('?')[0];
src = `https://www.youtube.com/embed/${videoId}`;
// iframe
} else if (url.indexOf('<iframe') !== -1) {
// DOMParser embeded url
const parser = new DOMParser();
const doc = parser.parseFromString(url, 'text/html');
const iframeEL = doc.querySelector('iframe');
src = iframeEL.getAttribute('src');
} else {
toastStore.onToast('지원하는 영상 타입 아님', 'e');
return;
} }
const index = quillInstance.getSelection().index;
quillInstance.insertEmbed(index, 'video', src);
quillInstance.setSelection(index + 1);
}); });
// //

View File

@ -14,7 +14,7 @@
:value="computedValue" :value="computedValue"
:disabled="disabled" :disabled="disabled"
:maxLength="maxlength" :maxLength="maxlength"
:placeholder="placeholder ? placeholder : title" :placeholder="title"
@blur="$emit('blur')" @blur="$emit('blur')"
/> />
<span class="input-group-text">@ localhost.co.kr</span> <span class="input-group-text">@ localhost.co.kr</span>
@ -29,7 +29,7 @@
:value="computedValue" :value="computedValue"
:disabled="disabled" :disabled="disabled"
:maxLength="maxlength" :maxLength="maxlength"
:placeholder="placeholder ? placeholder : title" :placeholder="title"
@blur="$emit('blur')" @blur="$emit('blur')"
@click="handleDateClick" @click="handleDateClick"
ref="inputElement" ref="inputElement"
@ -89,10 +89,6 @@
default: false, default: false,
required: false, required: false,
}, },
placeholder: {
type: String,
default: ''
},
}); });
const emits = defineEmits(['update:data', 'update:alert', 'blur']); const emits = defineEmits(['update:data', 'update:alert', 'blur']);

View File

@ -14,14 +14,7 @@
{{ user.name }} {{ user.name }}
</p> </p>
<CommuterBtn <CommuterBtn :userId="user.id" :checkedInProject="checkedInProject || {}" ref="workTimeComponentRef" />
ref="workTimeComponentRef"
:userId="user.id"
:checkedInProject="checkedInProject || {}"
:pendingProjectChange="pendingProjectChange"
@update:pendingProjectChange="pendingProjectChange = $event"
@leaveTimeUpdated="handleLeaveTimeUpdate"
/>
<MainEventList <MainEventList
:categoryList="categoryList" :categoryList="categoryList"
@ -106,7 +99,6 @@
const selectedProject = ref(null); const selectedProject = ref(null);
const checkedInProject = ref(null); const checkedInProject = ref(null);
const pendingProjectChange = ref(null);
// //
const showModal = ref(false); const showModal = ref(false);
@ -613,48 +605,10 @@
if (newProject) { if (newProject) {
selectedProject.value = newProject.PROJCTSEQ; selectedProject.value = newProject.PROJCTSEQ;
checkedInProject.value = newProject; checkedInProject.value = newProject;
} else {
selectedProject.value = null;
checkedInProject.value = null;
} }
}, },
); );
const handleLeaveTimeUpdate = async event => {
const memberSeq = user.value.id;
if (!memberSeq) return;
//
const { data } = await $api.post('main/getUserLeaveRecord', {
memberSeq: memberSeq,
});
const res = data?.data;
if (res && !res?.COMMUTLVE) {
await projectStore.getMemberProjects();
if (projectStore.activeMemberProjectList.length > 0) {
const previousProject =
projectStore.activeMemberProjectList.find(p => res.MEMBERSEQ === user.value.id && res.PROJCTLVE === p.PROJCTSEQ) ||
projectStore.activeMemberProjectList[0]; //
if (previousProject) {
selectedProject.value = previousProject.PROJCTSEQ;
projectStore.setSelectedProject(previousProject);
} else if (projectStore.activeProjectList.length > 0) {
selectedProject.value = projectStore.activeProjectList[0].PROJCTSEQ;
projectStore.setSelectedProject(projectStore.activeProjectList[0]);
} else {
selectedProject.value = null;
projectStore.setSelectedProject(null);
}
} else {
selectedProject.value = null;
projectStore.setSelectedProject(null);
}
}
};
onMounted(async () => { onMounted(async () => {
await userStore.userInfo(); await userStore.userInfo();
user.value = userStore.user; user.value = userStore.user;

View File

@ -32,10 +32,12 @@
@error="setDefaultImage" @error="setDefaultImage"
/> />
</div> </div>
<!-- <div class="timeline-event ps-1" style="cursor: pointer;" @click="goVoteList()" > -->
<div class="timeline-event ps-1" style="cursor: pointer;" @click.stop="openModal(item.localVote.LOCVOTSEQ)" > <div class="timeline-event ps-1" style="cursor: pointer;" @click.stop="openModal(item.localVote.LOCVOTSEQ)" >
<div class="timeline-header "> <div class="timeline-header ">
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small> <small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
</div> </div>
<small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0" <small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0"
:style="{ color: getDaysAgo(item.localVote.formatted_LOCVOTEDT) == '금일 종료' ? 'red' : '' }"> :style="{ color: getDaysAgo(item.localVote.formatted_LOCVOTEDT) == '금일 종료' ? 'red' : '' }">
{{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }}) {{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }})
@ -51,6 +53,7 @@
<div class="card-body" v-else> <div class="card-body" v-else>
진행중인 투표가 없습니다. 진행중인 투표가 없습니다.
</div> </div>
</div> </div>
</div> </div>
<!--투표 모달 --> <!--투표 모달 -->
@ -208,7 +211,7 @@ const voteDelete =(id) =>{
} }
// 14 ... // 14 ...
const truncateTitle = title => { const truncateTitle = title => {
return title.length > 10 ? title.slice(0, 10) + '...' : title; return title.length > 10 ? title.slice(0, 10) + '...' : title;
}; };
// //
@ -226,11 +229,13 @@ const goVoteList = () =>{
const getDaysAgo = (dateString) => { const getDaysAgo = (dateString) => {
const inputDate = new Date(dateString); // Date const inputDate = new Date(dateString); // Date
const today = new Date(); // const today = new Date(); //
const input = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate()); const input = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate());
const now = new Date(today.getFullYear(), today.getMonth(), today.getDate()); const now = new Date(today.getFullYear(), today.getMonth(), today.getDate());
const timeDiff = now - input; const timeDiff = now - input;
const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24)); const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
// // ""
if (dayDiff === 0) return "금일 종료"; if (dayDiff === 0) return "금일 종료";
return `종료 ${Math.abs(dayDiff)}일 전`; return `종료 ${Math.abs(dayDiff)}일 전`;
@ -240,5 +245,6 @@ const getDaysAgo = (dateString) => {
<style scoped> <style scoped>
.user-avatar { .user-avatar {
border: 3px solid; border: 3px solid;
padding: 0.1px;
} }
</style> </style>

View File

@ -135,5 +135,6 @@ return title.length > 25 ? title.slice(0, 25) + '...' : title;
<style scoped> <style scoped>
.user-avatar { .user-avatar {
border: 3px solid; border: 3px solid;
padding: 0.1px;
} }
</style> </style>

View File

@ -50,15 +50,14 @@
<label class="switch" <label class="switch"
><input ><input
type="checkbox" type="checkbox"
:checked="member.checked" :checked="checked"
@click="handleRegisterMember($event, member)" /> @change="handleRegisterMember(member.MEMBERSEQ)" /><span class="slider round"></span
<span class="slider round"></span
></label> ></label>
</div> </div>
<button <button
class="btn-close btn-close-sm" class="btn-close btn-close-sm"
style="position: absolute; top: 10px; right: 10px" style="position: absolute; top: 10px; right: 10px"
@click="handleRejectMember(member)" @click="handleRejectMember(member.MEMBERSEQ)"
></button> ></button>
</div> </div>
</div> </div>
@ -77,37 +76,30 @@
import $api from '@api'; import $api from '@api';
const memberList = ref([]); const memberList = ref([]);
const checked = ref(false);
const toast = useToastStore(); const toast = useToastStore();
const imgURL = import.meta.env.VITE_SERVER_IMG_URL; const imgURL = import.meta.env.VITE_SERVER_IMG_URL;
// api // api
const fetchRegisterMemberList = async () => { const fetchRegisterMemberList = async () => {
const { data } = await $api.get('main/registerMemberList'); const { data } = await $api.get('main/registerMemberList');
if (data?.data) { if (data?.data) memberList.value = data.data;
memberList.value = data.data.map(member => ({
...member,
checked: false, // checked
}));
}
}; };
// api // api
const handleRegisterMember = async (e, member) => { const handleRegisterMember = async memberSeq => {
e.preventDefault(); const { data } = await $api.post('main/registerMember', { memberSeq: memberSeq });
const { data } = await $api.post('main/registerMember', { memberSeq: member.MEMBERSEQ });
if (data?.data) { if (data?.data) {
member.checked = true;
toast.onToast(data.data, 's'); toast.onToast(data.data, 's');
fetchRegisterMemberList(); fetchRegisterMemberList();
} }
}; };
// api // api
const handleRejectMember = async member => { const handleRejectMember = async memberSeq => {
if (!confirm('해당 사원 등록을 거절하시겠습니까?')) return; if (!confirm('해당 사원 등록을 거절하시겠습니까?')) return;
const { data } = await $api.post('main/rejectMember', { memberSeq: member.MEMBERSEQ }); const { data } = await $api.post('main/rejectMember', { memberSeq: memberSeq });
if (data?.data) { if (data?.data) {
toast.onToast(data.data, 's'); toast.onToast(data.data, 's');
fetchRegisterMemberList(); fetchRegisterMemberList();

View File

@ -25,7 +25,6 @@
@update:alert="idAlert = $event" @update:alert="idAlert = $event"
@blur="checkIdDuplicate" @blur="checkIdDuplicate"
:value="id" :value="id"
@keypress="noSpace"
/> />
<span v-if="idError" class="invalid-feedback d-block">{{ idError }}</span> <span v-if="idError" class="invalid-feedback d-block">{{ idError }}</span>
@ -38,7 +37,6 @@
@update:data="password = $event" @update:data="password = $event"
@update:alert="passwordAlert = $event" @update:alert="passwordAlert = $event"
:value="password" :value="password"
@keypress="noSpace"
/> />
<span v-if="passwordError" class="invalid-feedback d-block">{{ passwordError }}</span> <span v-if="passwordError" class="invalid-feedback d-block">{{ passwordError }}</span>
@ -51,7 +49,6 @@
@update:data="passwordcheck = $event" @update:data="passwordcheck = $event"
@update:alert="passwordcheckAlert = $event" @update:alert="passwordcheckAlert = $event"
:value="passwordcheck" :value="passwordcheck"
@keypress="noSpace"
/> />
<span v-if="passwordcheckError" class="invalid-feedback d-block">{{ passwordcheckError }}</span> <span v-if="passwordcheckError" class="invalid-feedback d-block">{{ passwordcheckError }}</span>
@ -85,7 +82,6 @@
@update:data="name = $event" @update:data="name = $event"
@update:alert="nameAlert = $event" @update:alert="nameAlert = $event"
:value="name" :value="name"
@keypress="noSpace"
class="me-2 w-50" class="me-2 w-50"
/> />
@ -218,10 +214,6 @@
const toastStore = useToastStore(); const toastStore = useToastStore();
const noSpace = (e) => {
if (e.key === ' ') e.preventDefault();
};
// //
const profileValid = (size, type) => { const profileValid = (size, type) => {
const maxSize = 5 * 1024 * 1024; const maxSize = 5 * 1024 * 1024;
@ -352,7 +344,6 @@
}); });
watch(password, (newValue) => { watch(password, (newValue) => {
if (newValue && newValue.length >= 4) { if (newValue && newValue.length >= 4) {
passwordErrorAlert.value = false; passwordErrorAlert.value = false;
passwordError.value = ''; passwordError.value = '';
@ -405,10 +396,8 @@
} else { } else {
passwordError.value = ''; passwordError.value = '';
} }
const phoneRegex = /^010\d{8}$/;
const isFormatValid = phoneRegex.test(phone.value);
if (!/^\d+$/.test(phone.value) || !isFormatValid) { if (!/^\d+$/.test(phone.value)) {
phoneAlert.value = true; phoneAlert.value = true;
} else { } else {
phoneAlert.value = false; phoneAlert.value = false;
@ -445,13 +434,13 @@
} }
const formData = new FormData(); const formData = new FormData();
formData.append('memberIds', id.value.trim()); formData.append('memberIds', id.value);
formData.append('memberPwd', password.value.trim()); formData.append('memberPwd', password.value);
formData.append('memberPwh', pwhint.value); formData.append('memberPwh', pwhint.value);
formData.append('memberPwr', pwhintRes.value.trim()); formData.append('memberPwr', pwhintRes.value);
formData.append('memberNam', name.value.trim()); formData.append('memberNam', name.value);
formData.append('memberArr', address.value); formData.append('memberArr', address.value);
formData.append('memberDtl', detailAddress.value.trim()); formData.append('memberDtl', detailAddress.value);
formData.append('memberZip', postcode.value); formData.append('memberZip', postcode.value);
formData.append('memberBth', birth.value); formData.append('memberBth', birth.value);
formData.append('memberTel', phone.value); formData.append('memberTel', phone.value);

View File

@ -164,6 +164,7 @@ const toggleEdit = async () => {
.user-avatar { .user-avatar {
border: 3px solid; border: 3px solid;
padding: 0.1px;
} }
.edit-btn { .edit-btn {

View File

@ -80,12 +80,12 @@
<div class="text-truncate">Authorization</div> <div class="text-truncate">Authorization</div>
</RouterLink> </RouterLink>
</li> </li>
<li class="menu-item" :class="$route.path.includes('/people') ? 'active' : ''"> <!-- <li class="menu-item" :class="$route.path.includes('/sample') ? 'active' : ''">
<RouterLink class="menu-link" to="/people"> <i class="bi "></i> <RouterLink class="menu-link" to="/sample"> <i class="bi "></i>
<i class="menu-icon icon-base bi bi-people-fill"></i> <i class="menu-icon tf-icons bx bx-calendar"></i>
<div class="text-truncate">people</div> <div class="text-truncate">Sample</div>
</RouterLink> </RouterLink>
</li> </li> -->
</ul> </ul>
</aside> </aside>
<!-- / Menu --> <!-- / Menu -->
@ -94,7 +94,6 @@
<script setup> <script setup>
import { computed } from "vue"; import { computed } from "vue";
import { useUserInfoStore } from '@s/useUserInfoStore'; import { useUserInfoStore } from '@s/useUserInfoStore';
import "bootstrap-icons/font/bootstrap-icons.css";
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
const allowedUserId = 1; // ID (!!) const allowedUserId = 1; // ID (!!)

View File

@ -38,36 +38,25 @@
<!-- Notification --> <!-- Notification -->
<li class="nav-item dropdown-notifications navbar-dropdown dropdown me-3 me-xl-2 p-0"> <li class="nav-item dropdown-notifications navbar-dropdown dropdown me-3 me-xl-2 p-0">
<a <a
class="nav-link dropdown-toggle hide-arrow p-0" class="nav-link dropdown-toggle hide-arrow p-0"
href="javascript:void(0);" href="javascript:void(0);"
data-bs-toggle="dropdown" data-bs-toggle="dropdown"
data-bs-auto-close="outside" data-bs-auto-close="outside"
aria-expanded="false" aria-expanded="false"
> >
<span class="position-relative"> <span class="position-relative">
<i class="bx bx-bell bx-md"></i> <i class="bx bx-bell bx-md"></i>
<!-- 알림이 있을 경우에만 뱃지를 표시 --> <span class="badge rounded-pill bg-danger badge-dot badge-notifications border"></span>
<span </span>
v-if="notificationCount > 0"
class="badge rounded-pill bg-danger badge-dot badge-notifications border"
></span>
</span>
</a> </a>
<ul class="dropdown-menu dropdown-menu-end p-0"> <ul class="dropdown-menu dropdown-menu-end p-0">
<li class="dropdown-notifications-list scrollable-container p-3"> <li class="dropdown-notifications-list scrollable-container p-3">
<!-- 알림이 없으면 "알림이 없습니다." 메시지 표시 --> 알림이 없습니다.
<div v-if="notificationCount === 0"> <!-- <ul class="list-group list-group-flush">
알림이 없습니다. <li class="list-group-item list-group-item-action dropdown-notifications-item">
</div> </li>
<!-- 알림이 있을 목록 렌더링--> </ul> -->
<div v-else> </li>
<ul>
<li v-for="notification in notifications" :key="notification.id">
{{ notification.text }}
</li>
</ul>
</div>
</li>
</ul> </ul>
</li> </li>
<!--/ Notification --> <!--/ Notification -->
@ -131,8 +120,6 @@
const selectedProject = ref(null); const selectedProject = ref(null);
const weather = ref({}); const weather = ref({});
const dailyWeatherList = ref([]); const dailyWeatherList = ref([]);
const notifications = ref([]);
const notificationCount = ref(0);
const weatherReady = computed(() => { const weatherReady = computed(() => {
return ( return (

View File

@ -109,12 +109,6 @@ const routes = [
component: () => import('@v/admin/TheAuthorization.vue'), component: () => import('@v/admin/TheAuthorization.vue'),
meta: { requiresAuth: true }, meta: { requiresAuth: true },
}, },
{
path: '/people',
name: 'people',
component: () => import('@v/people/PeopleList.vue'),
meta: { requiresAuth: true },
},
{ {
path: '/error/400', path: '/error/400',
name: 'Error400', name: 'Error400',
@ -154,7 +148,7 @@ router.beforeEach(async (to, from, next) => {
// Authorization 페이지는 ID가 26이 아니면 접근 차단 // Authorization 페이지는 ID가 26이 아니면 접근 차단
if (to.path === '/authorization' && userId !== allowedUserId) { if (to.path === '/authorization' && userId !== allowedUserId) {
return next(); return next('/');
} }
// 비로그인 사용자만 접근 가능한 페이지인데 로그인된 경우 → 홈으로 이동 // 비로그인 사용자만 접근 가능한 페이지인데 로그인된 경우 → 홈으로 이동

View File

@ -40,13 +40,7 @@ export const useWeatherStore = defineStore('weather', () => {
return; return;
} }
// 검은색 태양 아이콘 변경 dailyWeatherList.value = resData.dailyWeatherList;
dailyWeatherList.value = resData.dailyWeatherList.map(w => {
return {
...w,
icon: w.icon.replace(/n$/, 'd'),
};
});
const now = new Date(); const now = new Date();
const todayStr = now.toISOString().split('T')[0]; const todayStr = now.toISOString().split('T')[0];

View File

@ -21,18 +21,18 @@
import MainVote from '@c/main/MainVote.vue'; import MainVote from '@c/main/MainVote.vue';
import { useUserInfoStore } from '@/stores/useUserInfoStore'; import { useUserInfoStore } from '@/stores/useUserInfoStore';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import $api from '@api';
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
const user = ref();
const isAdmin = ref(false); const isAdmin = ref(false);
const checkAdmin = async user => { const checkAdmin = user => {
const { data } = await $api.post('user/authCheck', { memberId: user.loginId }); return user?.value?.role === 'ROLE_ADMIN' ? true : false;
return data.data === 'ROLE_ADMIN' ? true : false;
}; };
onMounted(async () => { onMounted(async () => {
await userStore.userInfo(); await userStore.userInfo();
isAdmin.value = await checkAdmin(userStore.user); user.value = userStore.user;
isAdmin.value = await checkAdmin(user);
}); });
</script> </script>

View File

@ -1,35 +1,26 @@
<template> <template>
<div class="container text-center flex-grow-1 container-p-y"> <div class="container text-center flex-grow-1 container-p-y">
<div class="card"> <div class="card">
<div class="card-header d-flex flex-column"> <div class="card-header d-flex flex-column">
<h3>관리자 권한 부여</h3> <h3>관리자 권한 부여</h3>
<div class="user-card-container"> <div class="user-card-container">
<div v-for="user in users" :key="user.id" class="user-card"> <div v-for="user in users" :key="user.id" class="user-card">
<!-- 프로필 사진 --> <!-- 프로필 사진 -->
<img <img :src="getProfileImage(user.photo)" class="profile-img" alt="프로필 사진" @error="setDefaultImage" />
:src="getProfileImage(user.photo)" <!-- 사용자 정보 -->
class="user-avatar2" <div class="user-info">
alt="프로필 사진" <h5>{{ user.name }}</h5>
@error="setDefaultImage" </div>
/> <!-- 권한 토글 버튼 -->
<!-- 사용자 정보 --> <label class="switch me-0">
<div class="user-info"> <input type="checkbox" :checked="user.isAdmin" @change="toggleAdmin(user)" />
<h5>{{ user.name }}</h5> <span class="slider round"></span>
</label>
</div>
</div>
</div> </div>
<!-- 권한 토글 버튼 (기본 동작 막고 클릭시 직접 토글 처리) -->
<label class="switch me-0">
<input
type="checkbox"
:checked="user.isAdmin"
@click="handleToggle($event, user)"
/>
<span class="slider round"></span>
</label>
</div>
</div> </div>
</div> </div>
</div>
</div>
</template> </template>
<script setup> <script setup>
@ -41,80 +32,65 @@ const users = ref([]);
const toastStore = useToastStore(); const toastStore = useToastStore();
const baseUrl = axios.defaults.baseURL.replace(/api\/$/, ""); const baseUrl = axios.defaults.baseURL.replace(/api\/$/, "");
const defaultProfile = "/img/icons/icon.png"; const defaultProfile = "/img/icons/icon.png";
const allowedUserId = 1; // ID ( ) const allowedUserId = 1; // ID (!!)
// //
async function fetchUsers() { async function fetchUsers() {
try { try {
const response = await axios.get('admin/users'); // API const response = await axios.get('admin/users'); // API
if (!response.data || !Array.isArray(response.data.data)) {
throw new Error("올바른 데이터 형식이 아닙니다."); // API
if (!response.data || !Array.isArray(response.data.data)) {
throw new Error("올바른 데이터 형식이 아닙니다.");
}
// MEMBERSEQ 1
users.value = response.data.data
.filter(user => user.MEMBERSEQ !== allowedUserId) // MEMBERSEQ 1
.map(user => ({
id: user.MEMBERSEQ,
name: user.MEMBERNAM,
photo: user.MEMBERPRF ? `${baseUrl}upload/img/profile/${user.MEMBERPRF}` : defaultProfile,
color: user.MEMBERCOL,
isAdmin: user.MEMBERROL === 'ROLE_ADMIN',
}));
} catch (error) {
toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e');
} }
users.value = response.data.data
.filter(user => user.MEMBERSEQ !== allowedUserId)
.map(user => ({
id: user.MEMBERSEQ,
name: user.MEMBERNAM,
photo: user.MEMBERPRF ? `${baseUrl}upload/img/profile/${user.MEMBERPRF}` : defaultProfile,
color: user.MEMBERCOL,
isAdmin: user.MEMBERROL === 'ROLE_ADMIN',
}));
} catch (error) {
toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e');
}
} }
// //
function getProfileImage(photo) { function getProfileImage(photo) {
return photo || defaultProfile; return photo || defaultProfile;
} }
// //
function setDefaultImage(event) { function setDefaultImage(event) {
event.target.src = defaultProfile; event.target.src = defaultProfile;
} }
// //
async function handleToggle(event, user) { async function toggleAdmin(user) {
// Prevent the default checkbox toggle behavior const requestData = {
event.preventDefault(); id: user.id,
role: user.isAdmin ? 'MEMBER' : 'ADMIN'
};
try {
const response = await axios.put('admin/role', requestData);
// : ( ) if (response.status === 200) {
const originalState = user.isAdmin; user.isAdmin = !user.isAdmin;
const newState = !originalState; toastStore.onToast(`'${user.name}'의 권한이 '${requestData.role}'(으)로 변경되었습니다.`, 's');
} else {
const requestData = { throw new Error('권한 변경 실패');
id: user.id, }
role: originalState ? 'MEMBER' : 'ADMIN' } catch (error) {
}; toastStore.onToast('권한 변경에 실패했습니다.', 'e');
try {
const response = await axios.put('admin/role', requestData);
if (response.status === 200) {
//
user.isAdmin = newState;
toastStore.onToast(`'${user.name}'의 권한이 '${requestData.role}'(으)로 변경되었습니다.`, 's');
} else {
throw new Error('권한 변경 실패');
} }
} catch (error) {
//
toastStore.onToast('권한 변경에 실패했습니다.', 'e');
}
} }
onMounted(fetchUsers); onMounted(fetchUsers);
</script> </script>
<style scoped> <style scoped>
.user-avatar2 {
width: 160px;
height: 200px;
object-fit: cover;
border-radius: 50%;
display: block;
margin: 1rem auto 0 auto;
margin-top: 0px;
margin-bottom: 10px;
}
</style> </style>

View File

@ -99,7 +99,7 @@
// //
const title = ref(''); const title = ref('');
const content = ref({ ops: [] }); const content = ref('');
const autoIncrement = ref(0); const autoIncrement = ref(0);
// //
@ -130,9 +130,10 @@
// //
const isFirstContentUpdate = ref(true); const isFirstContentUpdate = ref(true);
// ( ) //
const handleEditorDataUpdate = data => { const handleEditorDataUpdate = data => {
content.value = data; content.value = data;
if (isFirstContentUpdate.value) { if (isFirstContentUpdate.value) {
originalContent.value = structuredClone(data); originalContent.value = structuredClone(data);
isFirstContentUpdate.value = false; isFirstContentUpdate.value = false;
@ -140,28 +141,23 @@
} }
}; };
// isDeltaChanged ( diff , , )
function isDeltaChanged(current, original) { function isDeltaChanged(current, original) {
const Delta = Quill.import('delta'); const Delta = Quill.import('delta');
const currentDelta = new Delta(current || []); const currentDelta = new Delta(current || []);
const originalDelta = new Delta(original || []); const originalDelta = new Delta(original || []);
// const diff = originalDelta.diff(currentDelta);
if (!diff || diff.ops.length === 0) return false;
//
const getPlainText = delta => const getPlainText = delta =>
(delta.ops || []) (delta.ops || [])
.filter(op => typeof op.insert === 'string') .filter(op => typeof op.insert === 'string')
.map(op => op.insert) .map(op => op.insert)
.join(''); .join('');
// URL
const getImages = delta => const getImages = delta =>
(delta.ops || []) (delta.ops || []).filter(op => typeof op.insert === 'object' && op.insert.image).map(op => op.insert.image);
.filter(op => typeof op.insert === 'object' && op.insert.image)
.map(op => op.insert.image);
// URL
const getVideos = delta =>
(delta.ops || [])
.filter(op => typeof op.insert === 'object' && op.insert.video)
.map(op => op.insert.video);
const textCurrent = getPlainText(currentDelta); const textCurrent = getPlainText(currentDelta);
const textOriginal = getPlainText(originalDelta); const textOriginal = getPlainText(originalDelta);
@ -169,27 +165,22 @@
const imgsCurrent = getImages(currentDelta); const imgsCurrent = getImages(currentDelta);
const imgsOriginal = getImages(originalDelta); const imgsOriginal = getImages(originalDelta);
const vidsCurrent = getVideos(currentDelta);
const vidsOriginal = getVideos(originalDelta);
const textEqual = textCurrent === textOriginal; const textEqual = textCurrent === textOriginal;
const imageEqual = imgsCurrent.length === imgsOriginal.length && imgsCurrent.every((val, idx) => val === imgsOriginal[idx]); const imageEqual = JSON.stringify(imgsCurrent) === JSON.stringify(imgsOriginal);
const videoEqual = vidsCurrent.length === vidsOriginal.length && vidsCurrent.every((val, idx) => val === vidsOriginal[idx]);
return !(textEqual && imageEqual && videoEqual); return !(textEqual && imageEqual); // false
} }
//
const isChanged = computed(() => { const isChanged = computed(() => {
if (!contentInitialized.value) return false; if (!contentInitialized.value) return false;
const isTitleChanged = title.value !== originalTitle.value; const isTitleChanged = title.value !== originalTitle.value;
const isContentChanged = isDeltaChanged(content.value, originalContent.value); const isContentChanged = isDeltaChanged(content.value, originalContent.value);
const isFilesChanged = const isFilesChanged =
attachFiles.value.some(f => !f.id) || // attachFiles.value.some(f => !f.id) || // id
delFileIdx.value.length > 0 || // delFileIdx.value.length > 0 || //
!isSameFiles( !isSameFiles(
attachFiles.value.filter(f => f.id), // attachFiles.value.filter(f => f.id), // (id )
originalFiles.value originalFiles.value,
); );
return isTitleChanged || isContentChanged || isFilesChanged; return isTitleChanged || isContentChanged || isFilesChanged;
}); });
@ -197,8 +188,10 @@
// //
function isSameFiles(current, original) { function isSameFiles(current, original) {
if (current.length !== original.length) return false; if (current.length !== original.length) return false;
const sortedCurrent = [...current].sort((a, b) => a.id - b.id); const sortedCurrent = [...current].sort((a, b) => a.id - b.id);
const sortedOriginal = [...original].sort((a, b) => a.id - b.id); const sortedOriginal = [...original].sort((a, b) => a.id - b.id);
return sortedCurrent.every((file, idx) => { return sortedCurrent.every((file, idx) => {
return file.id === sortedOriginal[idx].id && file.name === sortedOriginal[idx].name; return file.id === sortedOriginal[idx].id && file.name === sortedOriginal[idx].name;
}); });
@ -206,24 +199,31 @@
// //
const fetchBoardDetails = async () => { const fetchBoardDetails = async () => {
//
let password = accessStore.password; let password = accessStore.password;
const params = { const params = {
password: `${password}` || '', password: `${password}` || '',
}; };
//const response = await axios.get(`board/${currentBoardId.value}`);
const { data } = await axios.post(`board/${currentBoardId.value}`, params); const { data } = await axios.post(`board/${currentBoardId.value}`, params);
if (data.code !== 200) { if (data.code !== 200) {
//toastStore.onToast(data.message, 'e');
alert(data.message, 'e'); alert(data.message, 'e');
router.back(); router.back();
return; return;
} }
const boardData = data.data; const boardData = data.data;
//
if (boardData.hasAttachment && boardData.attachments.length > 0) { if (boardData.hasAttachment && boardData.attachments.length > 0) {
const formatted = addDisplayFileName([...boardData.attachments]); const formatted = addDisplayFileName([...boardData.attachments]);
attachFiles.value = formatted; attachFiles.value = formatted;
originalFiles.value = formatted; originalFiles.value = formatted;
} }
//
title.value = boardData.title || '제목 없음'; title.value = boardData.title || '제목 없음';
content.value = boardData.content || { ops: [] }; content.value = boardData.content || '내용 없음';
originalTitle.value = title.value; originalTitle.value = title.value;
originalContent.value = structuredClone(boardData.content); originalContent.value = structuredClone(boardData.content);
contentInitialized.value = true; contentInitialized.value = true;
@ -242,34 +242,38 @@
const addDisplayFileName = fileInfos => const addDisplayFileName = fileInfos =>
fileInfos.map(file => ({ fileInfos.map(file => ({
...file, ...file,
name: `${file.originalName}.${file.extension}` name: `${file.originalName}.${file.extension}`,
})); }));
// //
const goList = () => { const goList = () => {
accessStore.$reset(); accessStore.$reset();
//
// const getFilter = localStorage.getItem(`boardList_${currentBoardId.value}`);
// if (getFilter) {
// router.push({
// path: '/board',
// query: JSON.parse(getFilter),
// });
// } else {
// router.push('/board');
// }
router.back(); router.back();
}; };
// //
const goBack = () => { const goBack = () => {
accessStore.$reset(); accessStore.$reset();
router.back(); router.back();
}; };
// ( : , , ) //
const isNotValidContent = delta => {
if (!delta?.ops?.length) return true;
const hasText = delta.ops.some(op => typeof op.insert === 'string' && op.insert.trim().length > 0);
const hasImage = delta.ops.some(op => op.insert && typeof op.insert === 'object' && op.insert.image);
const hasVideo = delta.ops.some(op => op.insert && typeof op.insert === 'object' && op.insert.video);
return !(hasText || hasImage || hasVideo);
};
//
const checkValidation = () => { const checkValidation = () => {
contentAlert.value = isNotValidContent(content.value); contentAlert.value = $common.isNotValidContent(content);
titleAlert.value = $common.isNotValidInput(title.value); titleAlert.value = $common.isNotValidInput(title.value);
if (titleAlert.value || contentAlert.value || !isFileValid.value) { if (titleAlert.value || contentAlert.value || !isFileValid.value) {
if (titleAlert.value) { if (titleAlert.value) {
title.value = ''; title.value = '';
@ -285,6 +289,7 @@
const handleFileUpload = files => { const handleFileUpload = files => {
const validFiles = files.filter(file => file.size <= maxSize); const validFiles = files.filter(file => file.size <= maxSize);
if (files.some(file => file.size > maxSize)) { if (files.some(file => file.size > maxSize)) {
fileError.value = '파일 크기가 10MB를 초과할 수 없습니다.'; fileError.value = '파일 크기가 10MB를 초과할 수 없습니다.';
return; return;
@ -295,11 +300,13 @@
} }
fileError.value = ''; fileError.value = '';
attachFiles.value = [...attachFiles.value, ...validFiles].slice(0, maxFiles); attachFiles.value = [...attachFiles.value, ...validFiles].slice(0, maxFiles);
autoIncrement.value++; autoIncrement.value++;
}; };
const removeFile = (index, file) => { const removeFile = (index, file) => {
if (file.id) delFileIdx.value.push(file.id); if (file.id) delFileIdx.value.push(file.id);
attachFiles.value.splice(index, 1); attachFiles.value.splice(index, 1);
if (attachFiles.value.length <= maxFiles) { if (attachFiles.value.length <= maxFiles) {
fileError.value = ''; fileError.value = '';
@ -317,41 +324,55 @@
}; };
////////////////// fileSection[E] //////////////////// ////////////////// fileSection[E] ////////////////////
/** content 변경 감지 (deep 옵션 추가) */ /** `content` 변경 감지하여 자동 유효성 검사 실행 */
watch(content, () => { watch(content, () => {
contentAlert.value = isNotValidContent(content.value); contentAlert.value = $common.isNotValidContent(content);
}, { deep: true }); });
// //
const validateTitle = () => { const validateTitle = () => {
titleAlert.value = title.value.trim().length === 0; titleAlert.value = title.value.trim().length === 0;
}; };
// //
const updateBoard = async () => { const updateBoard = async () => {
if (checkValidation()) return; if (checkValidation()) return;
//
const boardData = { const boardData = {
LOCBRDTTL: title.value.trim(), LOCBRDTTL: title.value.trim(),
LOCBRDCON: JSON.stringify(content.value), LOCBRDCON: JSON.stringify(content.value),
LOCBRDSEQ: currentBoardId.value LOCBRDSEQ: currentBoardId.value,
}; };
//
if (delFileIdx.value && delFileIdx.value.length > 0) { if (delFileIdx.value && delFileIdx.value.length > 0) {
boardData.delFileIdx = [...delFileIdx.value]; boardData.delFileIdx = [...delFileIdx.value];
} }
//
if (editorUploadedImgList.value && editorUploadedImgList.value.length > 0) { if (editorUploadedImgList.value && editorUploadedImgList.value.length > 0) {
boardData.editorUploadedImgList = [...editorUploadedImgList.value]; boardData.editorUploadedImgList = [...editorUploadedImgList.value];
} }
//
if (editorDeleteImgList.value && editorDeleteImgList.value.length > 0) { if (editorDeleteImgList.value && editorDeleteImgList.value.length > 0) {
boardData.editorDeleteImgList = [...editorDeleteImgList.value]; boardData.editorDeleteImgList = [...editorDeleteImgList.value];
} }
const fileArray = newFileFilter(attachFiles); const fileArray = newFileFilter(attachFiles);
const formData = new FormData(); const formData = new FormData();
// formData boardData
Object.entries(boardData).forEach(([key, value]) => { Object.entries(boardData).forEach(([key, value]) => {
formData.append(key, value); formData.append(key, value);
}); });
// formData
fileArray.forEach((file, idx) => { fileArray.forEach((file, idx) => {
formData.append('files', file); formData.append('files', file);
}); });
const { data } = await axios.put(`board/${currentBoardId.value}`, formData, { isFormData: true }); const { data } = await axios.put(`board/${currentBoardId.value}`, formData, { isFormData: true });
if (data.code === 200) { if (data.code === 200) {
toastStore.onToast('게시물이 수정되었습니다.', 's'); toastStore.onToast('게시물이 수정되었습니다.', 's');

View File

@ -47,7 +47,7 @@
<tr> <tr>
<th style="width: 11%" class="text-center fw-bold">번호</th> <th style="width: 11%" class="text-center fw-bold">번호</th>
<th style="width: 45%" class="text-center fw-bold">제목</th> <th style="width: 45%" class="text-center fw-bold">제목</th>
<th style="width: 10%" class="text-strat fw-bold">작성자</th> <th style="width: 10%" class="text-center fw-bold">작성자</th>
<th style="width: 15%" class="text-center fw-bold">작성일</th> <th style="width: 15%" class="text-center fw-bold">작성일</th>
<th style="width: 9%" class="text-center fw-bold">조회수</th> <th style="width: 9%" class="text-center fw-bold">조회수</th>
</tr> </tr>

View File

@ -37,9 +37,7 @@
</label> </label>
</div> </div>
</div> </div>
<div class="invalid-feedback" :class="categoryAlert ? 'd-block' : 'd-none'"> <div class="invalid-feedback" :class="categoryAlert ? 'd-block' : 'd-none'">카테고리를 선택해주세요.</div>
카테고리를 선택해주세요.
</div>
</div> </div>
<!-- 비밀번호 필드 (익명게시판 선택 활성화) --> <!-- 비밀번호 필드 (익명게시판 선택 활성화) -->
@ -103,14 +101,11 @@
@update:deleteImgIndexList="handleDeleteEditorImg" @update:deleteImgIndexList="handleDeleteEditorImg"
/> />
</div> </div>
<div class="invalid-feedback mt-1" :class="contentAlert ? 'd-block' : 'd-none'"> <div class="invalid-feedback mt-1" :class="contentAlert ? 'd-block' : 'd-none'">내용을 입력해주세요.</div>
내용을 입력해주세요.
</div>
</div> </div>
<div class="mb-4 d-flex justify-content-end"> <div class="mb-4 d-flex justify-content-end">
<BackButton @click="goList" /> <BackButton @click="goList" />
<!-- 저장 버튼은 항상 활성화 -->
<SaveButton @click="write" :isEnabled="isFileValid" /> <SaveButton @click="write" :isEnabled="isFileValid" />
</div> </div>
</div> </div>
@ -120,7 +115,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch, computed } from 'vue'; import { ref, onMounted, getCurrentInstance, watch, computed } from 'vue';
import QEditor from '@c/editor/QEditor.vue'; import QEditor from '@c/editor/QEditor.vue';
import FormInput from '@c/input/FormInput.vue'; import FormInput from '@c/input/FormInput.vue';
import FormFile from '@c/input/FormFile.vue'; import FormFile from '@c/input/FormFile.vue';
@ -174,12 +169,10 @@
const fileCount = computed(() => attachFiles.value.length); const fileCount = computed(() => attachFiles.value.length);
//
const handleUpdateEditorImg = item => { const handleUpdateEditorImg = item => {
editorUploadedImgList.value = item; editorUploadedImgList.value = item;
}; };
//
const handleDeleteEditorImg = item => { const handleDeleteEditorImg = item => {
editorDeleteImgList.value = item; editorDeleteImgList.value = item;
}; };
@ -194,8 +187,10 @@
fileError.value = `최대 ${maxFiles}개의 파일만 업로드할 수 있습니다.`; fileError.value = `최대 ${maxFiles}개의 파일만 업로드할 수 있습니다.`;
return; return;
} }
fileError.value = ''; fileError.value = '';
attachFiles.value = [...attachFiles.value, ...validFiles].slice(0, maxFiles); attachFiles.value = [...attachFiles.value, ...validFiles].slice(0, maxFiles);
autoIncrement.value++; autoIncrement.value++;
}; };
@ -218,7 +213,7 @@
const validateNickname = () => { const validateNickname = () => {
if (categoryValue.value === 300102) { if (categoryValue.value === 300102) {
nickname.value = nickname.value.replace(/\s/g, ''); // nickname.value = nickname.value.replace(/\s/g, ''); //
nicknameAlert.value = nickname.value.length === 0; nicknameAlert.value = nickname.value.length === 0 ;
} else { } else {
nicknameAlert.value = false; nicknameAlert.value = false;
} }
@ -233,28 +228,19 @@
} }
}; };
/**
* validateContent:
* - 내용이 없으면 contentAlert를 true로 설정
* - 텍스트, 이미지, 비디오 하나라도 존재하면 유효한 콘텐츠로 판단
*/
const validateContent = () => { const validateContent = () => {
if (!content.value?.ops?.length) { if (!content.value?.ops?.length) {
contentAlert.value = true; contentAlert.value = true;
return; return;
} }
const hasText = content.value.ops.some( //
op => typeof op.insert === 'string' && op.insert.trim().length > 0 const hasImage = content.value.ops.some(op => op.insert && typeof op.insert === 'object' && op.insert.image);
); //
const hasImage = content.value.ops.some( const hasText = content.value.ops.some(op => typeof op.insert === 'string' && op.insert.trim().length > 0);
op => op.insert && typeof op.insert === 'object' && op.insert.image
);
const hasVideo = content.value.ops.some(
op => op.insert && typeof op.insert === 'object' && op.insert.video
);
contentAlert.value = !(hasText || hasImage || hasVideo); //
contentAlert.value = !(hasText || hasImage);
}; };
/** 글쓰기 */ /** 글쓰기 */
@ -278,7 +264,7 @@
try { try {
const boardData = { const boardData = {
LOCBRDTTL: title.value.trim(), LOCBRDTTL: title.value,
LOCBRDCON: JSON.stringify(content.value), // Delta JSON LOCBRDCON: JSON.stringify(content.value), // Delta JSON
LOCBRDNIC: categoryValue.value === 300102 ? nickname.value : null, LOCBRDNIC: categoryValue.value === 300102 ? nickname.value : null,
LOCBRDPWD: categoryValue.value === 300102 ? password.value : null, LOCBRDPWD: categoryValue.value === 300102 ? password.value : null,
@ -308,10 +294,10 @@
formData.append('CMNFLEORG', fileNameWithoutExt); formData.append('CMNFLEORG', fileNameWithoutExt);
formData.append('CMNFLEEXT', file.name.split('.').pop()); formData.append('CMNFLEEXT', file.name.split('.').pop());
formData.append('CMNFLESIZ', file.size); formData.append('CMNFLESIZ', file.size);
formData.append('file', file); formData.append('file', file); // 📌
await axios.post(`board/${boardId}/attachments`, formData, { isFormData: true }); await axios.post(`board/${boardId}/attachments`, formData, { isFormData: true });
}) }),
); );
} }
@ -327,8 +313,8 @@
router.push('/board'); router.push('/board');
}; };
/** content 변경 감지 (deep 옵션 추가) */ /** `content` 변경 감지하여 자동 유효성 검사 실행 */
watch(content, () => { watch(content, () => {
validateContent(); validateContent();
}, { deep: true }); });
</script> </script>

View File

@ -65,7 +65,7 @@
</span> </span>
<!-- 기존 비밀번호 입력 --> <!-- 기존 비밀번호 입력 -->
<UserFormInput title="비밀번호 재설정" placeholder="기존 비밀번호를 입력하세요" name="currentPw" type="password" <UserFormInput title="기존 비밀번호" name="currentPw" type="password"
:value="password.current" @update:data="password.current = $event" :value="password.current" @update:data="password.current = $event"
@blur="checkCurrentPassword" @keypress="noSpace" /> @blur="checkCurrentPassword" @keypress="noSpace" />
<span v-if="passwordError" class="text-danger invalid-feedback mt-1 d-block"> <span v-if="passwordError" class="text-danger invalid-feedback mt-1 d-block">

View File

@ -1,318 +0,0 @@
<template>
<div class="container-xxl flex-grow-1 container-p-y">
<div class="card">
<!-- 사원 목록이 없을 경우 표시 -->
<div v-if="allUserList.length === 0" class="text-center my-4">
<p class="text-muted">등록된 사원이 없습니다.</p>
</div>
<!-- 사원 카드 리스트 영역 -->
<div class="card-body">
<div class="card-list">
<div
v-for="(person, index) in allUserList"
:key="index"
class="person-card"
@click="openModal(person)"
>
<div>
<img
class="rounded-circle user-avatar pointer"
:src="getProfileImage(person.MEMBERPRF)"
:style="{ borderColor: person.usercolor }"
@error="setDefaultImage"
/>
</div>
<div class="card-body">
<h3 class="person-name">{{ person.MEMBERNAM }}</h3>
<p class="person-email">{{ person.MEMBERIDS }}@local-host.co.kr</p>
<p class="person-phone">{{ person.MEMBERTEL }}</p>
<small>
{{ person.MEMBERARR }} {{ person.MEMBERDTL }}
</small>
</div>
</div>
</div>
</div>
<!-- 상세보기 Modal -->
<div v-if="showModal" class="modal-overlay" @click.self="closeModal">
<div class="modal-content">
<button class="close-btn" @click="closeModal">×</button>
<div class="modal-body">
<img
class="user-avatar2"
:src="getProfileImage(selectedPerson.MEMBERPRF)"
:style="{ borderColor: selectedPerson.usercolor }"
@error="setDefaultImage"
/>
<h4>{{ selectedPerson.MEMBERNAM }}</h4>
<p>{{ selectedPerson.MEMBERIDS }}@local-host.co.kr</p>
<p>{{ selectedPerson.MEMBERTEL }}</p>
<p>{{ selectedPerson.MEMBERARR }} {{ selectedPerson.MEMBERDTL }}</p>
<hr />
<!-- 추가 정보: 사용자가 속한 프로젝트 목록 -->
<h5>참여 프로젝트</h5>
<div v-if="memberProjects.length > 0" class="project-list-container">
<ul>
<li
v-for="(project, idx) in memberProjects"
:key="idx"
class="project-item"
>
<span class="project-name">{{ project.PROJCTNAM }}</span>
<span class="project-period">
<!-- projectEndDate가 있는 경우 -->
<!-- <template v-if="project.projectEndDate"> -->
{{ project.userStartDate ? project.userStartDate : project.projectStartDate }} ~
{{ project.userEndDate ? project.userEndDate : project.projectEndDate }}
<!-- </template> -->
<!-- 없으면 종료일 표시 안함 -->
<!-- <template v-else>
{{ project.userStartDate ? project.userStartDate : project.projectStartDate }} ~
</template> -->
</span>
</li>
</ul>
</div>
<div v-else>
<p>참여중인 프로젝트가 없습니다.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import axios from '@api' // API Axios
import { ref, onMounted } from 'vue'
import SearchBar from '@c/search/SearchBar.vue'
export default {
name: 'PeopleList',
components: { SearchBar },
setup() {
const allUserList = ref([]) //
const user = ref({}) // ( )
const showModal = ref(false) //
const selectedPerson = ref({})//
const memberProjects = ref([])//
onMounted(async () => {
try {
const response = await axios.get('user/allUserList')
allUserList.value = response.data.data.allUserList
user.value = response.data.data.user
} catch (error) {
console.error('사원 목록 조회 실패:', error)
}
})
const baseUrl = axios.defaults.baseURL.replace(/api\/$/, '')
const defaultProfile = '/img/icons/icon.png'
const getProfileImage = (profilePath) => {
return profilePath && profilePath.trim()
? `${baseUrl}upload/img/profile/${profilePath}`
: defaultProfile
}
const setDefaultImage = (event) => {
event.target.src = defaultProfile
}
// API
const fetchMemberProjects = async (memberSeq) => {
try {
const res = await axios.get(`project/people/${memberSeq}`)
memberProjects.value = res.data.data
} catch (error) {
console.error('프로젝트 조회 실패:', error)
memberProjects.value = []
}
}
const openModal = (person) => {
selectedPerson.value = person
fetchMemberProjects(person.MEMBERSEQ)
showModal.value = true
}
const closeModal = () => {
showModal.value = false
}
return {
allUserList,
user,
showModal,
selectedPerson,
memberProjects,
openModal,
closeModal,
getProfileImage,
defaultProfile,
setDefaultImage
}
}
}
</script>
<style scoped>
.container-xxl {
padding: 1rem;
}
.card-list {
display: flex;
flex-wrap: wrap;
gap: 1rem;
justify-content: center;
}
.person-card {
width: 280px;
border: 1px solid #eee;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
background: #fff;
transition: box-shadow 0.2s ease-in-out;
}
.person-card:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.person-card .card-header {
width: 100%;
height: 120px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: #f8f9fa;
}
.user-avatar {
width: 160px;
height: 200px;
object-fit: cover;
border-radius: 50%;
border: 2px solid #ddd;
display: block;
margin: 1rem auto 0 auto;
}
.user-avatar2 {
width: 160px;
height: 200px;
object-fit: cover;
border-radius: 50%;
display: block;
margin: 1rem auto 0 auto;
margin-top: 0px;
margin-bottom: 10px;
}
.person-card .card-body {
padding: 0.75rem;
}
.person-name {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
}
.person-email,
.person-phone {
margin: 0;
font-size: 0.9rem;
color: #555;
}
/* 모달 스타일 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 111%;
background-color: rgba(0, 0, 0, 0.4);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.modal-content {
position: relative;
width: 400px;
background: #fff;
padding: 1.5rem;
border-radius: 8px;
animation: slideDown 0.3s ease forwards;
}
.close-btn {
background: transparent;
border: none;
font-size: 1.5rem;
position: absolute;
top: 0.5rem;
right: 0.5rem;
cursor: pointer;
}
.modal-body {
text-align: center;
}
.modal-img {
width: 50%;
height: 50%;
border-radius: 50%;
margin-bottom: 1rem;
object-fit: cover;
}
/* 프로젝트 리스트 스타일 */
.project-list-container {
max-height: 200px; /* 필요에 따라 높이 조절 */
overflow-y: auto;
margin-top: 1rem;
}
.project-item {
display: flex;
align-items: center;
list-style: none;
font-size: 0.9rem;
padding: 0.25rem 0;
}
.project-name {
font-weight: 600;
}
.project-period {
font-size: 1rem;
color: #888;
margin-left: 10px;
}
@keyframes slideDown {
0% {
transform: translateY(-15%);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
</style>