2025-07-22 21:42:20 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="navbar">
|
2025-07-25 21:14:24 +08:00
|
|
|
<!-- <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container"
|
|
|
|
|
@toggleClick="toggleSideBar" /> -->
|
2025-07-22 21:42:20 +08:00
|
|
|
<breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />
|
2025-07-25 21:14:24 +08:00
|
|
|
<div class="navContent">
|
|
|
|
|
<div class="systemLogoContent">
|
|
|
|
|
<img v-if="homeLogo" :src="homeLogo" class="sidebar-logo" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="topmenu-container">
|
|
|
|
|
<top-nav v-if="settingsStore.topNav" id="topmenu-container" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right-menu">
|
|
|
|
|
<div class="el-dropdown avatar-container right-menu-item hover-effect">
|
|
|
|
|
<div class="avatar-wrapper">
|
|
|
|
|
<img :src="userStore.avatar ? userStore.avatar : avatar_icon" class="user-avatar" />
|
|
|
|
|
<span class="user-nickname"> {{ userStore.nickName }} admin </span>
|
|
|
|
|
<div class="logout_icon">
|
|
|
|
|
<img :src="logout_icon" class="custom-icon" @click="logout" />
|
|
|
|
|
</div>
|
2025-07-22 21:42:20 +08:00
|
|
|
</div>
|
2025-07-25 21:14:24 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="right-menu-item hover-effect setting" @click="setLayout" v-if="settingsStore.showSettings">
|
|
|
|
|
<svg-icon icon-class="more-up" />
|
2025-07-22 21:42:20 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ElMessageBox } from 'element-plus'
|
|
|
|
|
import Breadcrumb from '@/components/Breadcrumb'
|
2025-07-25 21:14:24 +08:00
|
|
|
import homeLogo from '@/assets/logo/homeLogo.png'
|
|
|
|
|
import avatar_icon from '@/assets/images/avatar_icon.png'
|
|
|
|
|
import logout_icon from '@/assets/images/logout_icon.png'
|
2025-07-22 21:42:20 +08:00
|
|
|
import TopNav from '@/components/TopNav'
|
|
|
|
|
import useAppStore from '@/store/modules/app'
|
|
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
|
|
import useSettingsStore from '@/store/modules/settings'
|
|
|
|
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const settingsStore = useSettingsStore()
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
console.log('settingsStore.topNav', settingsStore.topNav)
|
|
|
|
|
|
2025-07-22 21:42:20 +08:00
|
|
|
function toggleSideBar() {
|
|
|
|
|
appStore.toggleSideBar()
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
// 退出系统
|
|
|
|
|
const logout = () => {
|
2025-07-22 21:42:20 +08:00
|
|
|
ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
userStore.logOut().then(() => {
|
|
|
|
|
location.href = '/index'
|
|
|
|
|
})
|
|
|
|
|
}).catch(() => { })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['setLayout'])
|
|
|
|
|
function setLayout() {
|
|
|
|
|
emits('setLayout')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toggleTheme() {
|
|
|
|
|
settingsStore.toggleTheme()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang='scss' scoped>
|
2025-07-25 21:14:24 +08:00
|
|
|
.myRow {
|
|
|
|
|
margin-left: 0 !important;
|
|
|
|
|
margin-right: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-22 21:42:20 +08:00
|
|
|
.navbar {
|
2025-07-25 21:14:24 +08:00
|
|
|
height: 80px;
|
2025-07-22 21:42:20 +08:00
|
|
|
overflow: hidden;
|
|
|
|
|
position: relative;
|
2025-07-25 21:14:24 +08:00
|
|
|
background: transparent;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
|
|
|
|
.navContent {
|
|
|
|
|
height: 43px;
|
|
|
|
|
width: 1840px;
|
|
|
|
|
margin: 19px auto 18px auto;
|
|
|
|
|
display: flex; // 添加flex布局
|
|
|
|
|
justify-content: space-between; // 使子元素平均分布
|
|
|
|
|
align-items: center; // 垂直居中
|
2025-07-22 21:42:20 +08:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
.systemLogoContent {
|
|
|
|
|
width: 220px;
|
2025-07-22 21:42:20 +08:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
.topmenu-container {
|
|
|
|
|
flex: 1; // 占据剩余空间
|
|
|
|
|
padding-left: 284px; // 替代原来的padding-left
|
2025-07-22 21:42:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.right-menu {
|
|
|
|
|
height: 100%;
|
2025-07-25 21:14:24 +08:00
|
|
|
width: 220px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
line-height: normal; // 覆盖原来的line-height
|
|
|
|
|
display: flex; // 内部也使用flex
|
|
|
|
|
align-items: center; // 垂直居中
|
|
|
|
|
justify-content: flex-end; // 内容靠右
|
2025-07-22 21:42:20 +08:00
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
|
outline: none;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
.right-menu-item {
|
2025-07-22 21:42:20 +08:00
|
|
|
height: 100%;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
color: #5a5e66;
|
|
|
|
|
vertical-align: text-bottom;
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
&.hover-effect {
|
2025-07-22 21:42:20 +08:00
|
|
|
transition: background 0.3s;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
background: rgba(0, 0, 0, 0.025);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.theme-switch-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
svg {
|
|
|
|
|
transition: transform 0.3s;
|
2025-07-25 21:14:24 +08:00
|
|
|
|
2025-07-22 21:42:20 +08:00
|
|
|
&:hover {
|
|
|
|
|
transform: scale(1.15);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar-container {
|
|
|
|
|
margin-right: 0px;
|
|
|
|
|
padding-right: 0px;
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
.avatar-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-07-22 21:42:20 +08:00
|
|
|
|
|
|
|
|
.user-avatar {
|
|
|
|
|
width: 30px;
|
|
|
|
|
height: 30px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 21:14:24 +08:00
|
|
|
.user-nickname {
|
|
|
|
|
bottom: 0 !important; // 移除原来的bottom定位
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
font-family: Microsoft YaHei;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
color: #FFFFFF;
|
2025-07-22 21:42:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: -20px;
|
|
|
|
|
top: 25px;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-25 21:14:24 +08:00
|
|
|
|
|
|
|
|
.logout_icon {
|
|
|
|
|
margin-left: 30px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.hamburger-container {
|
|
|
|
|
line-height: 46px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
float: left;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: background 0.3s;
|
|
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
background: rgba(0, 0, 0, 0.025);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.breadcrumb-container {
|
|
|
|
|
float: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.errLog-container {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
vertical-align: top;
|
2025-07-22 21:42:20 +08:00
|
|
|
}
|
|
|
|
|
</style>
|