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.
|
|
<template> <div class="login_container"> <LoginForm /> <p class="copyright">CopyRight@ xxxxxx公司</p> <div class="shutdown"> <div class="group" @click="shutdown"> <img :src="Shutdown" class="icon" alt="" /> <p class="text">关机</p> </div> <div class="group" @click="reboot"> <img :src="Restart" class="icon" alt="" /> <p class="text">重新启动</p> </div> </div> <van-overlay :show="showShutdown"> <div class="wrapper" @click.stop> <div class="block"> <van-loading /> <p class="shutdown_text">{{ shutSecond }} 秒后关机...</p> </div> </div> </van-overlay> </div> </template>
<script setup> import Restart from '@/assets/img/login/restart.png' import Shutdown from '@/assets/img/login/shutdown.png' import LoginForm from 'cpns/LoginForm.vue' import { shutdownJSON } from '@/mock/command' import { useWebSocketStore } from '@/store' import { ref, onUnmounted } from 'vue' const webSocketStore = useWebSocketStore() webSocketStore.initCommandSocket() webSocketStore.initEventSocket() const showShutdown = ref(false) const shutSecond = ref(5) const timer = ref(null)
const shutdown = () => { showShutdown.value = true timer.value = setInterval(() => { if (shutSecond.value > 0) { shutSecond.value = shutSecond.value - 1 } else { timer.value = null } }, 1000) webSocketStore?.sendCommandMsg(shutdownJSON) }
onUnmounted(() => { timer.value = null })
const reboot = () => {} </script>
<style lang="scss" scoped> .login_container { background: url(../assets/img/login/back.png) no-repeat; background-size: 100% 100%; width: 1280px; height: 800px; display: flex; justify-content: center; padding-top: 162px; box-sizing: border-box; position: relative; .copyright { position: absolute; left: 50%; transform: translateX(-50%); bottom: 56px; font-family: Zona Pro; font-size: 10px; font-weight: normal; letter-spacing: 0.06em; color: #9e9e9e; } .shutdown { position: absolute; right: 38px; bottom: 42px; display: flex; align-items: center; .group { display: flex; align-items: center; cursor: pointer; .icon { width: 35px; height: 35px; margin-right: 10px; } .text { font-family: Source Han Sans CN; font-size: 12px; font-weight: 350; letter-spacing: 0.06em; color: #ffffff; } &:nth-child(odd) { margin-right: 40px; } } } } .wrapper { display: flex; align-items: center; justify-content: center; height: 100%; } .block { width: 120px; height: 120px; display: flex; flex-direction: column; padding: 16px; align-items: center; justify-content: center; .shutdown_text { margin-top: 24px; font-family: Source Han Sans CN; font-size: 16px; font-weight: normal; line-height: normal; letter-spacing: 0.06em; color: #fff; } } </style>
|