Home.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div
  3. ref="hammer-target"
  4. class="home-page"
  5. >
  6. <div class="top-wrapper">
  7. <img
  8. draggable="false"
  9. class="council"
  10. src="@/assets/image/international-council-of-museums.png"
  11. alt=""
  12. >
  13. <img
  14. draggable="false"
  15. class="guojibowuguanri"
  16. src="@/assets/image/国际博物馆日.png"
  17. alt=""
  18. >
  19. </div>
  20. <img
  21. draggable="false"
  22. class="wuyiba"
  23. src="@/assets/image/nanjing-museum-logo.png"
  24. alt=""
  25. >
  26. <img
  27. draggable="false"
  28. class="title"
  29. src="@/assets/image/博物馆的力量.png"
  30. alt=""
  31. >
  32. <img
  33. v-for="index of 20"
  34. v-show="(currentFrameIdx === index - 1) || (currentFrameIdx - 1 === index - 1)"
  35. :key="index"
  36. draggable="false"
  37. class="slide-tip-emerge"
  38. :src="`${$publicPath}wenmai-frames/Abstract Element _${(index - 1).toString().padStart(4, '0')}.png`"
  39. alt=""
  40. @load="onImgLoad(index - 1)"
  41. @error="onImgError(index - 1)"
  42. >
  43. <SlideTip
  44. v-if="currentFrameIdx >= 20"
  45. text="文<br>脉"
  46. />
  47. <div class="bottom-wrapper">
  48. <img
  49. draggable="false"
  50. class="museum-logo"
  51. src="@/assets/image/museum-logo.png"
  52. alt=""
  53. >
  54. <img
  55. draggable="false"
  56. class="our-logo"
  57. src="@/assets/image/our-logo.png"
  58. alt=""
  59. >
  60. </div>
  61. <img
  62. draggable="false"
  63. class="background-image"
  64. src="@/assets/image/bg-text.png"
  65. alt=""
  66. >
  67. </div>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. currentFrameIdx: 0,
  74. imgStateList: new Array(20),
  75. loadCountDown: 20,
  76. }
  77. },
  78. mounted() {
  79. utils.registerSlideToRoute('hammer-target', 'TreeAnimation', this)
  80. this.intervalId = setInterval(() => {
  81. if ((this.loadCountDown === 0)) {
  82. do {
  83. this.currentFrameIdx++
  84. } while (this.imgStateList[this.currentFrameIdx] === false)
  85. if (this.currentFrameIdx >= 20) {
  86. clearInterval(this.intervalId)
  87. }
  88. }
  89. }, 41)
  90. },
  91. destroyed() {
  92. clearInterval(this.intervalId)
  93. },
  94. methods: {
  95. onImgLoad(idx) {
  96. if (idx < 100) {
  97. this.loadCountDown--
  98. }
  99. this.imgStateList[idx] = true
  100. },
  101. onImgError(idx) {
  102. if (idx < 100) {
  103. this.loadCountDown--
  104. }
  105. this.imgStateList[idx] = false
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="less" scoped>
  111. .home-page {
  112. position: relative;
  113. text-align: center;
  114. width: 100%;
  115. height: 100%;
  116. overflow: hidden;
  117. .top-wrapper {
  118. margin-top: 2.72rem;
  119. display: flex;
  120. justify-content: center;
  121. height: 1.17rem;
  122. .council {
  123. height: 100%;
  124. margin-right: 1.7rem;
  125. }
  126. .guojibowuguanri {
  127. height: 100%;
  128. }
  129. }
  130. .wuyiba {
  131. position: absolute;
  132. top: 6.03rem;
  133. height: 5.89rem;
  134. left: 50%;
  135. transform: translateX(-50%);
  136. }
  137. .title {
  138. position: absolute;
  139. top: 13.3rem;
  140. height: 11.3rem;
  141. display: block;
  142. left: 50%;
  143. transform: translateX(-50%);
  144. }
  145. .slide-tip-emerge {
  146. position: absolute;
  147. left: 50%;
  148. bottom: 10rem;
  149. transform: translateX(-50%);
  150. width: 8rem;
  151. }
  152. .bottom-wrapper {
  153. position: absolute;
  154. width: 100%;
  155. bottom: 2.59rem;
  156. height: 1.36rem;
  157. display: flex;
  158. justify-content: center;
  159. .museum-logo {
  160. margin-right: 3.58rem;
  161. flex: 0 0 auto;
  162. width: 5.17rem;
  163. }
  164. .our-logo {
  165. flex: 0 0 auto;
  166. width: 4.97rem;
  167. }
  168. }
  169. .background-image {
  170. position: absolute;
  171. left: 0;
  172. right: 0;
  173. bottom: 0;
  174. top: 0;
  175. object-fit: cover;
  176. width: 100%;
  177. height: 100%;
  178. z-index: -1;
  179. }
  180. }
  181. </style>