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.

154 lines
2.9 KiB

  1. <script lang="ts" setup>
  2. import deviceSvg from '@/assets/images/init-device.svg'
  3. import CancelSvg from '@/assets/images/user-cancel.svg'
  4. import LogoutSvg from '@/assets/images/user-logout.svg'
  5. import { logout } from 'apis/login'
  6. import Check from 'components/check/index.vue'
  7. import { delToken } from 'libs/token'
  8. import { ref } from 'vue'
  9. import { useRouter } from 'vue-router'
  10. const isLoading = ref(false)
  11. const router = useRouter()
  12. const openModal = () => {
  13. isLoading.value = true
  14. }
  15. const checking = ref(false)
  16. const onInitDevice = async () => {
  17. checking.value = true
  18. onCancel()
  19. }
  20. const onLogout = () => {
  21. logout().then(() => {
  22. delToken()
  23. router.push('/login').then(() => {})
  24. })
  25. }
  26. const onCancel = () => {
  27. isLoading.value = false
  28. }
  29. defineExpose({
  30. openModal,
  31. })
  32. </script>
  33. <template>
  34. <div v-if="isLoading" class="loading-overlay">
  35. <div class="loading-content" @click="onInitDevice()">
  36. <img :src="deviceSvg" alt="Icon" width="80">
  37. <div style="color: rgb(243 168 74);">
  38. 设备初始化
  39. </div>
  40. </div>
  41. <div class="loading-content" @click="onLogout">
  42. <img :src="LogoutSvg" alt="Icon" width="80">
  43. <div style="color: #9358df;">
  44. 注销用户
  45. </div>
  46. </div>
  47. <div class="loading-content" @click="onCancel">
  48. <img :src="CancelSvg" alt="Icon" width="80">
  49. <div style="color: #ea8864;">
  50. 取消
  51. </div>
  52. </div>
  53. </div>
  54. <div v-if="checking">
  55. <Check v-model:checking="checking" type="cancel" />
  56. </div>
  57. </template>
  58. <style scoped lang="scss">
  59. #index-container {
  60. margin: 0;
  61. padding: 0;
  62. width: 100vw;
  63. height: 100vh;
  64. background-color: #fff;
  65. position: relative;
  66. box-sizing: border-box;
  67. display: flex;
  68. flex-direction: column;
  69. }
  70. .loading-overlay {
  71. position: fixed;
  72. top: 0;
  73. left: 0;
  74. width: 100vw;
  75. height: 100vh;
  76. background: rgba(0, 0, 0, 0.7);
  77. backdrop-filter: blur(4px);
  78. display: flex;
  79. gap: 10rem;
  80. justify-content: center;
  81. align-items: center;
  82. z-index: 9998;
  83. }
  84. .loading-content {
  85. display: flex;
  86. flex-direction: column;
  87. align-items: center;
  88. gap: 20px;
  89. div{
  90. font-size: 1.5rem;
  91. }
  92. }
  93. .loading-spinner {
  94. width: 60px;
  95. height: 60px;
  96. border: 4px solid #f3f3f3;
  97. border-top: 4px solid #4caf50;
  98. border-radius: 50%;
  99. animation: spin 1s linear infinite;
  100. }
  101. .loading-text {
  102. color: white;
  103. font-size: 24px;
  104. font-weight: 500;
  105. }
  106. .loading-progress {
  107. width: 300px;
  108. height: 6px;
  109. background: rgba(255, 255, 255, 0.2);
  110. border-radius: 3px;
  111. overflow: hidden;
  112. }
  113. .loading-device{
  114. display: flex;
  115. gap: 150px;
  116. }
  117. .loading-user{
  118. display: flex;
  119. margin-left: 24%;
  120. gap: 12rem;
  121. }
  122. .logo-img{
  123. width: 11rem;
  124. padding-top: 5px;
  125. }
  126. .init-axis{
  127. display: grid;
  128. gap: 20px;
  129. grid-template-columns: 1fr 1fr 1fr;
  130. width: 60vw;
  131. }
  132. .init-logout{
  133. display: grid;
  134. gap: 20px;
  135. grid-template-columns:1fr 1fr;
  136. width: 60vw;
  137. margin-top:10rem;
  138. }
  139. </style>