yudao-dev/src/views/home/components/Navbar.vue
2024-08-01 15:59:13 +08:00

168 lines
3.0 KiB
Vue

<template>
<div class="navbar">
<div class="logo-container">
<img
src="../../../assets/images/cnbm.png"
style="
width: 34px;
height: 34px;
position: relative;
top: 9px;
margin-right: 8px;
"
alt="" />
MES产品化重构
</div>
<top-nav id="homemenu-container" class="homemenu-container" v-if="topNav" />
<div style="padding-top: 5px; padding-right: 38px">
<navbar-right :blackTitle="true" />
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import TopNav from './TopNav';
import Hamburger from '@/components/Hamburger';
import Screenfull from '@/components/Screenfull';
import SizeSelect from '@/components/SizeSelect';
import Search from '@/components/HeaderSearch';
import NotifyMessage from '@/layout/components/Message';
// import {getPath} from "@/utils/ruoyi";
import NavbarRight from './NavbarRight.vue';
export default {
components: {
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
NotifyMessage,
NavbarRight,
},
computed: {
...mapGetters(['sidebar', 'avatar', 'nickname', 'device']),
setting: {
get() {
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val,
});
},
},
topNav: {
get() {
return this.$store.state.settings.topNav;
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar');
},
async logout() {
this.$modal
.confirm('确定注销并退出系统吗?', '提示')
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/');
});
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
.navbar {
height: 84px; // 56/48
overflow: hidden;
position: relative;
.logo-container {
color: #fff;
line-height: 84px;
height: 100%;
float: left;
cursor: pointer;
font-size: 26px;
padding-left: 40px;
font-weight: 500;
}
.homemenu-container {
position: absolute;
left: 290px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 56px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.user-nickname {
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
}
</style>