Files
xiaozhi-esp32-server/main/manager-web/src/components/HeaderBar.vue
T

162 lines
3.8 KiB
Vue
Raw Normal View History

2025-03-14 23:48:59 +08:00
<template>
<el-header class="header">
2025-03-18 21:49:57 +08:00
<div style="display: flex;justify-content: space-between;margin-top: 6px; ">
2025-03-14 23:48:59 +08:00
<div style="display: flex;align-items: center;gap: 10px;">
2025-03-18 21:49:57 +08:00
<img src="@/assets/xiaozhi-logo.png" alt="" style="width: 42px;height: 42px;" />
<img src="@/assets/xiaozhi-ai.png" alt="" style="width: 58px;height: 12px;" />
2025-03-14 23:48:59 +08:00
<div class="equipment-management" @click="goHome">
2025-03-18 21:49:57 +08:00
<img src="@/assets/home/equipment.png" alt="" style="width: 12px;height: 10px;" />
智能体管理
2025-03-14 23:48:59 +08:00
</div>
2025-03-20 14:08:38 +08:00
<div class="equipment-management2" @click="goUserManagement">
用户管理
2025-03-14 23:48:59 +08:00
</div>
<div class="equipment-management2">
2025-03-20 14:08:38 +08:00
模型配置
2025-03-14 23:48:59 +08:00
</div>
</div>
2025-03-18 21:49:57 +08:00
<div style="display: flex;align-items: center;gap: 7px; margin-top: 2px;">
2025-03-14 23:48:59 +08:00
<div class="serach-box">
2025-03-19 18:13:03 +08:00
<el-input placeholder="输入名称搜索.." v-model="serach" style="border: none; background: transparent;" @keyup.enter.native="handleSearch" />
2025-03-14 23:48:59 +08:00
<img src="@/assets/home/search.png" alt=""
2025-03-19 18:13:03 +08:00
style="width: 14px;height: 14px;margin-right: 11px;cursor: pointer;" @click="handleSearch" />
2025-03-14 23:48:59 +08:00
</div>
2025-03-18 21:49:57 +08:00
<img src="@/assets/home/avatar.png" alt="" style="width: 21px;height: 21px;" />
2025-03-14 23:48:59 +08:00
<div class="user-info">
2025-03-19 18:13:03 +08:00
{{ userInfo.mobile || '加载中...' }}
2025-03-14 23:48:59 +08:00
</div>
</div>
</div>
</el-header>
</template>
<script>
2025-03-19 18:13:03 +08:00
import userApi from '@/apis/module/user'
2025-03-14 23:48:59 +08:00
export default {
name: 'HeaderBar',
2025-03-19 18:13:03 +08:00
props: ['devices'], // 接收父组件设备列表
2025-03-14 23:48:59 +08:00
data() {
2025-03-19 18:13:03 +08:00
return {
serach: '',
userInfo: {
mobile: ''
}
}
},
mounted() {
this.fetchUserInfo()
2025-03-14 23:48:59 +08:00
},
methods: {
goHome() {
// 跳转到首页
this.$router.push('/')
2025-03-19 18:13:03 +08:00
},
2025-03-20 14:08:38 +08:00
goUserManagement() {
this.$router.push('/user-management')
},
2025-03-19 18:13:03 +08:00
// 获取用户信息
fetchUserInfo() {
userApi.getUserInfo(({data}) => {
this.userInfo = data.data
})
},
// 处理搜索
handleSearch() {
const searchValue = this.serach.trim();
let filteredDevices;
if (!searchValue) {
// 当搜索内容为空时,显示原始完整列表
filteredDevices = this.$parent.originalDevices;
} else {
// 过滤逻辑
filteredDevices = this.devices.filter(device => {
return device.agentName.includes(searchValue) ||
device.ttsModelName.includes(searchValue) ||
device.ttsVoiceName.includes(searchValue);
});
}
this.$emit('search-result', filteredDevices);
2025-03-14 23:48:59 +08:00
}
2025-03-19 18:13:03 +08:00
2025-03-14 23:48:59 +08:00
}
2025-03-19 18:13:03 +08:00
2025-03-14 23:48:59 +08:00
}
</script>
<style scoped>
.equipment-management,
.equipment-management2 {
cursor: pointer;
}
.equipment-management {
2025-03-18 21:49:57 +08:00
width: 82px;
height: 24px;
border-radius: 12px;
2025-03-14 23:48:59 +08:00
background: #5778ff;
display: flex;
align-items: center;
justify-content: center;
2025-03-18 21:49:57 +08:00
gap: 7px;
2025-03-14 23:48:59 +08:00
font-weight: 500;
color: #fff;
2025-03-18 21:49:57 +08:00
font-size: 10px;
2025-03-14 23:48:59 +08:00
}
.equipment-management2 {
2025-03-20 14:08:38 +08:00
width: 82px;
height: 24px;
border-radius: 12px;
2025-03-14 23:48:59 +08:00
background: #fff;
display: flex;
justify-content: center;
2025-03-20 14:08:38 +08:00
font-size: 10px;
font-weight: 500;
2025-03-18 21:49:57 +08:00
gap: 7px;
2025-03-14 23:48:59 +08:00
color: #3d4566;
2025-03-20 14:08:38 +08:00
margin-left: 1px;
2025-03-14 23:48:59 +08:00
align-items: center;
}
.header {
background: #f6fcfe66;
border: 1px solid #fff;
2025-03-18 21:49:57 +08:00
height: 53px !important;
2025-03-14 23:48:59 +08:00
}
.serach-box {
display: flex;
2025-03-18 21:49:57 +08:00
width: 220px;
height: 30px;
border-radius: 15px;
background-color: #f6fcfe66;
border: 1px solid #e4e6ef;
2025-03-14 23:48:59 +08:00
align-items: center;
2025-03-18 21:49:57 +08:00
padding: 0 7px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-right: 15px;
2025-03-14 23:48:59 +08:00
}
2025-03-18 21:49:57 +08:00
.serach-box /deep/ .el-input__inner {
border-radius: 15px;
height: 100%;
width: 100%;
border: 0;
background: transparent;
padding-left: 12px;
}
2025-03-14 23:48:59 +08:00
.user-info {
font-weight: 600;
2025-03-18 21:49:57 +08:00
font-size: 12px;
2025-03-14 23:48:59 +08:00
letter-spacing: -0.02px;
text-align: left;
color: #3d4566;
}
</style>