<template>
|
<div>
|
<!-- 头部 -->
|
<el-header>
|
<!-- 左侧菜单 -->
|
<div class="menuLeft">
|
<div class="icon">
|
<img style="width:30px;height:30px"
|
src="https://axure-file.lanhuapp.com/90466432-c999-4bf0-80b8-ee3f96a2099e__155eeb2ceaac89ec717869a050964a36.svg"
|
alt="">
|
</div>
|
<div class="systemName">遂昌智慧执法平台</div>
|
<ul class="headerNav">
|
<li v-for="(item,index) in nav" :key="item.name" :class="item.checked?'activeIndex':''" @click="handleChange(index)">{{item.name}}</li>
|
</ul>
|
</div>
|
<!-- 右侧菜单 -->
|
<div class="menuRight">
|
<div class="search">
|
<el-input placeholder="请输入搜索内容" suffix-icon="el-icon-search" v-model="search">
|
</el-input>
|
</div>
|
<div class="userinfo userItem">
|
<div class="userIcon"></div>
|
<span class="username">admin<i class="el-icon-arrow-down" style="margin-left:3px"></i></span>
|
</div>
|
<div class="userMessage userBtn"><i class="el-icon-message-solid"></i></div>
|
<div class="userSetting userBtn"><i class="el-icon-s-tools"></i></div>
|
<div class="userLoginout userBtn" @click="loginout"><i class="el-icon-switch-button"></i></div>
|
</div>
|
</el-header>
|
</div>
|
</template>
|
|
<script>
|
import hamburger from "@/components/hamburger";
|
export default {
|
data() {
|
return {
|
opened: false,
|
search:'',
|
nav:[
|
{
|
name:'驾驶舱',
|
checked:true,
|
},
|
{
|
name:'视频查询',
|
checked:false,
|
},
|
{
|
name:'执法管理',
|
checked:false,
|
}
|
]
|
};
|
},
|
components: {
|
hamburger,
|
},
|
methods: {
|
loginout() {
|
this.$router.push({ path: "/login" })
|
},
|
handleChange(idx){
|
// 设置nav激活
|
this.nav.forEach((item,index)=>{
|
index==idx?item.checked = true:item.checked = false;
|
})
|
localStorage.setItem('navIdx',idx);
|
}
|
},
|
mounted() {
|
const idx = localStorage.getItem("navIdx");
|
if(idx){
|
this.handleChange(idx);
|
}
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
* {
|
margin: 0;
|
padding: 0;
|
}
|
|
.el-header {
|
background-color: rgb(0, 121, 254);
|
color: #333;
|
text-align: center;
|
line-height: 60px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
padding: 0;
|
position: fixed;
|
width: 100%;
|
top: 0px;
|
z-index: 9999;
|
.menuLeft {
|
color: #fff;
|
|
.icon {
|
margin: 0 20px;
|
}
|
|
.systemName {
|
width: 185px;
|
font-weight: 650;
|
font-size: 18px;
|
}
|
|
ul,
|
.icon {
|
display: flex;
|
align-items: center;
|
}
|
|
li {
|
list-style: none;
|
width: 100px;
|
&:hover{
|
cursor: pointer;
|
}
|
}
|
|
.activeIndex {
|
height: 30px;
|
line-height: 30px;
|
border-radius: 20px;
|
background-color: #53a5ff;
|
}
|
|
display: flex;
|
}
|
|
.menuRight {
|
display: flex;
|
align-items: center;
|
justify-content: space-evenly;
|
.search{
|
.el-input{
|
width: 200px;
|
margin: 0 10px;
|
}
|
.el-input__inner{
|
height: 30px;
|
}
|
}
|
.userItem{
|
width: 120px;
|
}
|
.userBtn{
|
width: 60px;
|
color: #fff;
|
font-size: 20px;
|
}
|
.userinfo {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
.userIcon {
|
width: 20px;
|
height: 20px;
|
border-radius: 50%;
|
background-image: url("@/assets/imgs/user/default-avatar.jpg");
|
background-size: cover;
|
}
|
|
.username {
|
margin: 0 5px;
|
color: #22d3eb;
|
font-size: 14px;
|
}
|
}
|
|
.loginout {
|
color: #22d3eb;
|
font-size: 14px;
|
}
|
}
|
}
|
</style>
|