2026-01-08 11:46:34 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<header class="app-header">
|
2026-01-12 19:55:51 +08:00
|
|
|
|
<button
|
|
|
|
|
|
v-if="isMobile"
|
|
|
|
|
|
class="menu-toggle"
|
|
|
|
|
|
@click="toggleSidebar"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="menu-icon" />
|
2026-01-10 17:31:22 +08:00
|
|
|
|
</button>
|
2026-01-08 11:46:34 +08:00
|
|
|
|
<h1>BLS Project Console</h1>
|
2026-01-12 19:55:51 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="service-status"
|
2026-01-13 19:45:05 +08:00
|
|
|
|
:class="{
|
|
|
|
|
|
'status-ok': serviceStatus === 'ok',
|
|
|
|
|
|
'status-error': serviceStatus === 'error',
|
|
|
|
|
|
}"
|
2026-01-12 19:55:51 +08:00
|
|
|
|
>
|
|
|
|
|
|
{{ serviceStatusText }}
|
|
|
|
|
|
</div>
|
2026-01-08 11:46:34 +08:00
|
|
|
|
</header>
|
2026-01-10 17:31:22 +08:00
|
|
|
|
<div class="app-content">
|
|
|
|
|
|
<!-- 左侧选择区域 -->
|
2026-01-12 19:55:51 +08:00
|
|
|
|
<aside
|
|
|
|
|
|
class="sidebar"
|
|
|
|
|
|
:class="{ 'sidebar-closed': !sidebarOpen && isMobile }"
|
|
|
|
|
|
>
|
2026-01-10 17:31:22 +08:00
|
|
|
|
<router-view name="sidebar" />
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 右侧调试区域 -->
|
|
|
|
|
|
<main class="main-content">
|
2026-01-12 19:55:51 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="serviceStatus === 'error'"
|
|
|
|
|
|
class="service-error-message"
|
|
|
|
|
|
>
|
|
|
|
|
|
<h3>服务不可用</h3>
|
|
|
|
|
|
<p>无法连接到后端服务,请检查服务是否正常运行。</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<router-view
|
|
|
|
|
|
v-else
|
|
|
|
|
|
name="main"
|
|
|
|
|
|
/>
|
2026-01-10 17:31:22 +08:00
|
|
|
|
</main>
|
|
|
|
|
|
</div>
|
2026-01-08 11:46:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-01-10 17:31:22 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
const sidebarOpen = ref(true);
|
|
|
|
|
|
const isMobile = ref(false);
|
2026-01-12 19:55:51 +08:00
|
|
|
|
const serviceStatus = ref('checking');
|
|
|
|
|
|
const serviceStatusText = ref('检查服务状态...');
|
|
|
|
|
|
let checkInterval = null;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
|
|
|
|
|
|
// 检测窗口大小变化
|
|
|
|
|
|
const checkMobile = () => {
|
|
|
|
|
|
isMobile.value = window.innerWidth < 768;
|
|
|
|
|
|
if (isMobile.value) {
|
|
|
|
|
|
sidebarOpen.value = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sidebarOpen.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 切换侧边栏
|
|
|
|
|
|
const toggleSidebar = () => {
|
|
|
|
|
|
sidebarOpen.value = !sidebarOpen.value;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-12 19:55:51 +08:00
|
|
|
|
// 检查服务健康状态
|
|
|
|
|
|
const checkServiceHealth = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
console.log('=== 开始检查服务健康状态 ===');
|
|
|
|
|
|
|
2026-01-13 19:45:05 +08:00
|
|
|
|
const response = await fetch('http://localhost:3001/api/health', {
|
2026-01-12 19:55:51 +08:00
|
|
|
|
method: 'GET',
|
|
|
|
|
|
credentials: 'omit',
|
|
|
|
|
|
referrerPolicy: 'no-referrer',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
console.log('响应状态码:', response.status);
|
|
|
|
|
|
console.log('响应头:', Object.fromEntries(response.headers));
|
|
|
|
|
|
|
|
|
|
|
|
const responseText = await response.text();
|
|
|
|
|
|
console.log('响应文本:', responseText);
|
|
|
|
|
|
|
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
|
serviceStatus.value = 'ok';
|
|
|
|
|
|
serviceStatusText.value = '服务正常';
|
|
|
|
|
|
console.log('=== 服务健康状态检查通过 ===');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
serviceStatus.value = 'error';
|
|
|
|
|
|
serviceStatusText.value = `服务异常 (${response.status})`;
|
|
|
|
|
|
console.log('=== 服务健康状态检查失败: 状态码异常 ===');
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('=== 服务健康状态检查异常 ===');
|
|
|
|
|
|
console.error('错误类型:', error.name);
|
|
|
|
|
|
console.error('错误消息:', error.message);
|
|
|
|
|
|
console.error('错误堆栈:', error.stack);
|
|
|
|
|
|
|
|
|
|
|
|
serviceStatus.value = 'error';
|
|
|
|
|
|
serviceStatusText.value = '服务不可用: ' + error.message;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-10 17:31:22 +08:00
|
|
|
|
// 监听窗口大小变化
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
checkMobile();
|
|
|
|
|
|
window.addEventListener('resize', checkMobile);
|
2026-01-12 19:55:51 +08:00
|
|
|
|
|
|
|
|
|
|
// 初始检查服务状态
|
|
|
|
|
|
checkServiceHealth();
|
|
|
|
|
|
|
|
|
|
|
|
// 定时检查服务状态(每5秒)
|
|
|
|
|
|
checkInterval = setInterval(checkServiceHealth, 5000);
|
2026-01-10 17:31:22 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
window.removeEventListener('resize', checkMobile);
|
2026-01-12 19:55:51 +08:00
|
|
|
|
|
|
|
|
|
|
// 清除定时检查
|
|
|
|
|
|
if (checkInterval) {
|
|
|
|
|
|
clearInterval(checkInterval);
|
|
|
|
|
|
}
|
2026-01-10 17:31:22 +08:00
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2026-01-08 11:46:34 +08:00
|
|
|
|
<style>
|
|
|
|
|
|
* {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
|
font-family: Arial, sans-serif;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
background-color: #121212;
|
|
|
|
|
|
color: #e0e0e0;
|
|
|
|
|
|
overflow: hidden;
|
2026-01-08 11:46:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.app-container {
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
background-color: #1e1e1e;
|
2026-01-08 11:46:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.app-header {
|
2026-01-13 19:45:05 +08:00
|
|
|
|
background-color: #008c8c;
|
2026-01-08 11:46:34 +08:00
|
|
|
|
color: white;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
padding: 0.6rem 1rem;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-01-08 11:46:34 +08:00
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
2026-01-10 17:31:22 +08:00
|
|
|
|
z-index: 100;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-toggle {
|
|
|
|
|
|
background: none;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
font-size: 1.2rem;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
margin-right: 1rem;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 32px;
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
transition: background-color 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-toggle:hover {
|
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-icon {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
width: 20px;
|
|
|
|
|
|
height: 2px;
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
transition: background-color 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-icon::before,
|
|
|
|
|
|
.menu-icon::after {
|
|
|
|
|
|
content: '';
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 20px;
|
|
|
|
|
|
height: 2px;
|
|
|
|
|
|
background-color: white;
|
2026-01-13 19:45:05 +08:00
|
|
|
|
transition:
|
|
|
|
|
|
transform 0.2s,
|
|
|
|
|
|
top 0.2s;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-icon::before {
|
|
|
|
|
|
top: -6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-icon::after {
|
|
|
|
|
|
top: 6px;
|
2026-01-08 11:46:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-10 17:31:22 +08:00
|
|
|
|
.app-header h1 {
|
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
margin: 0;
|
2026-01-12 19:55:51 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 服务状态指示器 */
|
|
|
|
|
|
.service-status {
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
padding: 0.3rem 0.8rem;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
margin-right: 1rem;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.service-status.status-ok {
|
|
|
|
|
|
background-color: #e8f5e8;
|
|
|
|
|
|
color: #2e7d32;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.service-status.status-error {
|
|
|
|
|
|
background-color: #ffebee;
|
|
|
|
|
|
color: #c62828;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 服务错误消息 */
|
|
|
|
|
|
.service-error-message {
|
|
|
|
|
|
background-color: #ffebee;
|
|
|
|
|
|
border: 1px solid #ffcdd2;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
padding: 2rem;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin: 2rem;
|
|
|
|
|
|
color: #c62828;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.service-error-message h3 {
|
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.service-error-message p {
|
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
opacity: 0.8;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.app-content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 左侧选择区域 */
|
|
|
|
|
|
.sidebar {
|
|
|
|
|
|
width: 280px;
|
|
|
|
|
|
background-color: #252526;
|
|
|
|
|
|
border-right: 1px solid #3e3e42;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
z-index: 50;
|
|
|
|
|
|
color: #e0e0e0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 移动端侧边栏关闭状态 */
|
|
|
|
|
|
.sidebar-closed {
|
|
|
|
|
|
width: 0;
|
|
|
|
|
|
border-right: none;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 右侧调试区域 */
|
|
|
|
|
|
.main-content {
|
2026-01-08 11:46:34 +08:00
|
|
|
|
flex: 1;
|
2026-01-10 17:31:22 +08:00
|
|
|
|
padding: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
background-color: #1e1e1e;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 响应式设计 */
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.menu-toggle {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
top: 60px;
|
|
|
|
|
|
height: calc(100vh - 60px);
|
|
|
|
|
|
width: 280px;
|
|
|
|
|
|
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar-closed {
|
|
|
|
|
|
left: -280px;
|
|
|
|
|
|
width: 280px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.main-content {
|
|
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
|
overflow: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (min-width: 769px) {
|
|
|
|
|
|
.menu-toggle {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar {
|
|
|
|
|
|
width: 280px;
|
|
|
|
|
|
}
|
2026-01-08 11:46:34 +08:00
|
|
|
|
}
|
2026-01-13 19:45:05 +08:00
|
|
|
|
</style>
|