StartupView.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="startup-view">
  3. <span class="font-load-trigger">这是为了尽早触发字体文件加载</span>
  4. <!-- 背景序列帧 -->
  5. <SerialFrames
  6. class="bg-serial-frames"
  7. :image-src="require(`@/assets/images/serial-frame-startup.png`)"
  8. :total-width="22950"
  9. :height="675"
  10. :frame-number="51"
  11. :frame-duration="55"
  12. />
  13. <img
  14. class="title"
  15. src="@/assets/images/startup-title.png"
  16. alt=""
  17. draggable="false"
  18. >
  19. <Transition name="fade-in-out">
  20. <img
  21. v-if="isShowLoadingTip"
  22. class="loading-tip"
  23. src="@/assets/images/loading.png"
  24. alt=""
  25. draggable="false"
  26. >
  27. <button
  28. v-else-if="isShowStartBtn"
  29. class="start"
  30. @click="onClickStart"
  31. >
  32. <img
  33. class="bg"
  34. src="@/assets/images/start-btn-bg.png"
  35. alt=""
  36. draggable="false"
  37. >
  38. </button>
  39. </Transition>
  40. <Transition name="fade-in">
  41. <video
  42. v-if="isShowVideo"
  43. ref="videoEl"
  44. class="transition-video"
  45. src="@/assets/videos/startup.mp4"
  46. playsinline
  47. webkit-playsinline="true"
  48. x5-video-player-type="h5"
  49. muted
  50. @ended="onVideoEnd"
  51. />
  52. </Transition>
  53. </div>
  54. </template>
  55. <script setup>
  56. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  57. import { ref, computed, watch, onMounted, inject, nextTick } from "vue"
  58. import { useRoute, useRouter } from "vue-router"
  59. import { useStore } from "vuex"
  60. const route = useRoute()
  61. const router = useRouter()
  62. const store = useStore()
  63. const $env = inject('$env')
  64. const {
  65. windowSizeInCssForRef,
  66. windowSizeWhenDesignForRef,
  67. } = useSizeAdapt()
  68. const isShowLoadingTip = ref(true)
  69. const isShowStartBtn = ref(false)
  70. setTimeout(() => {
  71. isShowLoadingTip.value = false
  72. }, 2000)
  73. setTimeout(() => {
  74. isShowStartBtn.value = true
  75. }, 4000)
  76. const isShowVideo = ref(false)
  77. const videoEl = ref(null)
  78. function onClickStart() {
  79. isShowVideo.value = true
  80. nextTick(() => {
  81. videoEl.value.play()
  82. })
  83. }
  84. function onVideoEnd() {
  85. store.dispatch('recordShownStartup')
  86. }
  87. </script>
  88. <style lang="less" scoped>
  89. .startup-view{
  90. position: absolute;
  91. left: 0;
  92. top: 0;
  93. width: 100%;
  94. height: 100%;
  95. background-image: url(@/assets/images/startup-bg.jpg);
  96. background-size: cover;
  97. background-repeat: no-repeat;
  98. background-position: center center;
  99. >.font-load-trigger{
  100. pointer-events: none;
  101. opacity: 0;
  102. font-family: KaiTi, KaiTi;
  103. }
  104. >.bg-serial-frames{
  105. position: absolute;
  106. left: 0;
  107. top: 0;
  108. mix-blend-mode: multiply;
  109. }
  110. >img.title{
  111. position: absolute;
  112. left: 50%;
  113. top: 40%;
  114. transform: translate(-50%, -50%);
  115. width: calc(152 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  116. }
  117. >.loading-tip{
  118. position: absolute;
  119. left: 50%;
  120. bottom: calc(70 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  121. transform: translateX(-48%);
  122. width: calc(72 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  123. height: calc(72 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  124. }
  125. >button.start{
  126. position: absolute;
  127. left: 50%;
  128. bottom: calc(56 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  129. transform: translateX(-50%);
  130. width: calc(100 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  131. height: calc(100 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  132. font-family: KaiTi, KaiTi;
  133. font-weight: 400;
  134. font-size: calc(24 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  135. color: #FFFFFF;
  136. line-height: calc(29 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  137. >img.bg{
  138. position: absolute;
  139. left: 50%;
  140. top: 50%;
  141. transform: translate(-47%, -47%);
  142. width: calc(90 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  143. height: calc(90 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  144. // animation-name: spin;
  145. // animation-duration: 1s;
  146. // animation-timing-function: linear;
  147. // animation-iteration-count: infinite;
  148. }
  149. }
  150. >video.transition-video{
  151. position: absolute;
  152. left: 0;
  153. top: 0;
  154. width: 100%;
  155. height: 100%;
  156. object-fit: cover;
  157. }
  158. // @keyframes spin {
  159. // 0% {
  160. // transform: translate(-50%, -50%) rotate(0deg);
  161. // }
  162. // 100% {
  163. // transform: translate(-50%, -50%) rotate(360deg);
  164. // }
  165. // }
  166. }
  167. </style>