智慧园区前端大屏
shuishen
2024-12-18 9a37c5e1b2190c3f6ec71483923922189091dd52
src/pages/layout/index.vue
@@ -1,261 +1,17 @@
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:18:24
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-11 18:36:37
 * @FilePath: \bigScreen\src\views\layout\index.vue
 * @Description:
 *
 * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
-->
<template>
  <div class="wrapper">
    <div v-if="showSinglePage" class="main-content single-page" id="MainContent">
      <router-view></router-view>
    </div>
    <map-container v-if="!showSinglePage" ref="MapContainer">
      <template #content>
        <div v-if="showContent" :class="[showSubLayout ? 'main-content-sub' : 'main-content']" id="MainContent">
          <main-search></main-search>
          <main-tool></main-tool>
          <router-view class="w100 h100" key="1"></router-view>
        </div>
      </template>
    </map-container>
  <div class="w100 h100">
    <router-view></router-view>
  </div>
</template>
<script setup>
import { useRouter, useRoute } from 'vue-router'
let router = useRouter()
import mainSearch from './components/mainSearch.vue'
import mainTool from './components/mainTool.vue'
<script>
export default {
  setup () {
import { useLogin } from 'store/login'
const loginStore = useLogin()
import { useMap } from 'store/map'
import { useRouterStore } from 'store/router'
const store = useMap()
const storeRouter = useRouterStore()
const showContent = ref(false)
const showSubLayout = ref(false)
const showSinglePage = ref(false)
// onMounted(() => {
//   store.setLoadSub(false)
// }),
// 监听createB的变化
watch(
  [
    () => store.loadMap,
    () => storeRouter.loadSub,
    () => storeRouter.loadSingle,
  ],
  ([newLoadMap, newLoadSub, newLoadSingle]) => {
    showContent.value = newLoadMap
    showSubLayout.value = newLoadSub
    showSinglePage.value = newLoadSingle
  },
  { immediate: true } // 设置immediate为true以便在组件挂载时立即检查createB的值
)
const signOut = () => {
  loginStore.LogOut().then(res => {
    router.push({
      path: '/login'
    })
  })
    return {}
  }
}
</script>
<style scoped lang="scss">
$bg-blue: rgba(24, 33, 92, 0.9);
.wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  #MainContent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
  }
  .main-content {
    height: 1080px;
    background: url(/images/header.png) no-repeat center / 100% 100%,
      url(/images/pro-bg.png) no-repeat center / 100% 100%;
    pointer-events: none;
    &.single-page {
      background: url(/images/header.png) no-repeat center / 100% 100%,
        url(/images/pro-bg.png) no-repeat center / 100% 100%,
        rgba(0, 0, 0, 1);
    }
    .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;
    }
  }
  .main-content-sub {
    height: 1080px;
    background: url(/images/wrapper-box-bg.png) no-repeat center / 100% 100%,
      url(/images/pro-bg.png) no-repeat center / 100% 100%;
    pointer-events: none;
    .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;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        .img {
          width: 16px;
          height: 16px;
        }
        span {
          font-size: 13px;
        }
      }
    }
    .main-container {
      position: absolute;
      top: 40px;
      left: 40px;
      right: 40px;
      bottom: 40px;
    }
  }
}
</style>
<style lang="scss" scoped></style>