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

179 lines
4.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
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. setTimeout(() => {
  80. webSocketStore?.sendCommandMsg(getAllUserJSON)
  81. }, 2000)
  82. setTimeout(() => {
  83. webSocketStore?.sendCommandMsg(getAllUserJSON)
  84. }, 3000)
  85. })
  86. const reboot = () => {}
  87. </script>
  88. <style lang="scss" scoped>
  89. .login_container {
  90. background: url(../assets/img/login/back.png) no-repeat;
  91. background-size: 100% 100%;
  92. width: 1280px;
  93. height: 800px;
  94. display: flex;
  95. justify-content: center;
  96. padding-top: 162px;
  97. box-sizing: border-box;
  98. position: relative;
  99. .copyright {
  100. position: absolute;
  101. left: 50%;
  102. transform: translateX(-50%);
  103. bottom: 56px;
  104. font-family: Zona Pro;
  105. font-size: 10px;
  106. font-weight: normal;
  107. letter-spacing: 0.06em;
  108. color: #9e9e9e;
  109. }
  110. .shutdown {
  111. position: absolute;
  112. right: 38px;
  113. bottom: 42px;
  114. display: flex;
  115. align-items: center;
  116. .group {
  117. display: flex;
  118. align-items: center;
  119. cursor: pointer;
  120. .icon {
  121. width: 35px;
  122. height: 35px;
  123. margin-right: 10px;
  124. }
  125. .text {
  126. font-family: Source Han Sans CN;
  127. font-size: 12px;
  128. font-weight: 350;
  129. letter-spacing: 0.06em;
  130. color: #ffffff;
  131. }
  132. &:nth-child(odd) {
  133. margin-right: 40px;
  134. }
  135. }
  136. }
  137. .key_wrap {
  138. position: absolute;
  139. left: 0;
  140. right: 0;
  141. bottom: 0;
  142. height: 230px;
  143. }
  144. }
  145. .wrapper {
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. height: 100%;
  150. }
  151. .block {
  152. width: 120px;
  153. height: 120px;
  154. display: flex;
  155. flex-direction: column;
  156. padding: 16px;
  157. align-items: center;
  158. justify-content: center;
  159. .shutdown_text {
  160. margin-top: 24px;
  161. font-family: Source Han Sans CN;
  162. font-size: 16px;
  163. font-weight: normal;
  164. line-height: normal;
  165. letter-spacing: 0.06em;
  166. color: #fff;
  167. }
  168. }
  169. </style>