Scene.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="scene">
  3. <div class="scene_button" :class="{ active: openStatus }" @click="openSceneList"></div>
  4. <div class="scene_container animate__animated" ref="scene_list">
  5. <!-- v-show="sceneContainerShow" -->
  6. <van-tabs v-model="scene_index" @change="tabChange" :animated="true">
  7. <van-tab v-for="(item, index) in sceneData" :key="index" :title="item.name" :name="index">
  8. <div :class="[{ swiper: true }, 'mySwiper' + (index + 1)]">
  9. <div class="swiper-wrapper">
  10. <div class="swiper-slide" v-for="(slide, index_) in item.children" :key="index_" @click="jumpScene(slide)"
  11. :class="{ active: slide.active }">
  12. <img :src="slide.image" />
  13. <span v-if="slide.name.length < 8">{{ slide.name }}</span>
  14. <marquee v-else class="marquee" direction="left" scrollamount="1" behavior="scroll" scrolldelay="0"
  15. loop="loop">
  16. {{ slide.name }}
  17. </marquee>
  18. </div>
  19. <div class="swiper-scrollbar"></div>
  20. </div>
  21. </div>
  22. </van-tab>
  23. </van-tabs>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. let sceneData = JSON.parse(JSON.stringify(systemConfig.scene));
  31. sceneData = sceneData.map(function (item, firstIndex) {
  32. if (firstIndex == 0) {
  33. item.active = true;
  34. } else {
  35. item.active = false;
  36. }
  37. item.children = item.children.map(function (sce, secondIndex) {
  38. sce.active = false;
  39. return sce;
  40. });
  41. return item;
  42. });
  43. return {
  44. scene_index: 0,
  45. openStatus: true,
  46. sceneContainerShow: true,
  47. sceneData: sceneData,
  48. swiper1: null,
  49. swiper2: null,
  50. swiper3: null,
  51. swiper4: null,
  52. };
  53. },
  54. // components: {
  55. // swiper,
  56. // swiperSlide,
  57. // },
  58. mounted() {
  59. let that = this;
  60. window.clearSceneActive = this.clearSceneActive;
  61. setTimeout(() => {
  62. that.tabTendered(that.scene_index);
  63. }, 100);
  64. window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () {
  65. that.tabTendered(that.scene_index);
  66. // if(that.swiper1)that.swiper1.updateSize();
  67. // if(that.swiper2)that.swiper2.updateSize();
  68. // if(that.swiper3)that.swiper3.updateSize();
  69. // if(that.swiper4)that.swiper4.updateSize();
  70. // if (window.orientation === 180 || window.orientation === 0) {
  71. // console.log("竖屏");
  72. // // $(".codeIg_s").removeClass('vercreen');//取消横屏样式
  73. // }
  74. // if (window.orientation === 90 || window.orientation === -90 ){
  75. // console.log("横屏");
  76. // // $(".codeIg_s").addClass('vercreen');//添加横屏样式
  77. // }
  78. }, false);
  79. },
  80. methods: {
  81. openSceneList() {
  82. let that = this;
  83. this.openStatus = !this.openStatus;
  84. if (this.openStatus) {
  85. // 向上平移
  86. this.$refs["scene_list"].style.display = "block";
  87. this.$refs["scene_list"].classList.add("animate__fadeInUp");
  88. setTimeout(() => {
  89. this.$refs["scene_list"].classList.remove("animate__fadeInUp");
  90. }, 1000);
  91. } else {
  92. // 向下平移
  93. this.$refs["scene_list"].classList.add("animate__fadeOutDown");
  94. setTimeout(() => {
  95. this.$refs["scene_list"].style.display = "none";
  96. this.$refs["scene_list"].classList.remove("animate__fadeOutDown");
  97. }, 1000);
  98. }
  99. },
  100. jumpScene(item) {
  101. this.sceneData = this.sceneData.map(function (item, index) {
  102. item.children = item.children.map(function (tt, index) {
  103. tt.active = false;
  104. return tt;
  105. });
  106. return item;
  107. });
  108. item.active = true;
  109. cancelLookAround();
  110. showTitle(item.name);
  111. this.$flyTo({
  112. lon: item.camera.lon,
  113. lat: item.camera.lat,
  114. h: item.camera.h,
  115. heading: item.camera.heading,
  116. pitch: item.camera.pitch,
  117. roll: item.camera.roll,
  118. time: 1,
  119. pitchAdjustHeight: 1000,
  120. details: item,
  121. callback: null,
  122. });
  123. },
  124. clearSceneActive(index) {
  125. if (this.imageList)
  126. this.imageList = this.imageList.map(function (tt, index) {
  127. tt.active = false;
  128. return tt;
  129. });
  130. },
  131. tabChange(index, title) {
  132. let that = this;
  133. setTimeout(() => {
  134. that.tabTendered(index);
  135. }, 100);
  136. },
  137. tabTendered(index) {
  138. let swiperOptions = {
  139. loop: false, //自动轮播
  140. slideToClickedSlide: true,
  141. slidesPerView: "auto", //设置slider容器能够同时显示的slides数量(carousel模式)。auto为居中显示一个
  142. centeredSlides: true, //若为true,那么活动块会居中,而非默认状态下的居左...false
  143. spaceBetween: 20, //设置每个slide之间的距离(单位px)。
  144. };
  145. switch (index) {
  146. case 0:
  147. this.swiper1 = new Swiper(".mySwiper1", swiperOptions);
  148. break;
  149. case 1:
  150. this.swiper2 = new Swiper(".mySwiper2", swiperOptions);
  151. break;
  152. case 2:
  153. this.swiper3 = new Swiper(".mySwiper3", swiperOptions);
  154. break;
  155. case 3:
  156. this.swiper4 = new Swiper(".mySwiper4", swiperOptions);
  157. break;
  158. default:
  159. break;
  160. }
  161. },
  162. },
  163. };
  164. </script>
  165. <style lang="less" scoped>
  166. .scene {
  167. position: absolute;
  168. z-index: 0;
  169. left: 0px;
  170. bottom: 0px;
  171. width: 100%;
  172. height: 0px;
  173. .scene_button {
  174. position: relative;
  175. z-index: 1;
  176. bottom: 11vw;
  177. left: 0px;
  178. width: 11vw;
  179. height: 11vw;
  180. background: url(~@/assets/img/scene/scene.png) center center/100% 100% no-repeat;
  181. &.active {
  182. background: url(~@/assets/img/scene/scene_active.png) center center/100% 100% no-repeat;
  183. }
  184. }
  185. .scene_container {
  186. position: absolute;
  187. z-index: 1;
  188. bottom: 11vw;
  189. left: 0px;
  190. height: 32vw;
  191. width: 100%;
  192. .van-tabs {
  193. width: 100%;
  194. height: 100%;
  195. :deep(.van-tabs__wrap) {
  196. height: 8vw;
  197. padding: 5px 20px;
  198. background: #33333366;
  199. transform: translateY(20vw);
  200. display: -webkit-box;
  201. display: -ms-flexbox;
  202. display: flex;
  203. -webkit-box-pack: center;
  204. -ms-flex-pack: center;
  205. justify-content: center;
  206. .van-tabs__nav {
  207. background: transparent;
  208. padding: 0 0;
  209. .van-tab {
  210. width: fit-content;
  211. min-width: 72px;
  212. max-width: 120px;
  213. .van-tab__text {
  214. color: #ffffff;
  215. font-size: 3vw;
  216. height: 5vw;
  217. line-height: 5vw
  218. }
  219. .van-tab--active {
  220. color: #ffffff;
  221. }
  222. }
  223. .van-tabs__line {
  224. bottom: 0px;
  225. height: 2px;
  226. }
  227. }
  228. }
  229. :deep(.van-tabs__content) {
  230. transform: translateY(-140px);
  231. background: #33333366;
  232. padding: 5px 0px;
  233. height: 200px;
  234. .van-tab__panel {
  235. height: 200px;
  236. }
  237. .swiper {
  238. width: 100%;
  239. height: 100%;
  240. }
  241. .swiper-slide {
  242. // width: 145.5px !important;
  243. // height: 78px !important;
  244. width: 349.2px !important;
  245. height: 187.2px !important;
  246. overflow: hidden;
  247. img {
  248. width: 349.2px;
  249. height: 187.2px;
  250. }
  251. .marquee,
  252. span {
  253. width: 100%;
  254. color: #ffffff;
  255. position: absolute;
  256. bottom: 0px;
  257. left: 0px;
  258. font-size: 28px;
  259. text-align: center;
  260. background: #33333366;
  261. }
  262. &.active {
  263. border: 2px solid #e77d00;
  264. }
  265. }
  266. .swiper .swiper-wrapper .swiper-slide {
  267. width: 650px;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>