<template>
    <div class="logo">
        <div class="logo-bg">
            <div class="middelTextbg">{{ orgName }}{{ sysHeaderText }} </div>
            <div class="middelText" @click="ToGo()">{{ orgName }}{{ sysHeaderText }} </div>
        </div>
    </div>
</template>


<script lang="ts" setup>
import { getMenu } from '@/api/operation';
import router from '@/router';
import { reactive, watchEffect, ref, onMounted, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from "vuex";
import { key } from '@/store'
const store = useStore(key);

const route = useRoute();


const orgName = computed(() => {
    let name = '铁建高速'
    if (store.state.road?.orgInfo.organizationName) {
        name = store.state.road?.orgInfo.organizationName + '指挥部'
    }
    return name
});



type MenuListType = {
    [key: string]: string;
};

const menuList: MenuListType = {
    '/business': '智慧运营管理中心',

    '/charge': '智慧收费管理中心',

    '/videoSurveillance': '智慧运行检测调度中心',  //智慧运行检测调度中心
    '/patrolAndRescue': '智慧运行检测调度中心',
    '/operationOverview': '智慧运行检测调度中心',
    '/data-monitor': '智慧运行检测调度中心',

    '/curingManageyh': '智慧养护管理中心',
    '/curingBusinessyh': '智慧养护管理中心',
    '/electromechanicalMange': '智慧养护管理中心',
    '/electromechanicalOverview': '智慧养护管理中心',

    '/manageGenera': '智慧服务管理中心',
}


const currentPath = ref('')

const sysHeaderText = ref('')

watchEffect(() => {
    console.log('当前路由路径', route.path);
    currentPath.value = route.path
    sysHeaderText.value = menuList[route.path] || ''
});





const emits = defineEmits(["ToGo"]);
let urlList: any = reactive({ value: '' });

const ToGo = async () => {
    // 本地的时候注释此请求
    await getMenu().then((res) => { urlList.value = res?.dataList?.[0]?.url }) // // 本地注释此请求
    router.push(urlList.value) // 本地注释此请求
    // 本地跳转
    // router.push("/")
}


</script>
<style lang="postcss" scoped></style>
<style lang="scss" scoped>
@import "~/styles/viewport-convert.scss";

.logo-bg {
    width: vw(1920);
    height: vh(82);
    background: url("@/assets/images/newLog.png");
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    pointer-events: none;
}

.middelText {
    position: absolute;
    font-size: 28px;
    margin-top: 12px;
    font-weight: bold;
    cursor: pointer;
    line-height: 39px;
    letter-spacing: 4px;
    text-align: center;
    font-style: normal;
    text-transform: none;
    background: linear-gradient(0deg, #B2E5FF 0%, #FFFFFF 100%);
    text-shadow: none;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 1;
    pointer-events: all;
}

.middelTextbg {
    position: absolute;
    margin-top: 12px;
    text-shadow: 0px 4px 2px rgba(0, 17, 51, 0.5);
    z-index: 0;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
    color: transparent;
    display: block;
    cursor: pointer;
    pointer-events: none;
}
</style>
