index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div class="wrapper">
  3. <div class="layout" v-if="!$isMobile">
  4. <bg @close="isBgLoading=false" v-if="isBgLoading" :canvasWidth='width' :canvasHeight='height' class="xlz-bg"/>
  5. <div class="video-con">
  6. <iframe :key="ifrUrl" allowfullscreen="true" :src="ifrUrl" frameborder="0"></iframe>
  7. </div>
  8. <div class="mask" v-if="page"></div>
  9. <div class="hover-con" >
  10. <story v-if="page==='story'"/>
  11. <tunnel v-if="page==='tunnel'"/>
  12. <history v-if="page==='history'"/>
  13. </div>
  14. </div>
  15. <div v-else class="mobile-layout">
  16. <iframe allowfullscreen="true" :key="ifrUrl" :src="ifrUrl" frameborder="0"></iframe>
  17. <div class="mask" v-if="page"></div>
  18. <div class="hover-conm" v-if="page">
  19. <story v-if="page==='story'"/>
  20. <tunnel v-if="page==='tunnel'"/>
  21. <history v-if="page==='history'"/>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import story from '@/pages/story'
  28. import tunnel from '@/pages/tunnel'
  29. import history from '@/pages/history'
  30. import bg from '@/components/background'
  31. // http://192.168.0.44:8110/
  32. let temp = ''
  33. const outKey = "791"
  34. const inKey = "762"
  35. let height = window.innerHeight + 10
  36. window.onresize = ()=>{
  37. height = window.innerHeight + 10
  38. }
  39. export default {
  40. components:{story,tunnel,history,bg},
  41. data(){
  42. return {
  43. showBtn:false,
  44. page: this.$route.query.route,
  45. ifr:outKey,
  46. lang:'',
  47. isBgLoading:true
  48. }
  49. },
  50. methods:{
  51. },
  52. computed:{
  53. width(){
  54. return height * (2120/1080)
  55. },
  56. height(){
  57. return height
  58. },
  59. ifrUrl(){
  60. let tmp = `${temp}/SuperTwo${this.ifr}/index.html?m=${this.ifr+(this.ifr==inKey?'_en':this.lang)}&qust=1`
  61. return tmp
  62. }
  63. },
  64. watch:{
  65. '$route.query.route':function (newVal) {
  66. this.page = newVal
  67. },
  68. ifr(newVal){
  69. if (newVal&&this.$isMobile) {
  70. this.$showLoading()
  71. }
  72. }
  73. },
  74. mounted(){
  75. if (this.$isMobile) {
  76. this.$showLoading()
  77. window.addEventListener("message", (data) => {
  78. if (Object.prototype.toString.call(data.data) == "[object String]") {
  79. if (data.data === "loadComplete") {
  80. this.$hideLoading()
  81. }
  82. }
  83. });
  84. }
  85. this.$bus.$on('outScene', data=>{
  86. this.ifr = data?outKey:inKey
  87. })
  88. this.$bus.$on('changeLang', data=>{
  89. this.lang = data
  90. })
  91. window.addEventListener("message", (data) => {
  92. if (Object.prototype.toString.call(data.data) == "[object String]") {
  93. if (data.data === "goInside") {
  94. this.$bus.$emit('switchScene')
  95. }
  96. }
  97. });
  98. }
  99. }
  100. </script>
  101. <style lang="less" scoped>
  102. .wrapper {
  103. width: 100%;
  104. height: 100%;
  105. }
  106. .layout{
  107. height: 100%;
  108. position: fixed;
  109. top: 0;
  110. width: 100%;
  111. left: 0;
  112. background: #000;
  113. .video-con{
  114. video,iframe{
  115. width: 100%;
  116. height: 100%;
  117. top: 50%;
  118. left: 0;
  119. transform: translate(0%,-50%);
  120. z-index: 0;
  121. position: fixed;
  122. user-select: none;
  123. }
  124. >iframe{
  125. top: 0;
  126. left: 0;
  127. transform: none;
  128. }
  129. }
  130. .mask{
  131. position: fixed;
  132. top: 0;
  133. // width: calc(100% - 200px);
  134. width:100%;
  135. height: 100%;
  136. left: 0;
  137. background: rgba(0, 0, 0, 0.45);
  138. }
  139. .hover-con{
  140. width: calc(90% - 200px);
  141. position: fixed;
  142. top: 50%;
  143. transform: translateY(-50%);
  144. left: 5%;;
  145. background-color: #DC2506;
  146. border-radius: 4px;
  147. overflow: hidden;
  148. }
  149. }
  150. .mobile-layout{
  151. width: 100%;
  152. height: 100%;
  153. iframe{
  154. width: 100%;
  155. height: 100%;
  156. }
  157. .mask{
  158. position: fixed;
  159. top: 0;
  160. width: 100%;
  161. height: 100%;
  162. left: 0;
  163. background: rgba(0, 0, 0, 0.45);
  164. }
  165. .hover-conm{
  166. width: 100%;
  167. height: 100%;
  168. position: fixed;
  169. top: 0;
  170. left: 0;
  171. background: none;
  172. overflow: hidden;
  173. }
  174. }
  175. </style>