This commit is contained in:
leejisun9
2025-09-12 11:10:43 +09:00
parent 0f0317e356
commit 2ec34ff321
12 changed files with 5805 additions and 0 deletions

299
pages/test/test01.vue Normal file
View File

@@ -0,0 +1,299 @@
<template>
<div class="test-page">
<div class="container">
<h1 class="title">테스트 페이지 01</h1>
<div class="test-section">
<h2>기본 기능 테스트</h2>
<div class="test-card">
<h3>사용자 정보 테스트</h3>
<p>
로그인 상태: {{ userStore.isLoggedIn ? "로그인됨" : "로그아웃됨" }}
</p>
<p v-if="userStore.user">사용자: {{ userStore.user.name }}</p>
<p v-if="userStore.user">역할: {{ userStore.user.role }}</p>
<div class="button-group">
<button class="btn btn-success" @click="loginTest">
테스트 로그인
</button>
<button class="btn btn-info" @click="adminLoginTest">
관리자 로그인
</button>
<button class="btn btn-warning" @click="logoutTest">
테스트 로그아웃
</button>
</div>
</div>
</div>
<div class="test-section">
<h2>API 테스트</h2>
<div class="test-card">
<h3>데이터 로딩 테스트</h3>
<button
class="btn btn-primary"
:disabled="loading"
@click="loadTestData"
>
{{ loading ? "로딩 중..." : "테스트 데이터 로드" }}
</button>
<div v-if="testData" class="data-display">
<pre>{{ JSON.stringify(testData, null, 2) }}</pre>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useUserStore } from "~/stores/user";
// 페이지 메타데이터
definePageMeta({
title: "테스트 페이지 01",
description: "기능 테스트를 위한 페이지",
});
const userStore = useUserStore();
// 반응형 데이터
const loading = ref(false);
const testData = ref<{
id: number;
name: string;
timestamp: string;
items: string[];
} | null>(null);
// 메서드
const loginTest = () => {
// 테스트용 로그인 (실제로는 API 호출이 필요)
userStore.user = {
id: "1",
userId: "test",
email: "test@example.com",
name: "테스트 사용자",
role: "user",
};
userStore.isLoggedIn = true;
};
const adminLoginTest = () => {
// 관리자 로그인 로직 구현
userStore.user = {
id: "2",
userId: "admin",
email: "admin@example.com",
name: "관리자",
role: "admin",
};
userStore.isLoggedIn = true;
};
const logoutTest = () => {
userStore.logout();
};
const loadTestData = async () => {
loading.value = true;
try {
// 실제 API 호출 대신 시뮬레이션
await new Promise((resolve) => setTimeout(resolve, 1000));
testData.value = {
id: 1,
name: "테스트 데이터",
timestamp: new Date().toISOString(),
items: ["항목 1", "항목 2", "항목 3"],
};
} catch (error) {
console.error("데이터 로딩 실패:", error);
} finally {
loading.value = false;
}
};
// 라이프사이클
onMounted(() => {
console.log("테스트 페이지 01이 마운트되었습니다.");
});
</script>
<style scoped>
.test-page {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 2rem 0;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
}
.title {
text-align: center;
color: white;
font-size: 2.5rem;
font-weight: bold;
margin-bottom: 2rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.test-section {
background: white;
border-radius: 12px;
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.test-section h2 {
color: #333;
margin-bottom: 1.5rem;
font-size: 1.5rem;
border-bottom: 2px solid #667eea;
padding-bottom: 0.5rem;
}
.test-card {
background: #f8f9fa;
border-radius: 8px;
padding: 1.5rem;
margin-bottom: 1.5rem;
border-left: 4px solid #667eea;
}
.test-card h3 {
color: #495057;
margin-bottom: 1rem;
font-size: 1.2rem;
}
.test-card p {
color: #6c757d;
margin-bottom: 1rem;
font-size: 1rem;
}
.button-group {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 6px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
text-decoration: none;
display: inline-block;
}
.btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5a6fd8;
}
.btn-secondary {
background: #6c757d;
color: white;
}
.btn-secondary:hover {
background: #5a6268;
}
.btn-danger {
background: #dc3545;
color: white;
}
.btn-danger:hover {
background: #c82333;
}
.btn-success {
background: #28a745;
color: white;
}
.btn-success:hover {
background: #218838;
}
.btn-warning {
background: #ffc107;
color: #212529;
}
.btn-warning:hover {
background: #e0a800;
}
.btn-info {
background: #17a2b8;
color: white;
}
.btn-info:hover {
background: #138496;
}
.data-display {
margin-top: 1rem;
background: #f1f3f4;
border-radius: 6px;
padding: 1rem;
border: 1px solid #dee2e6;
}
.data-display pre {
margin: 0;
font-size: 0.85rem;
color: #495057;
white-space: pre-wrap;
word-break: break-word;
}
@media (max-width: 768px) {
.container {
padding: 0 0.5rem;
}
.test-section {
padding: 1rem;
}
.button-group {
flex-direction: column;
}
.btn {
width: 100%;
}
}
</style>