StartupView.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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 / 675 * windowHeight"
  9. :height="windowHeight"
  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">
  20. <img
  21. v-if="isShowLoadingTip"
  22. class="loading-tip"
  23. src="@/assets/images/loading.png"
  24. alt=""
  25. draggable="false"
  26. >
  27. </Transition>
  28. <SerialFrames
  29. v-if="!isShowLoadingTip"
  30. class="btn-start"
  31. :class="isStartBtnBlink ? 'animation-show-hide' : ''"
  32. :image-src="require(`@/assets/images/btn-start.png`)"
  33. :total-width="864 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)"
  34. :height="72 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)"
  35. :frame-number="12"
  36. :loop="false"
  37. @over="isStartBtnBlink = true"
  38. @click="onClickStart"
  39. />
  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. <Transition name="fade-in">
  54. <BtnSkip
  55. v-if="isShowSkip"
  56. @click="onVideoEnd"
  57. />
  58. </Transition>
  59. </div>
  60. </template>
  61. <script setup>
  62. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  63. import { ref, computed, watch, onMounted, inject, nextTick } from "vue"
  64. import { useRoute, useRouter } from "vue-router"
  65. import { useStore } from "vuex"
  66. import { useWindowSize } from '@vueuse/core'
  67. const route = useRoute()
  68. const router = useRouter()
  69. const store = useStore()
  70. const $env = inject('$env')
  71. const {
  72. windowSizeInCssForRef,
  73. windowSizeWhenDesignForRef,
  74. } = useSizeAdapt()
  75. const { width: windowWidth, height: windowHeight } = useWindowSize()
  76. const isShowLoadingTip = ref(true)
  77. setTimeout(() => {
  78. isShowLoadingTip.value = false
  79. }, 3000)
  80. const isStartBtnBlink = ref(false)
  81. const isShowVideo = ref(false)
  82. const isShowSkip = ref(false)
  83. const videoEl = ref(null)
  84. function onClickStart() {
  85. isShowVideo.value = true
  86. nextTick(() => {
  87. videoEl.value.play()
  88. })
  89. setTimeout(() => {
  90. isShowSkip.value = true
  91. }, 2000)
  92. }
  93. function onVideoEnd() {
  94. store.dispatch('recordShownStartup')
  95. }
  96. </script>
  97. <style lang="less" scoped>
  98. .startup-view{
  99. position: absolute;
  100. left: 0;
  101. top: 0;
  102. width: 100%;
  103. height: 100%;
  104. background-image: url(@/assets/images/startup-bg.jpg);
  105. background-size: cover;
  106. background-repeat: no-repeat;
  107. background-position: center center;
  108. >.font-load-trigger{
  109. pointer-events: none;
  110. opacity: 0;
  111. font-family: KaiTi, KaiTi;
  112. }
  113. >.bg-serial-frames{
  114. position: absolute;
  115. left: 50%;
  116. top: 0;
  117. transform: translateX(-50%);
  118. mix-blend-mode: multiply;
  119. }
  120. >img.title{
  121. position: absolute;
  122. left: 50%;
  123. top: 40%;
  124. transform: translate(-50%, -50%);
  125. width: calc(152 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  126. }
  127. >.loading-tip{
  128. position: absolute;
  129. left: 50%;
  130. bottom: calc(70 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  131. transform: translateX(-48%);
  132. width: calc(72 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  133. height: calc(72 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  134. }
  135. >.btn-start{
  136. position: absolute;
  137. left: 50%;
  138. bottom: calc(70 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  139. transform: translateX(-48%);
  140. }
  141. >video.transition-video{
  142. position: absolute;
  143. left: 50%;
  144. top: 0;
  145. height: 100%;
  146. transform: translateX(-50%);
  147. }
  148. // @keyframes spin {
  149. // 0% {
  150. // transform: translate(-50%, -50%) rotate(0deg);
  151. // }
  152. // 100% {
  153. // transform: translate(-50%, -50%) rotate(360deg);
  154. // }
  155. // }
  156. }
  157. </style>