index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class='Construct'>
  3. <!-- 模型的嵌套盒子 -->
  4. <div class="ifrBox">
  5. <!-- <iframe src="http://4dscene.4dage.com/culturalrelics/YFYCModel/index.html#/" frameborder="0"></iframe> -->
  6. </div>
  7. <!-- 左上的场景选择 -->
  8. <div class="vrChange" @click="vrShow = true">
  9. <img src="../../assets/img/construct/vrChange.png" alt="">
  10. <p>场景选择</p>
  11. </div>
  12. <!-- 右下角的搜索按钮 -->
  13. <img class="search" @click="searchShow=!searchShow" src="../../assets/img/construct/search.png" alt="">
  14. <!-- 点击左上角出来的轮播图 -->
  15. <div class="vrBox" :class="{ vrBoxAc: vrShow }">
  16. <!-- 关闭按钮 -->
  17. <div class="close" @click="vrShow = false">
  18. <van-icon name="cross" />
  19. </div>
  20. <div class="vrBoxSwi">
  21. <div class="swiper-container">
  22. <div class="swiper-wrapper">
  23. <div class="swiper-slide" v-for="i in 5" :key="i">
  24. <img src="../../assets/img/construct/sw1.png" alt="">
  25. <p>芜湖老海关{{ i }}</p>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <!-- 点击右下角的搜索出来的页面 -->
  32. <div class="searcBox" :class="{ searcBoxAc: searchShow }">
  33. <Search />
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import Search from './components/search.vue'
  39. import Swiper from "../../assets/libs/swiper.js";
  40. export default {
  41. components: { Search },
  42. data() {
  43. return {
  44. vrShow: false,
  45. searchShow: true
  46. };
  47. },
  48. computed: {},
  49. watch: {},
  50. methods: {
  51. },
  52. created() {
  53. },
  54. mounted() {
  55. new Swiper(".Construct .swiper-container", {
  56. slidesPerView: 1.4,
  57. spaceBetween: 30,
  58. centeredSlides: true,
  59. initialSlide: 4,
  60. });
  61. },
  62. beforeCreate() { }, //生命周期 - 创建之前
  63. beforeMount() { }, //生命周期 - 挂载之前
  64. beforeUpdate() { }, //生命周期 - 更新之前
  65. updated() { }, //生命周期 - 更新之后
  66. beforeDestroy() { }, //生命周期 - 销毁之前
  67. destroyed() { }, //生命周期 - 销毁完成
  68. activated() { }, //如果页面有keep-alive缓存功能,这个函数会触发
  69. }
  70. </script>
  71. <style lang='less' scoped>
  72. @import "../../assets/libs/swiper.css";
  73. .Construct {
  74. font-size: 16px;
  75. color: #fff;
  76. width: 100%;
  77. height: calc(100% - 80px);
  78. position: relative;
  79. .ifrBox {
  80. position: absolute;
  81. top: 0;
  82. left: 0;
  83. width: 100%;
  84. height: 100%;
  85. iframe {
  86. width: 100%;
  87. height: 100%;
  88. }
  89. }
  90. .vrChange {
  91. position: absolute;
  92. top: 20px;
  93. left: 20px;
  94. z-index: 2;
  95. width: 60px;
  96. text-align: center;
  97. &>img {
  98. width: 40px;
  99. }
  100. &>p {
  101. font-size: 14px;
  102. }
  103. }
  104. .search {
  105. position: absolute;
  106. bottom: 20px;
  107. right: 20px;
  108. width: 40px;
  109. z-index: 2;
  110. }
  111. .vrBox {
  112. opacity: 0;
  113. pointer-events: none;
  114. transition: opacity .3s;
  115. position: absolute;
  116. z-index: 3;
  117. width: 100%;
  118. height: 100%;
  119. background-color: rgba(0, 0, 0, .6);
  120. .close {
  121. position: absolute;
  122. z-index: 3;
  123. top: 20px;
  124. right: 20px;
  125. font-size: 24px;
  126. color: #fff;
  127. }
  128. .vrBoxSwi {
  129. position: absolute;
  130. top: 50%;
  131. transform: translateY(-50%);
  132. width: 100%;
  133. height: 55vh;
  134. .swiper-container {
  135. width: 100%;
  136. height: 100%;
  137. .swiper-slide {
  138. &>img {
  139. border-radius: 8px 8px 0 0;
  140. width: 100%;
  141. height: calc(100% - 40px);
  142. object-fit: cover;
  143. }
  144. &>p {
  145. height: 40px;
  146. line-height: 40px;
  147. font-size: 18px;
  148. text-align: center;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. .vrBoxAc {
  155. opacity: 1;
  156. pointer-events: auto;
  157. }
  158. .searcBox {
  159. transform: translateX(-300px);
  160. opacity: 0;
  161. pointer-events: none;
  162. transition: all .3s;
  163. position: absolute;
  164. z-index: 3;
  165. left: 0;
  166. width: 75%;
  167. height: 100%;
  168. }
  169. .searcBoxAc {
  170. transform: translateX(0);
  171. opacity: 1;
  172. pointer-events: auto;
  173. }
  174. }
  175. </style>