index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!-- -->
  2. <template>
  3. <div class="Video">
  4. <div class="videoBox" :class="{ none: show }">
  5. <video
  6. id="VideoDom"
  7. src="../../assets/media/bacVideo.mp4"
  8. muted
  9. autoplay
  10. ></video>
  11. <div class="skip" :class="{ active: skip }" @click="show = true">
  12. 跳过
  13. </div>
  14. </div>
  15. <div class="bacImg">
  16. <div class="btnn" @click="toSwkk">&emsp;进入展馆</div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: "Video",
  23. components: {},
  24. data() {
  25. //这里存放数据
  26. return {
  27. skip: false,
  28. show: false,
  29. };
  30. },
  31. //监听属性 类似于data概念
  32. computed: {},
  33. //监控data中的数据变化
  34. watch: {},
  35. //方法集合
  36. methods: {
  37. toSwkk(){
  38. window.location.replace('/Swkk')
  39. }
  40. },
  41. //生命周期 - 创建完成(可以访问当前this实例)
  42. created() {},
  43. //生命周期 - 挂载完成(可以访问DOM元素)
  44. mounted() {
  45. setTimeout(() => {
  46. this.skip = true;
  47. }, 3000);
  48. let dom = document.querySelector("#VideoDom");
  49. dom.addEventListener("ended", () => {
  50. this.show = true;
  51. });
  52. },
  53. beforeCreate() {}, //生命周期 - 创建之前
  54. beforeMount() {}, //生命周期 - 挂载之前
  55. beforeUpdate() {}, //生命周期 - 更新之前
  56. updated() {}, //生命周期 - 更新之后
  57. beforeDestroy() {}, //生命周期 - 销毁之前
  58. destroyed() {}, //生命周期 - 销毁完成
  59. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  60. };
  61. </script>
  62. <style lang='less' scoped>
  63. .Video {
  64. width: 100%;
  65. height: 100%;
  66. overflow: hidden;
  67. position: absolute;
  68. top: 0;
  69. left: 0;
  70. .videoBox {
  71. background-color: #fff;
  72. transition: opacity 0.5s;
  73. position: absolute;
  74. top: 0;
  75. left: 0;
  76. width: 100%;
  77. height: 100%;
  78. z-index: 30;
  79. }
  80. video {
  81. position: absolute;
  82. top: 50%;
  83. transform: translateY(-50%);
  84. width: 100%;
  85. }
  86. .skip {
  87. opacity: 0;
  88. pointer-events: none;
  89. transition: opacity 0.3s;
  90. cursor: pointer;
  91. background-image: url("../../assets/img/skip.png");
  92. background-size: 100% 100%;
  93. position: absolute;
  94. bottom: 50px;
  95. right: 50px;
  96. width: 60px;
  97. height: 60px;
  98. line-height: 60px;
  99. text-align: center;
  100. font-size: 16px;
  101. color: #a50f0f;
  102. }
  103. .active {
  104. opacity: 1;
  105. pointer-events: auto;
  106. }
  107. }
  108. .bacImg {
  109. transition: opacity 0.5s;
  110. position: absolute;
  111. top: 0;
  112. left: 0;
  113. width: 100%;
  114. height: 100%;
  115. z-index: 29;
  116. background-image: url("../../assets/img/HomeBac.jpg");
  117. background-size: 100% 100%;
  118. .btnn {
  119. cursor: pointer;
  120. position: absolute;
  121. bottom: 70px;
  122. left: 50%;
  123. transform: translateX(-50%);
  124. width: 302px;
  125. height: 140px;
  126. line-height: 190px;
  127. font-weight: 700;
  128. text-align: center;
  129. font-size: 24px;
  130. color: #930909;
  131. background-image: url("../../assets/img/HomeBtnn.png");
  132. background-size: 100% 100%;
  133. }
  134. }
  135. .none {
  136. opacity: 0;
  137. pointer-events: none;
  138. }
  139. </style>