智慧园区前端大屏
shuishen
2024-11-12 7ebb90b4d99cd661dcb9c9bdc9a1932e5b4a102f
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
<template>
  <div class="page-mode">
    <div @mouseenter="item.childrenFlag = true" :class="{ active: buttonIndex == item.value }"
      @mouseleave="item.childrenFlag = false" @click="goToPath(item)" v-for="(item, index) in menuList" :key="index">
      {{ item.menuName }}
    </div>
  </div>
</template>
 
<script setup>
import { ref, reactive, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { Search } from '@element-plus/icons-vue'
import { getTime } from '@/utils/getTime.js'
import { usePointStore } from 'store/usepoint'
const useAppStore = usePointStore()
let router = useRouter()
let currentUrl = ref('statistics')
 
const menuList = ref(
  [
    {
      menuName: '企业信息',
      path: '/layout/sub/companyInfo',
      value: 1,
    },
    {
      menuName: '应急物质',
      path: '/layout/sub/',
      value: 2,
    },
    {
      menuName: '应急空间',
      path: '/layout/ws',
      value: 3,
    },
    {
      menuName: '三道防线',
      path: '/layout/sj',
      value: 4,
    }
  ]
)
let { buttonIndex } = defineProps({
  buttonIndex: Number
})
 
// 父级方法
const emit = defineEmits(['childEvent'])
 
const goToPath = (params) => {
  if (params.value == 1) {
   useAppStore.updateSharedData('1')
    emit('childEvent', params.value)
    return
  } else if (params.value == 2) {
   useAppStore.updateSharedData('1')
    emit('childEvent', params.value)
    return
  } else if (params.value == 3) {
   useAppStore.updateSharedData('3')
    emit('childEvent', params.value)
    return
  } else if (params.value == 4) {
   useAppStore.updateSharedData('1')
    emit('childEvent', params.value)
    return
  }
  if (params.children && params.children.length > 0) return
 
  if (params.path) {
    if (router.currentRoute.value.path == params.path) return
    // router.push(params.path)
  } else {
    params.childrenFlag = !params.childrenFlag
  }
}
 
watch(
  () => router.currentRoute.value,
  (newValue, oldValue) => {
    currentUrl.value = newValue.path
  },
  { immediate: true }
)
 
const userName = ref('管理员')
</script>
 
<style lang="scss" scoped>
.page-mode {
  position: absolute;
  top: auto;
  bottom: 55px;
  left: 50%;
  z-index: 99;
  transform: translateX(-50%);
  display: flex;
  pointer-events: auto;
 
  &>div {
    background-image: url(/images/mode-tab.png);
    background-size: cover;
    width: 150px;
    height: 50px;
    font-size: 16px;
    text-align: center;
    font-weight: bold;
    color: #BFD3E5;
    line-height: 32px;
    padding-top: 12px;
    margin-right: -20px;
    font-style: italic;
    cursor: pointer;
    box-sizing: border-box;
 
    &:last-child {
      margin-right: 0px;
    }
 
    &.active {
      color: #F6FCFF;
      background-image: url(/images/mode-tab-ac.png);
    }
 
    &:hover {
      background-image: url(/images/mode-tab-ac.png);
    }
  }
}
</style>