Bottom2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <div class="Bottom2">
  3. <div class="box1">
  4. <div>
  5. <div
  6. class="swiper-container"
  7. :class="`sww${towAc}`"
  8. :key="towAc + box3Ac"
  9. >
  10. <div class="swiper-wrapper">
  11. <div
  12. class="swiper-slide"
  13. v-for="(item, index) in swData"
  14. :key="index"
  15. >
  16. <div
  17. v-for="(val, ind) in item.son"
  18. :key="ind"
  19. @click="cutVr(val)"
  20. :class="{
  21. active: oneAc === val.id,
  22. sm: ind === 0 || ind == item.son.length - 1,
  23. big: item.son.length < 6,
  24. }"
  25. >
  26. <el-tooltip :content="val.name" placement="top">
  27. <div>
  28. <img
  29. v-lazy="
  30. `https://4dkk.4dage.com/720yun_fd_manage/${val.code}/preview.jpg`
  31. "
  32. alt=""
  33. v-if="box3Ac < 3"
  34. />
  35. <img v-lazy="codeChange(val.code, val.id)" alt="" v-else />
  36. <p>{{ val.name }}</p>
  37. </div>
  38. </el-tooltip>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div
  44. class="swiper-button-next"
  45. :class="{ none: swIndex === swData.length - 1 }"
  46. ></div>
  47. <div class="swiper-button-prev" :class="{ none: swIndex === 0 }"></div>
  48. </div>
  49. </div>
  50. <div class="box2" v-if="box3Ac === 3 || box3Ac === 4">
  51. <div v-for="(item, index) in data" :key="item.id">
  52. <div @click="botChange(item)" :class="{ active: towAc === item.id }">
  53. {{ item.name }}
  54. </div>
  55. <img
  56. src="../assets/img/fenge.png"
  57. alt=""
  58. v-if="index < data.length - 1"
  59. />
  60. </div>
  61. </div>
  62. <div class="box3">
  63. <div v-for="(item, index) in box3Data" :key="item.id">
  64. <div @click="botChange2(item)" :class="{ active: box3Ac === item.id }">
  65. {{ item.name }}
  66. </div>
  67. <img
  68. src="../assets/img/fenge.png"
  69. alt=""
  70. v-if="index < box3Data.length - 1"
  71. />
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. <script>
  77. import { exArr1, exArr2, exArr3, exArr4 } from "./zhan";
  78. import Swiper from "@/assets/swiper/swiper.js";
  79. export default {
  80. name: "Bottom2",
  81. components: {},
  82. data() {
  83. return {
  84. oneAc: "",
  85. towAc: "1",
  86. box3Ac: 1,
  87. data: [],
  88. swData: [],
  89. Swiper: null,
  90. swIndex: 0,
  91. box3Data: [
  92. { id: 1, name: "航拍", code: "" },
  93. { id: 2, name: "地面全景", code: "" },
  94. { id: 3, name: "第一展厅", code: "" },
  95. { id: 4, name: "第二展厅", code: "" },
  96. ],
  97. };
  98. },
  99. computed: {},
  100. methods: {
  101. // 处理链接
  102. codeChange(code, id) {
  103. let index = code.indexOf("&");
  104. let url = code.substr(0, index);
  105. if (index > 0) {
  106. let arr = [
  107. "4-3_7",
  108. "4-3_8",
  109. "4-3_12",
  110. "4-3_12",
  111. "4-3_14",
  112. "4-3_15",
  113. "4-3_16",
  114. "4-3_17",
  115. "4-3_19",
  116. "4-3_20",
  117. "4-3_21",
  118. "4-3_22",
  119. "4-3_23",
  120. "4-3_24",
  121. "4-5_7",
  122. "4-5_8",
  123. "4-5_9",
  124. "4-6_2",
  125. "4-6_3",
  126. "4-6_4",
  127. "4-6_5",
  128. "4-6_6",
  129. "4-6_7",
  130. "4-6_8",
  131. "4-6_9",
  132. "4-6_10",
  133. ];
  134. if (arr.find((v) => v === id)) return `img/${id}.jpg`;
  135. else
  136. return `https://4dkk.4dage.com/scene_view_data/${url}/user/thumb-2k.jpg`;
  137. } else
  138. return `https://4dkk.4dage.com/scene_view_data/${code}/user/thumb-2k.jpg`;
  139. },
  140. // 点击底部的切换分区
  141. botChange(item) {
  142. // console.log('--------',item.id);
  143. // this.$emit('changeMap',)
  144. this.towAc = "1";
  145. this.towAc = item.id;
  146. if (this.box3Ac === 3) this.data = [...exArr3];
  147. else this.data = [...exArr4];
  148. this.getSwFu(item.id + "", "1_1", true);
  149. },
  150. botChange2(item) {
  151. this.$emit("zhanShowFu");
  152. if (this.box3Ac === item.id) return;
  153. this.towAc = "1";
  154. this.box3Ac = item.id;
  155. if (item.id === 1) this.data = [...exArr1];
  156. else if (item.id === 2) this.data = [...exArr2];
  157. else if (item.id === 3) this.data = [...exArr3];
  158. else this.data = [...exArr4];
  159. this.getSwFu("1", "1_1", true);
  160. // 给父组件传递信息
  161. this.$emit("gaoduChange", this.box3Ac);
  162. // this.$emit("zhanChange", this.box3Ac, item.code);
  163. },
  164. // 封装一个重新加载轮播图的方法
  165. getSwFu(id1, id2, flag) {
  166. this.$nextTick(() => {
  167. this.swData = [];
  168. this.Swiper = null;
  169. let obj = this.data.find((v) => v.id == id1);
  170. this.towAc = obj.id;
  171. let index = id2.indexOf("_");
  172. let bs = id2.substr(index + 1, id2.length);
  173. let num1 = Math.ceil(Number(bs) / 6);
  174. num1 -= 1;
  175. if (!flag) {
  176. this.oneAc = id2;
  177. }
  178. // 获取分区里面数据的长度
  179. let num = Math.ceil(obj.son.length / 6);
  180. for (let i = 0; i < num; i++) {
  181. this.swData.push({
  182. son: obj.son.slice(i * 6, (i + 1) * 6),
  183. });
  184. }
  185. setTimeout(() => {
  186. this.Swiper = new Swiper(`.box1 .sww${this.towAc}`, {
  187. navigation: {
  188. nextEl: ".swiper-button-next",
  189. prevEl: ".swiper-button-prev",
  190. },
  191. slidesPerView: 1,
  192. initialSlide: num1,
  193. spaceBetween: 0,
  194. });
  195. }, 300);
  196. });
  197. },
  198. // 切换VR
  199. cutVr(val) {
  200. if (this.oneAc === val.id) return;
  201. if (val.code === "") return this.$message.warning("数据计算中,敬请期待");
  202. this.oneAc = val.id;
  203. this.$emit("zhanChange", val.code);
  204. },
  205. // 进来页面的方法
  206. baseList(bs) {
  207. if (bs == 3) this.data = [...exArr3];
  208. else if (bs == 4) this.data = [...exArr4];
  209. else this.data = exArr1;
  210. },
  211. },
  212. watch: {
  213. "Swiper.activeIndex"(val) {
  214. this.swIndex = val;
  215. },
  216. },
  217. //生命周期 - 创建完成(可以访问当前this实例)
  218. created() {
  219. this.baseList(1);
  220. },
  221. //生命周期 - 挂载完成(可以访问DOM元素)
  222. mounted() {
  223. this.getSwFu("1", "1_1", true);
  224. },
  225. beforeCreate() {}, //生命周期 - 创建之前
  226. beforeMount() {}, //生命周期 - 挂载之前
  227. beforeUpdate() {}, //生命周期 - 更新之前
  228. updated() {}, //生命周期 - 更新之后
  229. beforeDestroy() {}, //生命周期 - 销毁之前
  230. destroyed() {}, //生命周期 - 销毁完成
  231. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  232. };
  233. </script>
  234. <style lang='less' scoped>
  235. @import "../assets/swiper/swiper.css";
  236. .Bottom2 {
  237. width: 100%;
  238. height: 100%;
  239. position: relative;
  240. .box1 {
  241. position: relative;
  242. width: 100%;
  243. height: 152px;
  244. margin-bottom: 4px;
  245. background-color: rgba(0, 0, 0, 0.8);
  246. border-radius: 60px 60px 0 0;
  247. & > div {
  248. padding: 8px 50px 5px 50px;
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. width: 100%;
  253. height: 100%;
  254. width: 100%;
  255. height: 100%;
  256. }
  257. .swiper-container {
  258. width: 100%;
  259. height: 100%;
  260. .swiper-slide {
  261. display: flex;
  262. justify-content: center;
  263. & > div {
  264. border-radius: 20px;
  265. overflow: hidden;
  266. position: relative;
  267. cursor: pointer;
  268. margin-right: 12px;
  269. width: 209px;
  270. height: 100%;
  271. /deep/.el-tooltip {
  272. width: 100%;
  273. height: 100%;
  274. }
  275. &:nth-of-type(6) {
  276. margin-right: 0;
  277. }
  278. p {
  279. opacity: 0.8;
  280. transition: all 0.3s;
  281. position: absolute;
  282. bottom: 0;
  283. left: 0;
  284. width: 100%;
  285. height: 30px;
  286. line-height: 30px;
  287. text-align: center;
  288. background-color: rgba(0, 0, 0, 0.8);
  289. font-size: 14px;
  290. color: #fff;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. white-space: nowrap;
  294. padding: 0 6px;
  295. border-radius: 0 0 20px 20px;
  296. }
  297. img {
  298. width: 100%;
  299. height: 100%;
  300. object-fit: cover;
  301. }
  302. &:hover {
  303. p {
  304. opacity: 1;
  305. background-color: rgba(181, 147, 134, 0.8);
  306. }
  307. }
  308. }
  309. .active {
  310. p {
  311. opacity: 1;
  312. background-color: rgba(181, 147, 134, 0.8);
  313. }
  314. }
  315. .sm {
  316. width: 170px;
  317. }
  318. .big {
  319. width: 209px;
  320. }
  321. }
  322. }
  323. .swiper-button-next {
  324. opacity: 1;
  325. pointer-events: auto;
  326. cursor: pointer;
  327. color: #c48871;
  328. }
  329. .swiper-button-prev {
  330. pointer-events: auto;
  331. opacity: 1;
  332. cursor: pointer;
  333. color: #c48871;
  334. }
  335. .none {
  336. opacity: 0.35;
  337. pointer-events: none;
  338. }
  339. }
  340. .box2 {
  341. background-color: rgba(0, 0, 0, 0.8);
  342. width: 100%;
  343. height: 40px;
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. padding-bottom: 2px;
  348. & > div {
  349. display: flex;
  350. align-items: center;
  351. & > img {
  352. margin: 0 26px;
  353. width: 2px;
  354. height: 40px;
  355. }
  356. & > div {
  357. cursor: pointer;
  358. font-size: 16px;
  359. color: #fff;
  360. padding-bottom: 5px;
  361. opacity: 0.8;
  362. &:hover {
  363. opacity: 1;
  364. padding-top: 2px;
  365. color: #c48871;
  366. border-bottom: 2px solid #c48871;
  367. }
  368. }
  369. }
  370. .active {
  371. opacity: 1;
  372. padding-top: 2px;
  373. pointer-events: none;
  374. color: #c48871;
  375. border-bottom: 2px solid #c48871;
  376. }
  377. }
  378. .box3 {
  379. margin-top: 5px;
  380. background-color: rgba(0, 0, 0, 0.8);
  381. width: 100%;
  382. height: 56px;
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. padding-bottom: 2px;
  387. & > div {
  388. display: flex;
  389. align-items: center;
  390. & > img {
  391. margin: 0 26px;
  392. width: 2px;
  393. height: 40px;
  394. }
  395. & > div {
  396. cursor: pointer;
  397. font-size: 20px;
  398. color: #fff;
  399. padding-bottom: 5px;
  400. opacity: 0.8;
  401. &:hover {
  402. opacity: 1;
  403. padding-top: 2px;
  404. color: #c48871;
  405. border-bottom: 2px solid #c48871;
  406. }
  407. }
  408. }
  409. .active {
  410. opacity: 1;
  411. padding-top: 2px;
  412. // pointer-events: none;
  413. color: #c48871;
  414. border-bottom: 2px solid #c48871;
  415. }
  416. }
  417. }
  418. </style>