StartupView.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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="28800 / 900 * windowHeight"
  9. :height="windowHeight"
  10. :frame-number="48"
  11. :frame-duration="1000 / 12"
  12. /> -->
  13. <img
  14. class="bg-serial-frames"
  15. src="@/assets/images/loding_apng.png"
  16. alt=""
  17. draggable="false"
  18. >
  19. <img
  20. class="title"
  21. src="@/assets/images/startup-title.png"
  22. alt=""
  23. draggable="false"
  24. >
  25. <Transition name="fade-in">
  26. <img
  27. v-if="isShowLoadingTip"
  28. class="loading-tip"
  29. src="@/assets/images/loading.png"
  30. alt=""
  31. draggable="false"
  32. >
  33. </Transition>
  34. <SerialFrames
  35. v-if="!isShowLoadingTip"
  36. class="btn-start"
  37. :class="isStartBtnBlink ? 'animation-show-hide' : ''"
  38. :image-src="require(`@/assets/images/btn-start.png`)"
  39. :total-width="864 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)"
  40. :height="72 / windowSizeWhenDesignForRef * windowSizeInCssForRef.substring(0, windowSizeInCssForRef.length - 2)"
  41. :frame-number="12"
  42. :loop="false"
  43. @over="isStartBtnBlink = true"
  44. @click="onClickStart"
  45. />
  46. <div class="start-title">
  47. 点击开始
  48. </div>
  49. <Transition name="fade-in">
  50. <video
  51. v-show="isShowVideo"
  52. ref="videoEl"
  53. class="transition-video"
  54. src="@/assets/videos/startup.mp4"
  55. playsinline
  56. webkit-playsinline="true"
  57. x5-video-player-type="h5"
  58. muted
  59. @ended="onVideoEnd"
  60. />
  61. </Transition>
  62. <Transition name="fade-in">
  63. <BtnSkip
  64. v-if="isShowSkip"
  65. @click="onVideoEnd"
  66. />
  67. </Transition>
  68. </div>
  69. </template>
  70. <script setup>
  71. import useSizeAdapt from "@/useFunctions/useSizeAdapt"
  72. import { ref, computed, watch, onMounted, inject, nextTick } from "vue"
  73. import { useRoute, useRouter } from "vue-router"
  74. import { useStore } from "vuex"
  75. import { useWindowSize } from '@vueuse/core'
  76. const route = useRoute()
  77. const router = useRouter()
  78. const store = useStore()
  79. const $env = inject('$env')
  80. const {
  81. windowSizeInCssForRef,
  82. windowSizeWhenDesignForRef,
  83. } = useSizeAdapt()
  84. const { width: windowWidth, height: windowHeight } = useWindowSize()
  85. const isShowLoadingTip = ref(true)
  86. setTimeout(() => {
  87. isShowLoadingTip.value = false
  88. }, 3000)
  89. const isStartBtnBlink = ref(false)
  90. const isShowVideo = ref(false)
  91. const isShowSkip = ref(false)
  92. const videoEl = ref(null)
  93. function onClickStart() {
  94. isShowVideo.value = true
  95. const audioEl = document.getElementById('bg-music')
  96. nextTick(() => {
  97. videoEl.value.play()
  98. audioEl.play()
  99. })
  100. setTimeout(() => {
  101. isShowSkip.value = true
  102. }, 2000)
  103. }
  104. function onVideoEnd() {
  105. store.dispatch('recordShownStartup')
  106. }
  107. </script>
  108. <style lang="less" scoped>
  109. .startup-view{
  110. position: absolute;
  111. left: 0;
  112. top: 0;
  113. width: 100%;
  114. height: 100%;
  115. background-color: #fff;
  116. background-image: url(@/assets/images/startup-bg.png);
  117. background-size: cover;
  118. background-repeat: no-repeat;
  119. background-position: center center;
  120. >.font-load-trigger{
  121. pointer-events: none;
  122. opacity: 0;
  123. font-family: KaiTi;
  124. }
  125. >.bg-serial-frames{
  126. position: absolute;
  127. left: 50%;
  128. top: 0;
  129. transform: translateX(-50%);
  130. mix-blend-mode: multiply;
  131. width: 100%;
  132. height: 100%;
  133. }
  134. >img.title{
  135. position: absolute;
  136. left: 50%;
  137. top: 40%;
  138. transform: translate(-50%, -50%);
  139. width: 152px;
  140. }
  141. >.loading-tip{
  142. position: absolute;
  143. left: 50%;
  144. bottom: 100px;
  145. transform: translateX(-48%);
  146. width: 72px;
  147. height: 72px;
  148. }
  149. >.btn-start{
  150. position: absolute;
  151. left: 50%;
  152. bottom: 100px;
  153. transform: translateX(-48%);
  154. cursor: pointer;
  155. }
  156. >.start-title{
  157. color: #FFFFFF;
  158. font-size: 24px;
  159. font-family: KaiTi;
  160. position: absolute;
  161. bottom: 60px;
  162. left: 50%;
  163. transform: translateX(-48%);
  164. }
  165. >video.transition-video{
  166. position: absolute;
  167. left: 50%;
  168. top: 0;
  169. width: 100%;
  170. height: 100%;
  171. object-fit: cover;
  172. transform: translateX(-50%);
  173. }
  174. // @keyframes spin {
  175. // 0% {
  176. // transform: translate(-50%, -50%) rotate(0deg);
  177. // }
  178. // 100% {
  179. // transform: translate(-50%, -50%) rotate(360deg);
  180. // }
  181. // }
  182. }
  183. </style>