ColorWhiteDeveloper
2022-09-19 17792a8900da5a2dbdc32c1dd865a92c027a1ca6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<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>