StartupView.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. if (window.location.href.includes('?m=1')) {
  99. audioEl.src = './configMultiMedia/music/music2.mp3'
  100. audioEl.play()
  101. } else {
  102. audioEl.play()
  103. }
  104. })
  105. setTimeout(() => {
  106. isShowSkip.value = true
  107. }, 2000)
  108. }
  109. function onVideoEnd() {
  110. store.dispatch('recordShownStartup')
  111. }
  112. </script>
  113. <style lang="less" scoped>
  114. .startup-view{
  115. position: absolute;
  116. left: 0;
  117. top: 0;
  118. width: 100%;
  119. height: 100%;
  120. background-color: #fff;
  121. background-image: url(@/assets/images/startup-bg.png);
  122. background-size: cover;
  123. background-repeat: no-repeat;
  124. background-position: center center;
  125. >.font-load-trigger{
  126. pointer-events: none;
  127. opacity: 0;
  128. font-family: KaiTi;
  129. }
  130. >.bg-serial-frames{
  131. position: absolute;
  132. left: 50%;
  133. top: 0;
  134. transform: translateX(-50%);
  135. mix-blend-mode: multiply;
  136. width: 100%;
  137. height: 100%;
  138. }
  139. >img.title{
  140. position: absolute;
  141. left: 50%;
  142. top: 40%;
  143. transform: translate(-50%, -50%);
  144. width: 152px;
  145. }
  146. >.loading-tip{
  147. position: absolute;
  148. left: 50%;
  149. bottom: 100px;
  150. transform: translateX(-48%);
  151. width: 72px;
  152. height: 72px;
  153. }
  154. >.btn-start{
  155. position: absolute;
  156. left: 50%;
  157. bottom: 100px;
  158. transform: translateX(-48%);
  159. cursor: pointer;
  160. }
  161. >.start-title{
  162. color: #FFFFFF;
  163. font-size: 24px;
  164. font-family: KaiTi;
  165. position: absolute;
  166. bottom: 60px;
  167. left: 50%;
  168. transform: translateX(-48%);
  169. }
  170. >video.transition-video{
  171. position: absolute;
  172. left: 50%;
  173. top: 0;
  174. height: 100%;
  175. transform: translateX(-50%);
  176. }
  177. // @keyframes spin {
  178. // 0% {
  179. // transform: translate(-50%, -50%) rotate(0deg);
  180. // }
  181. // 100% {
  182. // transform: translate(-50%, -50%) rotate(360deg);
  183. // }
  184. // }
  185. }
  186. </style>