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 logoutIcon from 'assets/images/logout.svg' import Check from 'components/check/index.vue' import Stop from 'components/home/Stop/index.vue' import { useActivateDebug } from 'hooks/useActivateDebug' import { isClose } from 'libs/socket' import { formatDateTime } from 'libs/utils' import { authRoutes } from 'router/routes' import { useSystemStore } from 'stores/systemStore' import { onMounted, onUnmounted, ref } from 'vue' import { useRouter } from 'vue-router'
const { handleLogoClick } = useActivateDebug()
const systemStore = useSystemStore() const router = useRouter()
const currentTime = ref(formatDateTime())
const timeInterval = setInterval(() => { currentTime.value = formatDateTime() }, 1000)
onMounted(() => { if (!systemStore.systemStatus.selfTest && systemStore.systemUser.username !== 'test') { isCheck.value = true } })
onUnmounted(() => { clearInterval(timeInterval) })
const isCheck = ref(false) </script>
<template> <el-container class="main"> <el-header class="header"> <div class="logo"> <img src="../assets/images/logo.svg" alt="" @click="handleLogoClick"> <span class="title" @click="handleLogoClick">长春黄金研究院有限公司</span> <img :class="systemStore.menuExpand ? 'expand-icon' : 'fold-icon'" src="../assets/images/expand.svg" alt="" @click="systemStore.updateMenuExpand()"> </div> <div class="header-right"> <el-dropdown class="wifi-dropdown" trigger="click"> <div class="wifi-icon"> <img v-if="isClose" src="../assets/images/wifi.svg" alt=""> <img v-else src="../assets/images/wifi-active.svg" alt=""> </div> <template #dropdown> <el-dropdown-menu> <el-dropdown-item @click="systemStore.logout()"> <div class="logout"> <span v-if="!isClose">已连接</span> <span v-else>已断开</span> </div> </el-dropdown-item> </el-dropdown-menu> </template> </el-dropdown>
<div class="time"> {{ currentTime }} </div> <div class="user"> <el-dropdown class="user-dropdown" trigger="click"> <div class="user-dropdown-item"> <img src="../assets/images/user.svg" alt=""> <span>{{ systemStore.systemUser.username }}</span> </div> <template #dropdown> <el-dropdown-menu> <el-dropdown-item @click="systemStore.logout()"> <div class="logout"> <img :src="logoutIcon" alt=""> <span>退出登录</span> </div> </el-dropdown-item> </el-dropdown-menu> </template> </el-dropdown> </div> </div> </el-header> <el-container class="container"> <el-aside class="aside" :class="{ 'aside-off': !systemStore.menuExpand }"> <div v-for="item in authRoutes.filter(item => item.meta!.isDefault)" :key="item.path" class="aside-item" :class="{ 'aside-item-active': router.currentRoute.value.path.includes(item.path) }" @click="router.push(item.path)" > <img class="swing-icon" :src="((router.currentRoute.value.path.includes(item.path) ? item.meta!.activeIcon : item.meta!.icon) as string)" alt=""> <span class="text">{{ item.meta!.title }}</span> </div> </el-aside> <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> <el-footer class="footer" :class="{ 'footer-expand': !systemStore.menuExpand }"> <el-row> <el-col :span="16"> <div class="footer-left"> <img src="../assets/images/run.svg" alt=""> <span class="text">机器运行状态</span> </div> </el-col>
<el-col :span="8"> <div class="footer-right"> <div class="status" /> <span class="text">溶液容器余量正常</span> </div> </el-col> </el-row> </el-footer> <FtStream :visible="systemStore.streamVisible" /> <Check v-if="isCheck" @close="isCheck = false" /> <Stop v-if="systemStore.systemStatus.emergencyStop" /> </el-container> </template>
<style scoped lang="scss"> .main { box-sizing: border-box; height: 100%; background: #F6F6F6; .header, .footer { height: 50px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; } .header { color: #393F46;
.logo { height: 100%; 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%; .wifi-dropdown { height: 100%; .wifi-icon { width: 40px; height: 100%; background: #fff; border-radius: 5px; display: flex; align-items: center; justify-content: center; img { height: 50%; } } }
.time { margin:0 10px; height: 100%; padding: 0 10px; display: flex; align-items: center; background: #fff; border-radius: 5px; } } } .container { height: calc(100% - 100px); } } .aside { width: 170px; overflow: auto; padding-left: 10px; //transition: all 0.1s ease;
.aside-item { width: 100%; height: 50px; border-radius: 10px; color: #1989FA; margin: 10px 0; padding: 0 10px; display: flex; align-items: center; overflow: hidden; img { height: 80%; margin-right: 20px; } .text { transition: opacity 0.3s ease; white-space: nowrap; } } .aside-item-active { background: #1989FA; color: #fff; } }
.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: 100%; background: #fff; border-radius: 10px; box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); padding: 10px; } .footer-expand { padding: 10px 15px 10px 85px !important; } .main .footer { padding: 10px 15px 10px 185px; .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; } } } .aside-item:hover { .swing-icon { animation: swing 1s ease-in-out; } } .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>
|