You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<script setup lang="ts"> import { useSystemStore } from '@/stores/systemStore' import HomeAlarmSvg from 'assets/images/home/home-alarm.svg' import ErrorBox from 'libs/modalUtil' import { formatDateTime } from 'libs/utils' import { authRoutes } from 'router/routes' import { onMounted, onUnmounted, ref } from 'vue' import { useRouter } from 'vue-router'
const router = useRouter() const systemStore = useSystemStore() const languages = systemStore.$state.languages const currentTime = ref(formatDateTime()) const languageType = ref('zh-cn') const timeInterval = setInterval(() => { currentTime.value = formatDateTime() }, 1000)
onMounted(() => { console.log(111) }) onUnmounted(() => { clearInterval(timeInterval) }) const showErrorModal = () => { ErrorBox.alert('这是一条警告信息') } const onLogout = () => { router.push('/login') } </script>
<template> <el-container class="main"> <el-header class="header"> <div class="logo"> <img src="../assets/images/logo.svg" alt=""> </div> <div class="header-right"> <div class="header-menu"> <div class="aside"> <el-tag v-for="item in authRoutes.filter(item => item.meta!.isDefault)" :key="item.path" class="menu-tag" :class="{ 'aside-item-active': router.currentRoute.value.path.includes(item.path) }" @click="router.push(item.path)" > <template #default> <div class="menu-tags"> <img class="swing-icon" :src="((router.currentRoute.value.path.includes(item.path) ? item.meta!.activeIcon : item.meta!.icon) as string)" alt=""> <span class="text" :class="{ 'active-text': router.currentRoute.value.path.includes(item.path) }">{{ item.meta!.title }}</span> </div> </template> </el-tag> </div> </div> <div class="user"> <el-select v-model="languageType" style="width: 100px; border-radius: 5px;" disabled> <el-option v-for="language in languages" :key="language.value" :value="language.value" :label="language.name"> {{ language.name }} </el-option> </el-select> <bt-button type="primary" button-text="注销" @click="onLogout" /> </div> </div> </el-header> <el-container class="container"> <el-main> <router-view v-slot="{ Component }" class="content"> <transition name="el-fade-in-linear"> <component :is="Component" /> </transition> </router-view> </el-main> </el-container> <footer class="footer"> <div class="ip-info">IP : 192.0.0.0</div> <div class="alarm-info" @click="showErrorModal"> <img :src="HomeAlarmSvg" width="20" alt="报警"> <div>机器报警信息</div> </div> <div class="time"> {{ currentTime }} </div> </footer> </el-container> </template>
<style scoped lang="scss"> .main { box-sizing: border-box; height: 100%; background: #fff; .header, .footer { height: 50px; width: 100%; display: flex; align-items: center; padding: 10px 15px; } .header { color: #393F46;
.logo { height: 22px; width: 100px; display: flex; align-items: center; .title { margin:0 10px; color: #8799AB; font-weight: 600; } img { height: 100%; } .expand-icon { height: 15px; transition: all 0.3s; } .fold-icon { height: 15px; transform: rotate(90deg); transition: all 0.3s; } } .header-right { display: flex; align-items: center; height: 100%; .header-menu{ width: 68vw; } .wifi-icon { width: 40px; height: 100%; background: #fff; border-radius: 5px; display: flex; align-items: center; justify-content: center; img { height: 50%; } } } .user { width: 20vw; text-align: right; .user-logout { margin-left: auto; } } } .container { height: calc(100% - 100px); background: #F6F6F6; } } .aside { overflow: hidden; padding-left: 10px; display: flex; align-items: center; .menu-tag{ height: 2.5rem; border: 0px; width: 10rem; display: flex; gap: 5px; font-size: 16px; background: white; } .menu-tags{ display: flex; align-items: center; .text { padding-left: 10px; color: #191919; } .active-text{ color: #ffffff; } } .aside-item { height: 50px; border-radius: 10px; margin: 10px 0; padding: 0 10px; display: flex; align-items: center; overflow: hidden; height: 3.5vw; justify-content: center; min-width: 6rem; img { margin-right: 10px; } } .aside-item-active { background: #1989FA; display: flex; justify-content: center; } }
.aside-off { width: 70px; //transition: all 0.1s ease;
.aside-item { .text { opacity: 0 } } .aside-item-active { background: rgba(0,0,0,0); color: #fff; } } .user-dropdown-item { display: flex; align-items: center; height: 100%; color: #393F46; font-weight: bold; img { height: 30px; margin-right: 10px; } } .el-main { padding: 0 15px; height: 100%; position: relative; } .content { width: 100%; height: $main-container; padding: 10px; } .footer-expand { padding: 10px 15px 10px 85px !important; } .main .footer { padding: 10px; .el-row { width: 100%; height: 100%; .el-col { height: 100%; } } .footer-left, .footer-right { width: 100%; height: 100%; background: #fff; border-radius: 5px; display: flex ; align-items: center; padding: 0 20px; } .footer-left { border-right: 5px solid #F6F6F6; img { height: 60%; } .text { color: #1C1C1C ; margin-left: 10px; font-size: 14px; } } .footer-right { border-left: 10px solid #F6F6F6; .status { width: 15px; height: 15px; border-radius: 50%; background: #4EE993; } .text { color: #1C1C1C ; margin-left: 10px; font-size: 14px; } }
.ip-info{ font-size: 1rem; width: 20vw; padding-left: 1.3vw; } .alarm-info { font-size: 1rem; width: 60vw; padding-left: 1.3vw; background: #F5F5F5; height: 5vh; display: flex; align-items: center; gap: 5px; } .time { height: 100%; display: flex; align-items: center; border-radius: 5px; margin-left: 2.5vw; padding: 1vw; } } .aside-item { .swing-icon { // animation: swing 1s ease-in-out;
width: 1.25rem; } } .logout { display: flex; img { width: 15px; margin-right: 10px; } }
@keyframes swing { 0% { transform: rotate(0deg); } 25% { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } 75% { transform: rotate(-15deg); } 100% { transform: rotate(0deg); } } </style>
|