Xxxu
2020-07-09 d37a714717b6b3b7fff343d16b36f8db04e579ed
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
  <nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
    <div class="site-navbar__header">
      <h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
        <div class="mytext">
          <a href="javascript:;" style="margin-left:40px;color: white;font-size:22px">智慧路灯大数据管理监控平台</a>
        </div>
      </h1>
    </div>
    <div style="float:right" class="site-navbar__body clearfix container">
      <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" background-color="#ffffff00">
        <el-menu-item class="site-navbar__switch" index="0"  @click="$router.push({ name: 'home' })">
          <u style="margin-top:10px">首页</u>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="1" @click="$router.push({ name: 'streetlight' })">
          <u>路灯管理</u>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="4" @click="$router.push({ name: 'led' })">
          <u>LED</u>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="5" @click="$router.push({ name: 'charge' })">
          <u>充电桩</u>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="3" @click="$router.push({ name: 'camera' })">
          <u>摄像头</u>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="2" @click="$router.push({ name: 'weather' })">
          <u>大气数据</u>
        </el-menu-item>
        <!-- <el-menu-item class="site-navbar__switch" index="6" @click="$router.push({ name: 'sos' })">
          <u>一键求助</u>
        </el-menu-item> -->
        <el-menu-item class="site-navbar__avatar" index="7">
          <el-dropdown :show-timeout="0" placement="bottom">
            <span class="el-dropdown-link">
              <img src="~@/assets/img/user.png" :alt="userName">
              <span style="color:white">{{ userName }}</span>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
              <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-menu-item>
      </el-menu>
      <!-- <el-menu
        class="site-navbar__menu"
        mode="horizontal">
        <el-menu-item class="site-navbar__switch" index="0"  @click="$router.push({ name: 'home' })">
          <span style="margin-top:10px">首页</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="1" @click="$router.push({ name: 'streetlight' })">
          <span>路灯管理</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="4" @click="$router.push({ name: 'led' })">
          <span>LED</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="5" @click="$router.push({ name: 'charge' })">
          <span>充电桩</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="3" @click="$router.push({ name: 'camera' })">
          <span>摄像头</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="2" @click="$router.push({ name: 'weather' })">
          <span>大气数据</span>
        </el-menu-item>
        <el-menu-item class="site-navbar__switch" index="6" @click="$router.push({ name: 'sos' })">
          <u>一键求助</u>
        </el-menu-item>
      <el-menu
        class="site-navbar__menu site-navbar__menu--right"
        mode="horizontal">
        <el-menu-item index="1" @click="$router.push({ name: 'theme' })">
          <template slot="title">
            <el-badge value="new">
              <icon-svg name="shezhi" class="el-icon-setting"></icon-svg>
            </el-badge>
          </template>
        </el-menu-item>
        <el-menu-item index="2">
          <el-badge value="hot">
            <a href="https://www.renren.io/" target="_blank">官方社区</a>
          </el-badge>
        </el-menu-item>
        <el-submenu index="3">
          <template slot="title">Git源码</template>
          <el-menu-item index="2-1"><a href="https://github.com/renrenio/renren-fast-vue" target="_blank">前端</a></el-menu-item>
          <el-menu-item index="2-2"><a href="https://gitee.com/renrenio/renren-fast" target="_blank">后台</a></el-menu-item>
          <el-menu-item index="2-3"><a href="https://gitee.com/renrenio/renren-generator" target="_blank">代码生成器</a></el-menu-item>
        </el-submenu>
        <el-menu-item class="site-navbar__avatar" index="3">
          <el-dropdown :show-timeout="0" placement="bottom">
            <span class="el-dropdown-link">
              <img src="~@/assets/img/avatar.png" :alt="userName">
              <span style="color:white">{{ userName }}</span>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
              <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-menu-item>
      </el-menu>
      -->
    </div>
    <!-- 弹窗, 修改密码 -->
    <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
  </nav>
</template>
 
<script>
  import UpdatePassword from './main-navbar-update-password'
  import { clearLoginInfo } from '@/utils'
  export default {
    data () {
      return {
        updatePassowrdVisible: false,
        activeIndex: '0'
      }
    },
    components: {
      UpdatePassword
    },
    computed: {
      navbarLayoutType: {
        get () { return this.$store.state.common.navbarLayoutType }
      },
      sidebarFold: {
        get () { return this.$store.state.common.sidebarFold },
        set (val) { this.$store.commit('common/updateSidebarFold', val) }
      },
      mainTabs: {
        get () { return this.$store.state.common.mainTabs },
        set (val) { this.$store.commit('common/updateMainTabs', val) }
      },
      userName: {
        get () { return this.$store.state.user.name }
      }
    },
    methods: {
      // 修改密码
      updatePasswordHandle () {
        this.updatePassowrdVisible = true
        this.$nextTick(() => {
          this.$refs.updatePassowrd.init()
        })
      },
      // 退出
      logoutHandle () {
        this.$confirm(`确定进行[退出]操作?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('/sys/logout'),
            method: 'post',
            data: this.$http.adornData()
          }).then(({data}) => {
            if (data && data.code === 0) {
              clearLoginInfo()
              this.$router.push({ name: 'login' })
            }
          })
        }).catch(() => {})
      }
    }
  }
</script>
<style lang="scss" scoped>
div{
  .mytext {
    background-image: url(~@/assets/img/bar_bg.png);
    background-size: 370px 50px;
  }
  .site-navbar__switch:hover {
    background-color: black;
  }
  .site-navbar__switch {
    padding:0 20px
  }
  /deep/ .el-menu {
    background-color: rgba(0, 0, 0, 0.1) !important;
  }
  /deep/ .el-menu-item {
    background-color: rgba(0, 0, 0, 0.1) !important;
  }
  /deep/ .el-menu--horizontal>.el-menu-item.is-active{
    border-bottom: 2px solid #0ac9ff !important
  }
  /deep/ .el-menu--horizontal{
    border-bottom: 0px;
  }
}
u {
  text-decoration:none
}
</style>