修改配置页面宽度,修改默认导航栏

This commit is contained in:
Ken 2025-03-04 17:23:57 +08:00
parent e0318d3960
commit a8a78e7398
2 changed files with 169 additions and 17 deletions

View file

@ -1,11 +1,20 @@
<template>
<!-- 顶部导航栏 -->
<header class="header">
<div class="nav-item" :class="{ active: $route.path === '/' }" @click="switchTab('/')">小智 AI</div>
<nav class="nav">
<div class="nav-item" :class="{ active: $route.path === '/panel' }" @click="switchTab('/panel')">
<i class="icon-device"></i> 设备管理
<div class="logo-container">
<div class="logo">
<img src="../assets/robot.png" alt="小智AI" />
</div>
</nav>
<span class="logo-text"><router-link to="/">小智.AI</router-link></span>
</div>
<div class="nav-buttons">
<button class="nav-button active" @click="enterPanel">
<span class="icon">⚙️</span>
设备管理
</button>
</div>
</header>
</template>
@ -18,8 +27,13 @@ const route = useRoute();
const switchTab = (path) => {
router.push(path);
};
const enterPanel = () => {
router.push('/panel');
};
</script>
<style scoped>
.header {
display: flex;
@ -57,4 +71,133 @@ const switchTab = (path) => {
.icon-device {
margin-right: 8px;
}
/* 顶部导航栏样式 */
.header {
display: flex;
align-items: center;
padding: 0.8rem 1.5rem;
background-color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
z-index: 100;
}
.logo-container {
display: flex;
align-items: center;
margin-right: 2rem;
}
.logo {
width: 2rem;
height: 2rem;
margin-right: 0.5rem;
display: flex;
align-items: center;
}
.logo img {
width: 100%;
height: auto;
}
.logo-text {
font-weight: 600;
font-size: 1.1rem;
color: var(--text-color);
}
.nav-buttons {
display: flex;
align-items: center;
flex-grow: 1;
}
.nav-button {
display: flex;
align-items: center;
padding: 0.5rem 1rem;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
margin-right: 1rem;
}
.nav-button .icon {
margin-right: 0.5rem;
}
.tab-container {
display: flex;
align-items: center;
padding: 0.5rem 1rem;
background-color: #f5f5f5;
border-radius: 4px;
font-size: 0.9rem;
}
.tab-item {
margin-right: 0.5rem;
}
.tab-close {
cursor: pointer;
font-weight: bold;
}
.search-container {
display: flex;
align-items: center;
background-color: var(--secondary-color);
border-radius: 20px;
padding: 0.3rem 0.8rem;
margin: 0 1rem;
flex-grow: 0.5;
max-width: 400px;
}
.search-input {
border: none;
background: transparent;
flex-grow: 1;
padding: 0.5rem;
outline: none;
font-size: 0.9rem;
}
.search-button {
background: none;
border: none;
cursor: pointer;
font-size: 1rem;
}
.user-info {
display: flex;
align-items: center;
}
.user-avatar {
width: 2rem;
height: 2rem;
background-color: #e0e0e0;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 1rem;
}
.user-notification, .user-balance {
background-color: #f0f0f0;
padding: 0.3rem 0.8rem;
border-radius: 15px;
font-size: 0.8rem;
margin-left: 0.5rem;
}
</style>

View file

@ -1,14 +1,6 @@
<template>
<div class="app-container">
<NavBar current-tab="device" @tab-change="handleTabChange"/>
<!-- Breadcrumb -->
<div class="breadcrumb">
<router-link to="/">首页</router-link> /
<router-link to="/panel">设备管理</router-link> /
<span>配置角色</span>
</div>
<!-- Main Content -->
<div class="main-content">
<h1 class="page-title">配置角色: {{ deviceId }}</h1>
@ -285,11 +277,28 @@ const resetConfig = async () => {
</script>
<style scoped>
.app-container {
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #f5f7fa;
height: 100vh; /* 改为固定视口高度 */
margin: 0;
background: #f5f7fa;
}
.main-content {
flex: 1;
margin: 0; /* 移除自动居中 */
padding: 0; /* 移除内边距 */
width: 100%;
max-width: none; /* 移除最大宽度限制 */
overflow: auto; /* 添加滚动条 */
}
.form-section {
min-height: 100%; /* 撑满容器 */
padding: 24px; /* 增加内边距 */
box-shadow: none; /* 移除阴影 */
}
.breadcrumb {