index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 { defineComponent, ref, reactive, onMounted, onBeforeUnmount } from 'vue'
  93. import { formatTime } from '@/utils/index'
  94. import { WEEK } from '@/constant/index'
  95. import useIndex from '@/utils/useDraw'
  96. import { title, subtitle, moduleInfo } from '@/constant/index'
  97. import CenterLeft1 from "../centerLeft1/index.vue";
  98. import CenterLeft2 from "../centerLeft2/index.vue";
  99. import Center from "../center/index.vue";
  100. import CenterRight1 from "../centerRight1/index.vue";
  101. import CenterRight2 from "../centerRight2/index.vue";
  102. import BottomLeft from "../bottomLeft/index.vue";
  103. import BottomRight from "../bottomRight/index.vue";
  104. export default defineComponent({
  105. components: {
  106. CenterLeft1,
  107. CenterLeft2,
  108. Center,
  109. CenterRight1,
  110. CenterRight2,
  111. BottomLeft,
  112. BottomRight
  113. },
  114. setup() {
  115. // * 加载标识
  116. const loading = ref<boolean>(true)
  117. // * 时间内容
  118. const timeInfo = reactive({
  119. setInterval: 0,
  120. dateDay: '',
  121. dateYear: '',
  122. dateWeek: '',
  123. })
  124. // * 适配处理
  125. const { appRef, calcRate, windowDraw } = useIndex()
  126. // 生命周期
  127. onMounted(() => {
  128. cancelLoading()
  129. handleTime()
  130. // todo 屏幕适应
  131. windowDraw()
  132. calcRate()
  133. })
  134. onBeforeUnmount(() => {
  135. clearInterval(timeInfo.setInterval)
  136. })
  137. // methods
  138. // todo 处理 loading 展示
  139. const cancelLoading = () => {
  140. setTimeout(() => {
  141. loading.value = false
  142. }, 500)
  143. }
  144. // todo 处理时间监听
  145. const handleTime = () => {
  146. timeInfo.setInterval = setInterval(() => {
  147. const date = new Date()
  148. timeInfo.dateDay = formatTime(date, 'HH: mm: ss')
  149. timeInfo.dateYear = formatTime(date, 'yyyy-MM-dd')
  150. timeInfo.dateWeek = WEEK[date.getDay()]
  151. }, 1000)
  152. }
  153. // return
  154. return { loading, timeInfo, appRef, title, subtitle, moduleInfo }
  155. },
  156. })
  157. </script>
  158. <style lang="scss" scoped>
  159. @import '@/assets/scss/index.scss';
  160. </style>