xyc
4 天以前 5d015d74fe31d9b56b45414cc96762c6abdf1dfd
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
<template>
  <header class="app-header">
    <div class="brand">
      <repair-logo></repair-logo>
      <span>临抢修管理系统</span>
      <em>网络版</em>
    </div>
    <div class="header-right">
      <span><i class="el-icon-user-solid"></i> {{ realName }}</span>
      <el-button type="text" icon="el-icon-switch-button" @click="logout">退出登录</el-button>
    </div>
  </header>
</template>
 
<script>
import RepairLogo from '@/components/RepairLogo.vue'
 
export default {
  name: 'AppHeader',
  components: { RepairLogo },
  computed: {
    realName() {
      return sessionStorage.getItem('realName') || '系统管理员'
    }
  },
  methods: {
    logout() {
      this.$confirm('确定退出登录吗?', '提示', { type: 'warning' }).then(() => {
        sessionStorage.clear()
        this.$router.push('/login')
      }).catch(() => {})
    }
  }
}
</script>
 
<style scoped>
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 20px;
  color: #fff;
  background: #1d3b57;
  box-shadow: 0 1px 4px rgba(18, 41, 63, 0.24);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 600; }
.brand .repair-logo { color: #7fc4ff; font-size: 25px; transform: translateY(2px); }
.brand em { padding: 1px 6px; border: 1px solid rgba(255,255,255,.35); border-radius: 3px; font-size: 11px; font-style: normal; font-weight: 400; opacity: .85; }
.header-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.header-right .el-button { color: #d8e9f7; }
.header-right .el-button:hover { color: #fff; }
</style>