integrated_traffic_vue/src/views/BI/index.vue

189 lines
4.7 KiB
Vue

<template>
<div id="bi_container">
<div id="map" class="map_bg"></div>
<transition
enter-active-class="animate__animated animate__fadeInDown"
leave-active-class="animate__animated animate__fadeOutUp"
>
<div :key="transitionKey" class="header">
<div class="back" @click="router.back()">
<img src="/src/assets/images/map/back.png" alt="" />
</div>
<div class="light"></div>
<div class="title" />
</div>
</transition>
<div v-if="leftCurrentComponent" class="left_container">
<transition
enter-active-class="animate__animated animate__fadeInLeft"
leave-active-class="animate__animated animate__fadeOutLeft"
mode="out-in"
>
<component :is="leftCurrentComponent" />
</transition>
</div>
<div class="mid-container">
<bottom-options
v-model:left-current-component="leftCurrentComponent"
v-model:right-current-component="rightCurrentComponent"
v-model:right-option="right_option"
v-model:is-historical-trajectory="isHistoricalTrajectory"
/>
</div>
<transition
enter-active-class="animate__animated animate__fadeInRight"
leave-active-class="animate__animated animate__fadeOutRight"
mode="out-in"
>
<div v-if="rightCurrentComponent" class="right_container">
<component :is="rightCurrentComponent" />
</div>
</transition>
<div v-show="right_option" class="right_ico">
<right-ico></right-ico>
</div>
<historical-trajectory-options v-if="isHistoricalTrajectory" />
</div>
</template>
<script setup>
import autofit from "autofit.js";
import { onBeforeUnmount, onMounted, ref } from "vue";
import RightIco from "./components/rightico.vue";
import BottomOptions from "./components/bottom_options.vue";
import HistoricalTrajectoryOptions from "./components/historical_trajectory_options.vue";
import { useRouter } from "vue-router";
import { initMap } from "./js/map";
import { useUserStore } from "@/pinia/user.js";
import { getEnterpriseInfo } from "@/request/enterprise_management.js";
const router = useRouter();
const right_option = ref(true);
const transitionKey = ref(0);
const leftCurrentComponent = ref("");
const rightCurrentComponent = ref("");
const isHistoricalTrajectory = ref(false);
const userStore = useUserStore();
const CORPINFO_ID = userStore.getUserInfo.CORPINFO_ID;
onMounted(async () => {
autofit.init({
dh: document.querySelector(".map_bg").offsetHeight,
dw: 1920,
el: "#bi_container",
resize: true,
});
transitionKey.value = Math.random();
const corp = await getEnterpriseInfo({ CORPINFO_ID });
initMap(corp.pd);
});
onBeforeUnmount(() => {
window.$scene = null;
window.$icy = null;
window.$carmer = null;
autofit.off();
});
</script>
<style scoped lang="scss">
#bi_container {
width: 100%;
height: 100%;
color: #ffffff;
position: relative;
font-size: 14px;
.map_bg {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -9;
background-size: 100% 100%;
}
.header {
width: 100%;
height: 100px;
background: url("/src/assets/images/map/titlebg.png") no-repeat top center;
background-size: 100% 100%;
position: absolute;
.back {
position: absolute;
top: 0;
left: 0;
cursor: pointer;
}
.light {
background-image: url("/src/assets/images/map/gunag.png");
background-size: 100% 100%;
background-repeat: no-repeat;
width: 619px;
height: 55px;
position: absolute;
top: 50px;
left: 50%;
animation: scale 2s infinite;
@keyframes scale {
0% {
transform: translateX(-50%) scale(1);
}
50% {
transform: translateX(-50%) scale(0.5);
}
100% {
transform: translateX(-50%) scale(1);
}
}
}
.title {
width: 355px;
height: 50px;
text-align: center;
position: absolute;
left: 50%;
top: 15%;
transform: translate(-50%, 0%);
background: url("/src/assets/images/map/title.png") no-repeat top center;
}
}
.left_container {
width: 435px;
position: absolute;
left: 20px;
top: 100px;
}
.right_container {
width: 435px;
position: absolute;
right: 20px;
top: 100px;
}
.mid-container {
width: 934px;
height: 88px;
background-image: url("/src/assets/images/map/bottombg.png");
background-repeat: no-repeat;
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.right_ico {
position: fixed;
right: 20px;
bottom: 50px;
}
}
</style>