优化“导航栏”响应调整

This commit is contained in:
Ran_Chen
2025-03-28 11:08:12 +08:00
parent c66385d1f7
commit 69b5ffe3bf
4 changed files with 162 additions and 45 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+162 -45
View File
@@ -1,29 +1,42 @@
<template> <template>
<el-header class="header"> <el-header class="header">
<div style="display: flex;justify-content: space-between;margin-top: 6px; "> <div class="header-container">
<div style="display: flex;align-items: center;gap: 10px;"> <!-- 左侧元素 -->
<img alt="" src="@/assets/xiaozhi-logo.png" style="width: 42px;height: 42px;"/> <div class="header-left">
<img alt="" src="@/assets/xiaozhi-ai.png" style="width: 58px;height: 12px;"/> <img alt="" src="@/assets/xiaozhi-logo.png" class="logo-img"/>
<img alt="" src="@/assets/xiaozhi-ai.png" class="brand-img"/>
</div>
<!-- 中间导航菜单 -->
<div class="header-center">
<div class="equipment-management" :class="{ 'active-tab': $route.path === '/home' }" @click="goHome"> <div class="equipment-management" :class="{ 'active-tab': $route.path === '/home' }" @click="goHome">
<img alt="" src="@/assets/home/equipment.png" style="width: 12px;height: 10px;"/> <img alt="" src="@/assets/header/roboot.png" :style="{ filter: $route.path === '/home' ? 'brightness(0) invert(1)' : 'None' }"/>
智能体管理 智能体管理
</div> </div>
<div class="equipment-management" :class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement"> <div class="equipment-management" :class="{ 'active-tab': $route.path === '/user-management' }" @click="goUserManagement">
<img alt="" src="@/assets/header/user_management.png" :style="{ filter: $route.path === '/user-management' ? 'brightness(0) invert(1)' : 'None' }"/>
用户管理 用户管理
</div> </div>
<div class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }" @click="goModelConfig"> <div class="equipment-management" :class="{ 'active-tab': $route.path === '/model-config' }" @click="goModelConfig">
<img alt="" src="@/assets/header/model_config.png" :style="{ filter: $route.path === '/model-config' ? 'brightness(0) invert(1)' : 'None' }"/>
模型配置 模型配置
</div> </div>
</div> </div>
<div style="display: flex;align-items: center;gap: 7px; margin-top: 2px;">
<div class="serach-box"> <!-- 右侧元素 -->
<el-input v-model="serach" placeholder="输入名称搜索.." style="border: none; background: transparent;" <div class="header-right">
@keyup.enter.native="handleSearch"/> <div class="search-container">
<img alt="" src="@/assets/home/search.png" <el-input
style="width: 14px;height: 14px;margin-right: 11px;cursor: pointer;" @click="handleSearch"/> v-model="serach"
placeholder="输入名称搜索.."
class="custom-search-input"
@keyup.enter.native="handleSearch"
>
<i slot="suffix" class="el-icon-search search-icon" @click="handleSearch"></i>
</el-input>
</div> </div>
<img alt="" src="@/assets/home/avatar.png" style="width: 21px;height: 21px;"/> <img alt="" src="@/assets/home/avatar.png" class="avatar-img"/>
<el-dropdown trigger="click"> <el-dropdown trigger="click" class="user-dropdown">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ userInfo.mobile || '加载中...' }}<i class="el-icon-arrow-down el-icon--right"></i> {{ userInfo.mobile || '加载中...' }}<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
@@ -37,7 +50,7 @@
</div> </div>
<!-- 修改密码弹窗 --> <!-- 修改密码弹窗 -->
<ChangePasswordDialog :visible.sync="isChangePasswordDialogVisible" /> <ChangePasswordDialog :visible.sync="isChangePasswordDialogVisible"/>
</el-header> </el-header>
</template> </template>
@@ -111,11 +124,61 @@ export default {
</script> </script>
<style scoped> <style scoped>
.header {
background: #f6fcfe66;
border: 1px solid #fff;
height: 53px !important;
min-width: 900px; /* 设置最小宽度防止过度压缩 */
overflow: hidden;
}
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
padding: 0 10px;
}
.header-left {
display: flex;
align-items: center;
gap: 10px;
min-width: 120px;
}
.logo-img {
width: 42px;
height: 42px;
}
.brand-img {
width: 58px;
height: 12px;
}
.header-center {
display: flex;
align-items: center;
gap: 25px;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.header-right {
display: flex;
align-items: center;
gap: 7px;
min-width: 300px;
justify-content: flex-end;
}
.equipment-management { .equipment-management {
width: 82px; width: 82px;
height: 24px; height: 24px;
border-radius: 12px; border-radius: 12px;
background: #fff; background: #deeafe;
display: flex; display: flex;
justify-content: center; justify-content: center;
font-size: 10px; font-size: 10px;
@@ -126,7 +189,7 @@ export default {
align-items: center; align-items: center;
transition: all 0.3s ease; transition: all 0.3s ease;
cursor: pointer; cursor: pointer;
flex-shrink: 0; /* 防止导航按钮被压缩 */
} }
.equipment-management.active-tab { .equipment-management.active-tab {
@@ -134,41 +197,95 @@ export default {
color: #fff !important; color: #fff !important;
} }
.header { .equipment-management img {
background: #f6fcfe66; width: 15px;
border: 1px solid #fff; height: 13px;
height: 53px !important;
} }
.serach-box { .search-container {
display: flex; margin-right: 15px;
width: 220px; min-width: 150px;
flex-grow: 1;
max-width: 220px;
}
.custom-search-input >>> .el-input__inner {
height: 30px; height: 30px;
border-radius: 15px; border-radius: 15px;
background-color: #f6fcfe66; background-color: #e2e5f8;
border: 1px solid #e4e6ef; border: 1px solid #e4e6ef;
align-items: center; padding-left: 15px;
padding: 0 7px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-right: 15px;
}
.serach-box /deep/ .el-input__inner {
border-radius: 15px;
height: 100%;
width: 100%;
border: 0;
background: transparent;
padding-left: 12px;
}
.user-info {
font-weight: 600;
font-size: 12px; font-size: 12px;
letter-spacing: -0.02px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
text-align: left; width: 100%;
color: #3d4566;
} }
.search-icon {
cursor: pointer;
color: #909399;
margin-right: 8px;
font-size: 14px;
line-height: 30px;
}
.avatar-img {
width: 21px;
height: 21px;
flex-shrink: 0;
}
.user-dropdown {
flex-shrink: 0;
}
/* 响应式调整 */
@media (max-width: 1200px) {
.header-center {
gap: 14px;
}
.equipment-management {
width: 70px;
font-size: 9px;
}
}
@media (max-width: 1024px) {
.search-container {
margin-right: 10px;
max-width: 150px;
}
.header-right {
gap: 5px;
}
}
@media (max-width: 900px) {
.header-left {
margin-right: auto;
}
.search-container {
max-width: 150px;
}
}
@media (max-width: 768px) {
.search-container {
max-width: 145px;
}
.custom-search-input >>> .el-input__inner {
padding-left: 10px;
font-size: 11px;
}
}
@media (max-width: 600px) {
.search-container {
max-width: 120px;
min-width: 100px;
}
}
</style> </style>