Home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <div class="Home" @click.once="oneMusicPlay" :class="{ noneBac: iframeSrc }">
  3. <div class="hengPing" :class="{ hengPingAc: hengPing }">
  4. <img src="../assets/img/landtip.png" alt="" />
  5. <p>请竖屏浏览</p>
  6. </div>
  7. <!-- 全景页面 -->
  8. <div class="iframeBox" v-if="iframeSrc" :key="iframeSrc">
  9. <iframe :src="iframeSrc" frameborder="0" v-if="box3Ac < 3"></iframe>
  10. <iframe :src="iframeSrc" frameborder="0" v-else></iframe>
  11. </div>
  12. <!-- 音乐 -->
  13. <audio id="myAduio" loop src="../assets/bg.mp3"></audio>
  14. <!-- 右上角的logo -->
  15. <div class="rigLogo">
  16. <img src="../assets/img/logo.png" alt="" />
  17. </div>
  18. <!-- 左上角的inco -->
  19. <div class="topInco">
  20. <div class="toHome" @click="backSta"></div>
  21. <div class="toMean" :class="{ open: toMeanShow, listIncoAc: box3Ac > 2 }">
  22. <div class="mena" @click="toMeanShow = !toMeanShow">
  23. <img
  24. :src="require(`@/assets/img/mean${toMeanShow ? 'Ac' : ''}.png`)"
  25. alt=""
  26. />
  27. </div>
  28. <div
  29. class="mena1"
  30. v-for="item in menaData"
  31. :key="item.id"
  32. @click="cutLeft(item)"
  33. >
  34. <img
  35. :src="
  36. require(`@/assets/img/mean${item.id}${item.done ? 'Ac' : ''}.png`)
  37. "
  38. alt=""
  39. />
  40. </div>
  41. </div>
  42. </div>
  43. <!-- 背景模糊 -->
  44. <div
  45. class="bacMoHu"
  46. v-show="box3Ac == 3 || box3Ac == 4"
  47. v-if="listCut"
  48. ></div>
  49. <div
  50. class="bacMoHu bacMoHu2"
  51. v-show="menaData[0].done || menaData[2].done"
  52. ></div>
  53. <!-- 简介 音乐 分享 -->
  54. <div class="meanBox1" :class="{ meanBox1Show: menaData[0].done }">
  55. <img src="../assets/img/meanBox1.png" alt="" />
  56. <div>
  57. <div class="close" @click="menaData[0].done = false">
  58. <img src="../assets/img/close.png" alt="" />
  59. </div>
  60. <h3>
  61. 第九届“博博会”<br /><br />
  62. —— 新时代的博物馆:创新·发展·传承
  63. </h3>
  64. <p>
  65. &emsp;&emsp;“博博会”创办于2004年,已成功召开八届,是我国文博界最具影响力的盛会,是展示博物馆领域发展成果、增强中华文化自信、促进文博科技融合发展、相关技术应用创新服务升级、扩展博物馆服务社会功能、推动国内外博物馆务实合作、开拓博物馆文化产业发展新领域的重要平台,在服务我国文博事业健康可持续发展和相关行业创造性转化、创新性发展方面发挥着独特的作用。
  66. </p>
  67. </div>
  68. </div>
  69. <div class="meanBox3" :class="{ meanBox3Show: menaData[2].done }">
  70. <img src="../assets/img/meanBox3.png" alt="" />
  71. <div>
  72. <div class="close close2" @click="menaData[2].done = false">
  73. <img src="../assets/img/close.png" alt="" />
  74. </div>
  75. <h3>分享页面</h3>
  76. <div class="link">
  77. <p>{{ myUrl }}</p>
  78. </div>
  79. <div class="btnn">
  80. <p @click="copyPcTxt">一键复制</p>
  81. </div>
  82. </div>
  83. </div>
  84. <!-- 底部和盒子 -->
  85. <Bottom
  86. @changeVR="changeVR"
  87. @mengBan="mengBan"
  88. ref="Bottom"
  89. @lishShow="listCut = true"
  90. @fenQuB_L="fenQuB_L"
  91. @VRActive="VRActive"
  92. @incoMove="incoMove"
  93. />
  94. <!-- 地图列表 -->
  95. <List
  96. ref="List"
  97. @fenQuChange="fenQuChange"
  98. v-if="box3Ac > 2"
  99. :box3Ac="box3Ac"
  100. @toZhan="toZhan"
  101. v-show="listCut"
  102. />
  103. <div
  104. class="listInco"
  105. v-if="box3Ac > 2"
  106. @click="listCut = !listCut"
  107. :style="`background-color:${listCut ? '#d06814' : 'rgba(0, 0, 0, 0.4)'}`"
  108. >
  109. <img :src="require('@/assets/img/listShow.png')" alt="" />
  110. </div>
  111. </div>
  112. </template>
  113. <script>
  114. import { Notify } from "vant";
  115. import Bottom from "./bottom.vue";
  116. import List from "./List.vue";
  117. export default {
  118. //import引入的组件需要注入到对象中才能使用
  119. components: { Bottom, List },
  120. data() {
  121. //这里存放数据
  122. return {
  123. iframeSrc: "",
  124. myUrl: "",
  125. // 控制背景模糊和左边菜单展开收起
  126. toMeanShow: false,
  127. menaData: [
  128. { id: 1, name: "简介", done: false },
  129. { id: 2, name: "音乐", done: false },
  130. { id: 3, name: "分享", done: false },
  131. ],
  132. box3Ac: null,
  133. listCut: true,
  134. // 横屏
  135. hengPing: false,
  136. };
  137. },
  138. //监听属性 类似于data概念
  139. computed: {},
  140. //监控data中的数据变化
  141. watch: {
  142. toMeanShow(val) {
  143. if (!val) {
  144. this.menaData[2].done = this.menaData[0].done = false;
  145. // 控制子组件收起和展开
  146. }
  147. // else this.$refs.Bottom.openBotton(val);
  148. },
  149. },
  150. //方法集合
  151. methods: {
  152. // 控制室内场景的inco位移incoMove
  153. incoMove(val) {
  154. let dom = document.querySelector(".iframeBox iframe");
  155. if (dom && this.box3Ac > 2) {
  156. dom.contentWindow.incoMove(val);
  157. // let domSon =dom.contentWindow.document.querySelector('.inco');
  158. // console.log(dom.contentWindow);
  159. // console.log(dom.contentWindow.incoMove);
  160. // console.log('------',domSon);
  161. // setTimeout(() => {
  162. // console.log('------',dom.contentWindow);
  163. // dom.contentWindow.incoMove(val);
  164. // }, 200);
  165. }
  166. },
  167. // 点击左上角的返回
  168. backSta() {
  169. //回到博博会之前的开发页面
  170. window.location.href = "https://zzbbh.4dage.com/webM/index.html";
  171. },
  172. VRActive(id) {
  173. if (this.$refs.List) this.$refs.List.VRActive(id);
  174. },
  175. fenQuB_L(id) {
  176. this.$refs.List.quChange({ id }, true);
  177. },
  178. fenQuChange(id) {
  179. this.$refs.Bottom.box2Cut({ id }, Number(id - 1));
  180. },
  181. // 列表页操作底部页
  182. toZhan(id1, id2, code) {
  183. this.changeVR(code);
  184. this.$refs.Bottom.box2Cut({ id: id1 }, Number(id1 - 1));
  185. this.$refs.Bottom.getSwFu(id1, id2);
  186. },
  187. mengBan(box3Ac) {
  188. this.box3Ac = box3Ac;
  189. },
  190. changeVR(code) {
  191. if (this.box3Ac < 3) {
  192. this.iframeSrc = `https://zzbbh.4dage.com/SWKK/show.html?id=WK1564638850838523904&vr=${code}`;
  193. } else this.iframeSrc = `swkk.html?m=${code}`;
  194. console.log("vr改变了", code);
  195. this.listCut = false;
  196. },
  197. //点击复制链接
  198. copyPcTxt() {
  199. // 存储传递过来的数据
  200. let OrderNumber = window.location.href;
  201. // 创建一个input 元素
  202. // createElement() 方法通过指定名称创建一个元素
  203. let newInput = document.createElement("input");
  204. // 讲存储的数据赋值给input的value值
  205. newInput.value = OrderNumber;
  206. // appendChild() 方法向节点添加最后一个子节点。
  207. document.body.appendChild(newInput);
  208. // 选中input元素中的文本
  209. // select() 方法用于选择该元素中的文本。
  210. newInput.select();
  211. // 执行浏览器复制命令
  212. // execCommand方法是执行一个对当前文档,当前选择或者给出范围的命令
  213. document.execCommand("Copy");
  214. // 清空输入框
  215. newInput.remove();
  216. Notify({ type: "success", message: "复制成功" });
  217. },
  218. // 只触发一次的音乐播放事件
  219. oneMusicPlay() {
  220. // this.toMeanShow = true;
  221. this.cutLeft(this.menaData[1]);
  222. },
  223. // 左上角的切换
  224. cutLeft(item) {
  225. item.done = !item.done;
  226. if (item.id == 1) {
  227. this.menaData[2].done = false;
  228. // this.$refs.Bottom.openBotton(true);
  229. } else if (item.id == 3) this.menaData[0].done = false;
  230. else {
  231. if (item.done) document.querySelector("#myAduio").play();
  232. else document.querySelector("#myAduio").pause();
  233. }
  234. },
  235. // 判断是否是横批方法
  236. renderResize() {
  237. // 判断横竖屏
  238. let width = document.documentElement.clientWidth;
  239. let height = document.documentElement.clientHeight;
  240. if (width > height) this.hengPing = true;
  241. else this.hengPing = false;
  242. },
  243. },
  244. //生命周期 - 创建完成(可以访问当前this实例)
  245. created() {
  246. this.myUrl = window.location.href;
  247. this.renderResize();
  248. },
  249. //生命周期 - 挂载完成(可以访问DOM元素)
  250. mounted() {
  251. // 监听 resize 方法
  252. window.addEventListener("resize", this.renderResize, false);
  253. // 控制背景音乐大小
  254. let audioYL = document.querySelector("#myAduio");
  255. audioYL.volume = 0.5;
  256. },
  257. beforeCreate() {}, //生命周期 - 创建之前
  258. beforeMount() {}, //生命周期 - 挂载之前
  259. beforeUpdate() {}, //生命周期 - 更新之前
  260. updated() {}, //生命周期 - 更新之后
  261. beforeDestroy() {}, //生命周期 - 销毁之前
  262. destroyed() {}, //生命周期 - 销毁完成
  263. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  264. };
  265. </script>
  266. <style lang='less' scoped>
  267. .noneBac {
  268. background: black !important;
  269. }
  270. .Home {
  271. width: 100%;
  272. height: 100%;
  273. background-image: url("../assets/img/homeBac.jpg");
  274. background-size: 100% 100%;
  275. position: relative;
  276. .hengPing {
  277. opacity: 0;
  278. pointer-events: none;
  279. transition: opacity 0.3s;
  280. display: flex;
  281. flex-direction: column;
  282. justify-content: center;
  283. align-items: center;
  284. position: absolute;
  285. top: 0;
  286. left: 0;
  287. width: 100%;
  288. height: 100%;
  289. z-index: 99999;
  290. background-color: rgba(0, 0, 0, 0.8);
  291. & > img {
  292. max-width: 80%;
  293. max-height: 80%;
  294. }
  295. & > p {
  296. color: #fff;
  297. height: 20%;
  298. display: flex;
  299. justify-content: center;
  300. align-items: center;
  301. font-size: 20px;
  302. }
  303. }
  304. .hengPingAc {
  305. opacity: 1;
  306. pointer-events: auto;
  307. }
  308. .iframeBox {
  309. position: absolute;
  310. top: 0;
  311. left: 0;
  312. width: 100%;
  313. height: 100%;
  314. iframe {
  315. width: 100%;
  316. height: 100%;
  317. }
  318. }
  319. .listInco {
  320. position: absolute;
  321. z-index: 10;
  322. width: 40px;
  323. height: 40px;
  324. border-radius: 50%;
  325. background-color: rgba(0, 0, 0, 0.4);
  326. left: 18px;
  327. top: 80px;
  328. & > img {
  329. width: 100%;
  330. height: 100%;
  331. }
  332. }
  333. .rigLogo {
  334. z-index: 10;
  335. position: absolute;
  336. right: 18px;
  337. top: 26px;
  338. width: 240px;
  339. & > img {
  340. width: 100%;
  341. }
  342. }
  343. .bacMoHu {
  344. position: absolute;
  345. width: 100%;
  346. height: 100%;
  347. top: 0;
  348. left: 0;
  349. z-index: 2;
  350. backdrop-filter: blur(10px);
  351. }
  352. .bacMoHu2 {
  353. z-index: 9;
  354. }
  355. .meanBox1 {
  356. opacity: 0;
  357. pointer-events: none;
  358. transition: opacity 0.5s;
  359. position: absolute;
  360. z-index: 20;
  361. top: 115px;
  362. left: 56%;
  363. transform: translateX(-50%);
  364. & > img {
  365. width: calc(100vw - 100px);
  366. max-width: 400px;
  367. }
  368. div::-webkit-scrollbar {
  369. width: 0px;
  370. height: 0px;
  371. }
  372. & > div {
  373. position: absolute;
  374. width: 90%;
  375. height: 88%;
  376. top: 50%;
  377. left: 50%;
  378. transform: translate(-50%, -50%);
  379. color: #fff;
  380. padding: 0 15px;
  381. font-size: 12px;
  382. overflow-y: auto;
  383. & > h3 {
  384. margin: 20px 0;
  385. text-align: center;
  386. font-weight: 700;
  387. }
  388. & > p {
  389. line-height: 24px;
  390. }
  391. }
  392. @media screen and (min-width: 400px) {
  393. & > div {
  394. font-size: 14px;
  395. }
  396. }
  397. @media screen and (min-width: 420px) {
  398. & > div {
  399. line-height: 28px;
  400. padding: 0 24px;
  401. }
  402. }
  403. // width: 280px;
  404. // height: 244px;
  405. // background-image: url('../assets/img/menaBox1.png');
  406. // background-size: 100% 100%;
  407. }
  408. .meanBox1Show {
  409. opacity: 1;
  410. pointer-events: auto;
  411. }
  412. .close {
  413. position: absolute;
  414. top: 0px;
  415. right: 10px;
  416. width: 20px;
  417. height: 20px;
  418. & > img {
  419. width: 100%;
  420. height: 100%;
  421. }
  422. }
  423. .close2 {
  424. top: 10px;
  425. }
  426. .meanBox3 {
  427. opacity: 0;
  428. pointer-events: none;
  429. transition: opacity 0.5s;
  430. position: absolute;
  431. z-index: 20;
  432. top: 115px;
  433. left: 56%;
  434. transform: translateX(-50%);
  435. & > img {
  436. width: calc(100vw - 100px);
  437. max-width: 400px;
  438. }
  439. & > div {
  440. display: flex;
  441. flex-direction: column;
  442. justify-content: space-between;
  443. position: absolute;
  444. width: 90%;
  445. height: 88%;
  446. top: 50%;
  447. left: 50%;
  448. transform: translate(-50%, -50%);
  449. color: #fff;
  450. padding: 20px;
  451. & > h3 {
  452. height: 40px;
  453. line-height: 40px;
  454. text-align: center;
  455. font-size: 16px;
  456. }
  457. .link {
  458. max-height: 60px;
  459. min-height: 24px;
  460. font-size: 12px;
  461. width: 100%;
  462. height: calc(50% - 50px);
  463. background-color: rgba(0, 0, 0, 0.4);
  464. display: flex;
  465. justify-content: center;
  466. align-items: center;
  467. & > p {
  468. padding: 0 5px;
  469. overflow: hidden;
  470. text-overflow: ellipsis;
  471. white-space: nowrap;
  472. }
  473. }
  474. .btnn {
  475. min-height: 24px;
  476. max-height: 60px;
  477. display: flex;
  478. justify-content: center;
  479. align-items: center;
  480. width: 100%;
  481. height: 40px;
  482. height: calc(50% - 50px);
  483. background-color: rgba(0, 0, 0, 0.4);
  484. position: relative;
  485. & > p {
  486. position: relative;
  487. padding: 0 24px;
  488. &::after {
  489. content: "";
  490. position: absolute;
  491. left: 0;
  492. top: -4px;
  493. width: 2px;
  494. height: 24px;
  495. background-image: linear-gradient(
  496. rgba(255, 255, 255, 0.1),
  497. rgba(255, 255, 255, 0.6),
  498. rgba(255, 255, 255, 0.1)
  499. );
  500. }
  501. &::before {
  502. content: "";
  503. position: absolute;
  504. right: 0;
  505. top: -4px;
  506. width: 2px;
  507. height: 24px;
  508. background-image: linear-gradient(
  509. rgba(255, 255, 255, 0.1),
  510. rgba(255, 255, 255, 0.6),
  511. rgba(255, 255, 255, 0.1)
  512. );
  513. }
  514. }
  515. }
  516. }
  517. }
  518. .meanBox3Show {
  519. opacity: 1;
  520. pointer-events: auto;
  521. }
  522. .topInco {
  523. position: absolute;
  524. z-index: 10;
  525. top: 18px;
  526. left: 18px;
  527. .toHome {
  528. width: 40px;
  529. height: 40px;
  530. border-radius: 50%;
  531. background-image: url("../assets/img/Home.png");
  532. background-size: cover;
  533. display: flex;
  534. justify-content: center;
  535. align-items: center;
  536. }
  537. .toMean {
  538. transition: height 0.3s;
  539. margin-top: 20px;
  540. width: 40px;
  541. height: 40px;
  542. border-radius: 20px;
  543. background-color: rgba(0, 0, 0, 0.4);
  544. overflow: hidden;
  545. & > div {
  546. width: 100%;
  547. height: 40px;
  548. display: flex;
  549. justify-content: center;
  550. align-items: center;
  551. position: relative;
  552. margin-top: 8px;
  553. & > img {
  554. width: 32px;
  555. height: 32px;
  556. }
  557. &::after {
  558. content: "";
  559. position: absolute;
  560. left: 4px;
  561. width: 32px;
  562. bottom: -3px;
  563. height: 1px;
  564. background-image: linear-gradient(
  565. to right,
  566. rgba(255, 255, 255, 0.1),
  567. rgba(255, 255, 255, 0.4),
  568. rgba(255, 255, 255, 0.1)
  569. );
  570. }
  571. &:last-child {
  572. &::after {
  573. width: 0px;
  574. height: 0px;
  575. }
  576. }
  577. }
  578. .mena {
  579. margin-top: 0;
  580. img {
  581. width: 28px;
  582. height: 28px;
  583. }
  584. }
  585. }
  586. .open {
  587. height: 188px;
  588. }
  589. .listIncoAc {
  590. margin-top: 85px;
  591. }
  592. }
  593. }
  594. </style>