index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div id="index" ref="appRef">
  3. <div class="bg">
  4. <dv-loading v-if="loading">Loading...</dv-loading>
  5. <div v-else class="host-body">
  6. <div class="d-flex jc-center">
  7. <dv-decoration-10 class="dv-dec-10" />
  8. <div class="d-flex jc-center">
  9. <dv-decoration-8 class="dv-dec-8" :color="['#568aea', '#000000']" />
  10. <div class="title">
  11. <span class="title-text">{{ title }}</span>
  12. <dv-decoration-6
  13. class="dv-dec-6"
  14. :reverse="true"
  15. :color="['#50e3c2', '#67a1e5']"
  16. />
  17. </div>
  18. <dv-decoration-8
  19. class="dv-dec-8"
  20. :reverse="true"
  21. :color="['#568aea', '#000000']"
  22. />
  23. </div>
  24. <dv-decoration-10 class="dv-dec-10-s" />
  25. </div>
  26. <!-- 第二行 -->
  27. <div class="d-flex jc-between px-2">
  28. <div class="d-flex aside-width">
  29. <div class="react-left ml-4 react-l-s">
  30. <span class="react-before"></span>
  31. <span class="text">{{ subtitle[0] }}</span>
  32. </div>
  33. <div class="react-left ml-3">
  34. <span class="text">{{ subtitle[1] }}</span>
  35. </div>
  36. </div>
  37. <div class="d-flex aside-width">
  38. <div class="react-right bg-color-blue mr-3">
  39. <span class="text fw-b">{{ subtitle[2] }}</span>
  40. </div>
  41. <div class="react-right mr-4 react-l-s">
  42. <span class="react-after"></span>
  43. <span class="text">
  44. {{ timeInfo.dateYear }} {{ timeInfo.dateWeek }}
  45. {{ timeInfo.dateDay }}
  46. </span>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="body-box">
  51. <!-- 第三行数据 -->
  52. <div class="content-box">
  53. <div>
  54. <dv-border-box-12>
  55. <center-left1 />
  56. </dv-border-box-12>
  57. </div>
  58. <div>
  59. <dv-border-box-12>
  60. <center-left2 />
  61. </dv-border-box-12>
  62. </div>
  63. <!-- 中间 -->
  64. <div>
  65. <center />
  66. </div>
  67. <!-- 中间 -->
  68. <div>
  69. <center-right1 />
  70. </div>
  71. <div>
  72. <dv-border-box-13>
  73. <center-right2 />
  74. </dv-border-box-13>
  75. </div>
  76. </div>
  77. <!-- 第四行数据 -->
  78. <div class="bototm-box">
  79. <dv-border-box-13>
  80. <bottom-left />
  81. </dv-border-box-13>
  82. <dv-border-box-12>
  83. <bottom-right />
  84. </dv-border-box-12>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </template>
  91. <script lang="ts">
  92. import {
  93. defineComponent,
  94. ref,
  95. reactive,
  96. onMounted,
  97. onBeforeUnmount,
  98. } from 'vue'
  99. import { formatTime } from '@/utils/index'
  100. import { WEEK } from '@/constant/index'
  101. import useDraw from '@/utils/useDraw'
  102. import { title, subtitle, moduleInfo } from '@/constant/index'
  103. import CenterLeft1 from '../centerLeft1/index.vue'
  104. import CenterLeft2 from '../centerLeft2/index.vue'
  105. import Center from '../center/index.vue'
  106. import CenterRight1 from '../centerRight1/index.vue'
  107. import CenterRight2 from '../centerRight2/index.vue'
  108. import BottomLeft from '../bottomLeft/index.vue'
  109. import BottomRight from '../bottomRight/index.vue'
  110. export default defineComponent({
  111. components: {
  112. CenterLeft1,
  113. CenterLeft2,
  114. Center,
  115. CenterRight1,
  116. CenterRight2,
  117. BottomLeft,
  118. BottomRight
  119. },
  120. setup() {
  121. // * 加载标识
  122. const loading = ref<boolean>(true)
  123. // * 时间内容
  124. const timeInfo = reactive({
  125. setInterval: 0,
  126. dateDay: '',
  127. dateYear: '',
  128. dateWeek: ''
  129. })
  130. // * 适配处理
  131. const { appRef, calcRate, windowDraw } = useDraw()
  132. // 生命周期
  133. onMounted(() => {
  134. cancelLoading()
  135. handleTime()
  136. // todo 屏幕适应
  137. windowDraw()
  138. calcRate()
  139. })
  140. onBeforeUnmount(() => {
  141. clearInterval(timeInfo.setInterval)
  142. })
  143. // methods
  144. // todo 处理 loading 展示
  145. const cancelLoading = () => {
  146. setTimeout(() => {
  147. loading.value = false
  148. }, 500)
  149. }
  150. // todo 处理时间监听
  151. const handleTime = () => {
  152. timeInfo.setInterval = setInterval(() => {
  153. const date = new Date()
  154. timeInfo.dateDay = formatTime(date, 'HH: mm: ss')
  155. timeInfo.dateYear = formatTime(date, 'yyyy-MM-dd')
  156. timeInfo.dateWeek = WEEK[date.getDay()]
  157. }, 1000)
  158. }
  159. // return
  160. return {
  161. loading,
  162. timeInfo,
  163. appRef,
  164. title,
  165. subtitle,
  166. moduleInfo
  167. }
  168. }
  169. })
  170. </script>
  171. <style lang="scss" scoped>
  172. @import '@/assets/scss/index.scss';
  173. </style>