消毒机前端代码
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.

133 lines
3.0 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="login_container">
  3. <LoginForm />
  4. <p class="copyright">CopyRight@ xxxxxx公司</p>
  5. <div class="shutdown">
  6. <div class="group" @click="shutdown">
  7. <img :src="Shutdown" class="icon" alt="" />
  8. <p class="text">关机</p>
  9. </div>
  10. <div class="group" @click="reboot">
  11. <img :src="Restart" class="icon" alt="" />
  12. <p class="text">重新启动</p>
  13. </div>
  14. </div>
  15. <van-overlay :show="showShutdown">
  16. <div class="wrapper" @click.stop>
  17. <div class="block">
  18. <van-loading />
  19. <p class="shutdown_text">{{ shutSecond }} 秒后关机...</p>
  20. </div>
  21. </div>
  22. </van-overlay>
  23. </div>
  24. </template>
  25. <script setup>
  26. import Restart from '@/assets/img/login/restart.png'
  27. import Shutdown from '@/assets/img/login/shutdown.png'
  28. import LoginForm from 'cpns/LoginForm.vue'
  29. import { shutdownJSON } from '@/mock/command'
  30. import { useWebSocketStore } from '@/store'
  31. import { ref, onUnmounted } from 'vue'
  32. const webSocketStore = useWebSocketStore()
  33. webSocketStore.initCommandSocket()
  34. webSocketStore.initEventSocket()
  35. const showShutdown = ref(false)
  36. const shutSecond = ref(5)
  37. const timer = ref(null)
  38. const shutdown = () => {
  39. showShutdown.value = true
  40. timer.value = setInterval(() => {
  41. if (shutSecond.value > 0) {
  42. shutSecond.value = shutSecond.value - 1
  43. } else {
  44. timer.value = null
  45. }
  46. }, 1000)
  47. webSocketStore?.sendCommandMsg(shutdownJSON)
  48. }
  49. onUnmounted(() => {
  50. timer.value = null
  51. })
  52. const reboot = () => {}
  53. </script>
  54. <style lang="scss" scoped>
  55. .login_container {
  56. background: url(../assets/img/login/back.png) no-repeat;
  57. background-size: 100% 100%;
  58. width: 1280px;
  59. height: 800px;
  60. display: flex;
  61. justify-content: center;
  62. padding-top: 162px;
  63. box-sizing: border-box;
  64. position: relative;
  65. .copyright {
  66. position: absolute;
  67. left: 50%;
  68. transform: translateX(-50%);
  69. bottom: 56px;
  70. font-family: Zona Pro;
  71. font-size: 10px;
  72. font-weight: normal;
  73. letter-spacing: 0.06em;
  74. color: #9e9e9e;
  75. }
  76. .shutdown {
  77. position: absolute;
  78. right: 38px;
  79. bottom: 42px;
  80. display: flex;
  81. align-items: center;
  82. .group {
  83. display: flex;
  84. align-items: center;
  85. cursor: pointer;
  86. .icon {
  87. width: 35px;
  88. height: 35px;
  89. margin-right: 10px;
  90. }
  91. .text {
  92. font-family: Source Han Sans CN;
  93. font-size: 12px;
  94. font-weight: 350;
  95. letter-spacing: 0.06em;
  96. color: #ffffff;
  97. }
  98. &:nth-child(odd) {
  99. margin-right: 40px;
  100. }
  101. }
  102. }
  103. }
  104. .wrapper {
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. height: 100%;
  109. }
  110. .block {
  111. width: 120px;
  112. height: 120px;
  113. display: flex;
  114. flex-direction: column;
  115. padding: 16px;
  116. align-items: center;
  117. justify-content: center;
  118. .shutdown_text {
  119. margin-top: 24px;
  120. font-family: Source Han Sans CN;
  121. font-size: 16px;
  122. font-weight: normal;
  123. line-height: normal;
  124. letter-spacing: 0.06em;
  125. color: #fff;
  126. }
  127. }
  128. </style>