index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="wrapper">
  3. <div class="layout" v-if="!isMobile">
  4. <div class="video-con">
  5. <video ref="tunnel" :src="`${$cdn}video/Final_OLD_web.mp4`" autoplay loop></video>
  6. </div>
  7. <img v-if="showBtn" class="bofang" :src="`${$cdn}images/bofang.png`" alt="">
  8. </div>
  9. <div class="mobileLayout" v-if="isMobile">
  10. <div class="video-con">
  11. <img class="bg" :src="`${$cdn}images/mobile/default_bg.png`" alt="">
  12. <video ref="tunnelMobile" :src="`${$cdn}video/mobile/shl2_mobile.mp4`" autoplay loop controls></video>
  13. </div>
  14. <img @click="$router.push({path:'/'})" class="bofangMobile" :src="`${$cdn}images/mobile/btn_back.png`" alt="">
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import browser from '@/utils/browser.js'
  20. export default {
  21. data(){
  22. return {
  23. showBtn:false,
  24. isMobile: browser.mobile
  25. }
  26. },
  27. methods:{
  28. play(){
  29. if(this.isMobile) {
  30. this.$refs.tunnelMobile.play()
  31. } else {
  32. this.$refs.tunnel.play()
  33. }
  34. this.showBtn = false
  35. }
  36. },
  37. mounted(){
  38. if(this.isMobile) {
  39. this.$refs.tunnelMobile.play()
  40. this.$nextTick(()=>{
  41. setTimeout(() => {
  42. if (this.$refs.tunnelMobile.paused) {
  43. this.showBtn = true
  44. }
  45. });
  46. })
  47. } else {
  48. this.$refs.tunnel.play()
  49. this.$nextTick(()=>{
  50. setTimeout(() => {
  51. if (this.$refs.tunnel.paused) {
  52. this.showBtn = true
  53. }
  54. });
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="less" scoped>
  61. .mobileLayout{
  62. height: 100%;
  63. position: fixed;
  64. top: 0;
  65. width: 100%;
  66. left: 0;
  67. background: #000;
  68. .video-con{
  69. .bg {
  70. position: fixed;
  71. left: 0;
  72. bottom: 10vh;
  73. width: 100vw;
  74. height: 90vh;
  75. }
  76. video{
  77. width: 100%;
  78. top: 50%;
  79. left: 0;
  80. transform: translate(0%,-50%);
  81. z-index: 0;
  82. position: fixed;
  83. user-select: none;
  84. }
  85. }
  86. }
  87. .layout{
  88. height: 100%;
  89. position: fixed;
  90. top: 0;
  91. width: calc(100% - 200px);
  92. left: 0;
  93. background: #000;
  94. .video-con{
  95. video{
  96. width: calc(100% - 200px);
  97. top: 50%;
  98. left: 0;
  99. transform: translate(0%,-50%);
  100. z-index: 0;
  101. position: fixed;
  102. user-select: none;
  103. }
  104. }
  105. }
  106. .bofangMobile {
  107. position: absolute;
  108. left: 50%;
  109. bottom: 20%;
  110. width: 25vw;
  111. transform: translate(-50%,0%);
  112. cursor: pointer;
  113. }
  114. </style>