quanyawei
2024-06-18 15fb2702039aae1a297b8f1584e24f228ae1994d
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
199
200
201
202
203
<template>
  <div class="header" v-cloak>
    <div class="top_nav">
      <div class="container">
        <div class="logo">
          <img
            src="/src/assets/image/header_logo.png"
            title="七星瓢虫环境科技-大气污染解决方案 空气监测 臭氧与PM2.5协同管控"
          />
        </div>
        <div class="top-nav">
          <ul class="menuList">
            <li
              v-for="menu in menuList"
              :key="menu.id"
              @mouseenter="menu.show = !menu.show"
              @mouseleave="menu.show = !menu.show"
            >
              <div></div>
 
              <span class="navName" @click="goPage(menu)">
                <img v-if="menu.id === '7'" src="/src/assets/image/phone.png" class="phoneIcon" />
                {{ menu.name }}
              </span>
              <span v-if="menu.id !== '7'">|</span>
              <template v-if="menu.list.length > 0">
                <div class="overList" v-show="menu.show">
                  <div
                    @click="goPage(val)"
                    v-for="(val, index) in menu.list"
                    :key="index"
                    class="menuBox"
                    :class="{ hoverBg: val.show }"
                    @mouseenter="val.show = !val.show"
                    @mouseleave="val.show = !val.show"
                  >
                    <div>
                      {{ val.name }}
                    </div>
                  </div>
                </div>
              </template>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
let menuList = reactive([
  { name: '首页', path: '/', id: '1', show: false, list: [] },
  {
    name: '解决方案',
    path: '/solution',
    id: '2',
    show: false,
    list: [
      { name: '臭氧&PM2.5协同管控', show: false, path: '/solution', id: '2' },
      { name: '涉气企业无组织排放断面管控', show: false, path: '/solution', id: '21' },
      { name: '环保管家服务', show: false, path: '/solution', id: '22' },
      { name: '更多详情', show: false, path: '/solution', id: '23' }
    ]
  },
  {
    name: '产品中心',
    path: '/product',
    show: false,
    id: '3',
    list: [
      { name: '23参数微型空气站', show: false, path: '/product', id: '3' },
      { name: '大气环境智慧监测指挥平台', show: false, path: '/product', id: '31' },
      { name: '无人机数据黑匣子监测系统', show: false, path: '/product', id: '32' },
      { name: '一体化扬尘监测系统', show: false, path: '/product', id: '33' }
    ]
  },
  {
    name: '新闻中心',
    path: '/news',
    show: false,
    id: '4',
    list: [
      { name: '公司新闻', show: false, path: '/news', id: '4' },
      { name: '行业新闻', show: false, path: '/news', id: '41' }
    ]
  },
  {
    name: '关于我们',
    path: '/about',
    show: false,
    id: '5',
    list: [
      { name: '品牌故事', show: false, path: '/about', id: '5', hash: '#mian1' },
      { name: '发展历程', show: false, path: '/about', id: '51', hash: '#mian2' },
      { name: '企业文化', show: false, path: '/about', id: '52', hash: '#mian3' }
    ]
  },
  { name: '联系我们', path: '/contact', id: '6', show: false, list: [] },
  { name: '0512-36871300', path: '/contact', id: '7', show: false, list: [] }
])
const router = useRouter()
let goPage = (item: any) => {
  if (item.path !== '') {
    let hash = item.hash ? item.hash : ''
    router.push({
      path: item.path,
      hash: hash,
      query: { name: item.name, id: item.id, key: Math.random() }
    })
  }
}
</script>
 
<style scoped lang="scss">
[v-cloak] {
  display: none;
}
body {
  margin: 0px;
}
@media (min-width: 768px) {
  .container {
    width: 750px;
  }
}
@media (min-width: 992px) {
  .container {
    width: 970px;
  }
}
@media (min-width: 1200px) {
  .container {
    /* width: 1170px; */
    width: 1270px;
  }
}
.header {
  position: fixed;
  z-index: 100;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  padding-top: 10px;
 
  .container {
    margin-right: auto;
    margin-left: auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    .top-nav {
      li {
        cursor: pointer;
        margin-right: 10px;
        color: #fff;
        font-weight: 900;
        font-size: 14px;
        position: relative;
        .navName {
          padding: 0.2em 1.5em;
          font-size: 0.875em;
          line-height: 57px;
          transition: 0.5s all;
          &:hover {
            color: #ff575a;
          }
        }
        .overList {
          position: absolute;
          width: 185px;
          left: 0;
          padding-bottom: 12px;
          transition: 0.5s all;
          background: rgba(0, 0, 0, 0.7);
          border-bottom-right-radius: 6px;
          border-bottom-left-radius: 6px;
          margin-left: -35px;
          overflow: hidden;
          padding-top: 6px;
          box-shadow: 0 0 2px #ccc inset;
          text-align: center;
          .menuBox {
            padding: 10px;
            font-size: 12px;
            border-bottom: 1px solid #f2f2f2;
          }
        }
      }
    }
  }
}
.menuList {
  display: flex;
}
.hoverBg {
  background: #ff575a;
}
.phoneIcon {
  vertical-align: middle;
}
</style>