智慧园区前端大屏
shuishen
2024-12-02 00bd950b9b697422d0e3bea334f17e000d1839f7
路由调整
2 files added
238 ■■■■■ changed files
src/pages/main/components/mainMenu.vue 120 ●●●●● patch | view | raw | blame | history
src/pages/main/index.vue 118 ●●●●● patch | view | raw | blame | history
src/pages/main/components/mainMenu.vue
New file
@@ -0,0 +1,120 @@
<template>
  <div class="page-mode">
    <div @mouseenter="item.childrenFlag = true" :class="{ active: currentUrl.indexOf(item.path) != -1 }"
      @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 { useRouterStore } from 'store/router'
const store = useRouterStore()
let router = useRouter()
let currentUrl = ref('statistics')
const menuList = ref(
  [
    {
      menuName: '园区概况',
      path: '/layout/map/survey'
    },
    {
      menuName: '风险源',
      path: '/layout/map/rs'
    },
    {
      menuName: '应急空间',
      path: '/layout/map/space'
    },
    {
      menuName: '应急物资',
      path: '/layout/single/supplies'
    },
    {
      menuName: '三级防控',
      path: '/layout/map/pac'
    },
    {
      menuName: '救援队伍',
      path: '/layout/single/rt'
    },
    {
      menuName: '突发事件模拟',
      path: '/layout/map/pd'
    },
    {
      menuName: '作战图',
      path: '/layout/single/ochart'
    },
  ]
)
const goToPath = (params) => {
  if (params.children && params.children.length > 0) return
  if (params.path) {
    if (router.currentRoute.value.path == params.path) return
    router.push({
      path: 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: 136px;
    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);
    }
  }
}
</style>
src/pages/main/index.vue
New file
@@ -0,0 +1,118 @@
<template>
  <div class="w100 h100 relative">
    <div class="main-header">
      <div class="title">吉水化工园区“一园一策一图”VR平台</div>
      <div class="login-out" @click="signOut">
        <img :src="loginOutBg" class="img" />
        <span>退出</span>
      </div>
    </div>
    <div class="main-container">
      <!-- 地图区域 -->
      <router-view></router-view>
    </div>
    <main-menu></main-menu>
  </div>
</template>
<script setup>
import { getAssetsFile } from 'utils/utils'
import { useRouter, useRoute } from 'vue-router'
let router = useRouter()
const loginOutBg = getAssetsFile('login.png', '/images')
import mainMenu from './components/mainMenu.vue'
import { useLogin } from 'store/login'
const loginStore = useLogin()
const signOut = () => {
  loginStore.LogOut().then(res => {
    router.push({
      path: '/login'
    })
  })
}
</script>
<style lang="scss" scoped>
.main-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  pointer-events: auto;
  .title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    width: 640px;
    height: 40px;
    font-size: 24px;
    font-family: YouSheBiaoTiHei;
    font-weight: 400;
    color: #eff8fc;
    line-height: 40px;
    text-align: center;
    letter-spacing: 8px;
    font-weight: bolder;
    background: linear-gradient(to bottom,
        #e2eaf0 0%,
        #aed1f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    // opacity: 0.89;
    // text-shadow: 0px 4px 1px rgba(19, 80, 143, 0.66);
    // background: linear-gradient(0deg, rgba(119, 186, 255, 0.45) 0%, rgba(233, 248, 255, 0.45) 73.3154296875%, rgba(255, 255, 255, 0.45) 100%);
    // -webkit-background-clip: text;
    // -webkit-text-fill-color: transparent;
  }
  .login-out {
    position: absolute;
    top: 10px;
    right: 40px;
    height: 36px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    cursor: pointer;
    .img {
      width: 16px;
      height: 16px;
      margin-right: 5px;
    }
    span {
      font-size: 13px;
    }
  }
  .login-out:hover {
    background-color: #3c5e8f;
    border-radius: 20px;
  }
}
.main-container {
  position: absolute;
  top: 40px;
  left: 40px;
  right: 40px;
  bottom: 40px;
}
</style>