大空间消毒机
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.

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