QYF-GitLab1
2025-03-04 d958e1e0a3f9c1e051e803831552ec7d62e76da6
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
<template>
  <div class="header-container">
    <div class="logo">
      <!-- <img src="../assets/vue.svg" alt="logo" /> -->
      <span>基于状态驱动的机构测试系统 </span>
    </div>
    <el-menu
      mode="horizontal"
      :default-active="activeIndex"
      class="header-menu"
      @select="handleSelect"
      router
    >
      <el-menu-item index="/">模型管理</el-menu-item>
      <el-menu-item index="/simulation-config">可视化仿真</el-menu-item>
      <el-menu-item index="/system/user">系统管理</el-menu-item>
    </el-menu>
    <div class="header-right">
      <div class="user-info" @click="handleUserClick">
        <el-avatar src="path/to/avatar.png"></el-avatar>
        <span>用户名</span>
      </div>
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { ref, defineEmits } from "vue";
import { useRouter } from "vue-router";
 
const activeIndex = ref("/");
const emit = defineEmits(["selectMenu"]);
const router = useRouter();
 
const handleSelect = (key: string) => {
  activeIndex.value = key;
  emit("selectMenu", key);
};
 
const handleUserClick = () => {
  router.push("/user/profile");
};
</script>
 
<style lang="less" scoped>
.header-container {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
 
  .logo {
    display: flex;
    align-items: center;
    margin-right: 40px;
 
    img {
      height: 32px;
      margin-right: 10px;
    }
 
    span {
      font-size: 20px;
      font-weight: bold;
      color: #303133;
    }
  }
 
  .header-menu {
    flex: 1;
    border-bottom: none;
    background-color: transparent;
  }
 
  .header-right {
    margin-left: 20px;
 
    .user-info {
      display: flex;
      align-items: center;
      cursor: pointer;
 
      .el-avatar {
        margin-right: 8px;
      }
 
      span {
        color: #303133;
      }
    }
  }
}
 
:deep(.el-menu--horizontal) {
  border-bottom: none;
}
 
:deep(.el-menu-item) {
  color: #303133;
  margin: 0 20px !important;
 
  &:hover {
    color: #303133;
  }
}
</style>