StartupView.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. <div
  21. v-if="isShowLoadingTip"
  22. class="loading-tip animation-show-hide"
  23. >
  24. loading...
  25. </div>
  26. <button
  27. v-else-if="isShowStartBtn"
  28. class="start"
  29. @click="onClickStart"
  30. >
  31. <img
  32. class="bg"
  33. src="@/assets/images/start-btn-bg.png"
  34. alt=""
  35. draggable="false"
  36. >
  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(-50%);
  122. font-family: KingHwa_OldSong, KingHwa_OldSong;
  123. font-weight: 400;
  124. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  125. color: #FFFFFF;
  126. line-height: 1.5em;
  127. }
  128. >button.start{
  129. position: absolute;
  130. left: 50%;
  131. bottom: calc(56 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  132. transform: translateX(-50%);
  133. width: calc(71 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  134. height: calc(69 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  135. font-family: KaiTi, KaiTi;
  136. font-weight: 400;
  137. font-size: calc(24 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  138. color: #FFFFFF;
  139. line-height: calc(29 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  140. >img.bg{
  141. position: absolute;
  142. left: 0;
  143. top: 0;
  144. width: 100%;
  145. height: 100%;
  146. animation-name: spin;
  147. animation-duration: 1s;
  148. animation-timing-function: linear;
  149. animation-iteration-count: infinite;
  150. }
  151. }
  152. >video.transition-video{
  153. position: absolute;
  154. left: 0;
  155. top: 0;
  156. width: 100%;
  157. height: 100%;
  158. object-fit: cover;
  159. }
  160. @keyframes spin {
  161. 0% {
  162. transform: rotate(0deg);
  163. }
  164. 100% {
  165. transform: rotate(360deg);
  166. }
  167. }
  168. }
  169. </style>