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 :handleShowKey="handleShowKey" :clearInput="clearInput" :input="input" :handleHideKey="handleHideKey" /> <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 class="key_wrap" v-if="showkeyboard"> <SimpleKeyboard @onChange="onChange" :input="input" /> </div> </div> </template>
<script setup> import SimpleKeyboard from 'cpns/SimpleKeyboard' import Restart from '@/assets/img/login/restart.png' import Shutdown from '@/assets/img/login/shutdown.png' import LoginForm from 'cpns/LoginForm.vue' import { shutdownJSON, getAllUserJSON } from '@/mock/command' import { useWebSocketStore } from '@/store' import { ref, onUnmounted, onMounted } from 'vue' const webSocketStore = useWebSocketStore() webSocketStore.initCommandSocket() webSocketStore.initEventSocket()
const showShutdown = ref(false) const shutSecond = ref(5) const timer = ref(null) const showkeyboard = ref(false)
const handleShowKey = () => { showkeyboard.value = true } const handleHideKey = () => { showkeyboard.value = false }
const input = ref('') const onChange = a => { input.value = a }
const clearInput = () => { input.value = '' }
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 })
onMounted(() => { setTimeout(() => { webSocketStore?.sendCommandMsg(getAllUserJSON) }, 1000) })
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; } } } .key_wrap { position: absolute; left: 0; right: 0; bottom: 0; height: 230px; } } .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>
|