Rbottom.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div class="Rbottom" :style="`${leftList[1].done ? 'bottom:0px' : ''}`">
  3. <audio src="@/assets/media/bacMusic.mp3" loop id="bacMusic"></audio>
  4. <div class="box1">
  5. <div class="mainll mainrr">
  6. <div
  7. v-show="list.length !== 0 || item.type > 2"
  8. @click="leftCutClick(item.type)"
  9. class="row"
  10. :class="{ active2: item.done }"
  11. v-for="item in leftList"
  12. :key="item.type"
  13. >
  14. <img
  15. :src="
  16. require(`@/assets/img/LeftTop/inco${item.type}${
  17. item.done ? 'Ac' : ''
  18. }.png`)
  19. "
  20. alt=""
  21. />
  22. <p>{{ item.name }}</p>
  23. </div>
  24. </div>
  25. <div class="mainrr">
  26. <div
  27. class="row"
  28. @click="rightClisk(item.type)"
  29. v-for="item in rightList"
  30. :key="item.type"
  31. :class="{
  32. active2:
  33. (music && item.type === 2) ||
  34. (like && item.type === 3) ||
  35. (share && item.type === 4) ||
  36. (isFullscreen && item.type === 5),
  37. }"
  38. >
  39. <img
  40. :src="require(`@/assets/img/Goods/inco${item.type}Ac.png`)"
  41. alt=""
  42. v-if="music && item.type === 2"
  43. />
  44. <img
  45. :src="require(`@/assets/img/Goods/inco${item.type}Ac.png`)"
  46. alt=""
  47. v-else-if="like && item.type === 3"
  48. />
  49. <img
  50. :src="require(`@/assets/img/Goods/inco${item.type}Ac.png`)"
  51. alt=""
  52. v-else-if="share && item.type === 4"
  53. />
  54. <img
  55. :src="require(`@/assets/img/Goods/inco${item.type}Ac.png`)"
  56. alt=""
  57. v-else-if="isFullscreen && item.type === 5"
  58. />
  59. <img
  60. :src="require(`@/assets/img/Goods/inco${item.type}.png`)"
  61. alt=""
  62. v-else
  63. />
  64. <transition name="likeAddAnimate">
  65. <div class="likeMove" v-show="like && item.type === 3">+ 1</div>
  66. </transition>
  67. <p>
  68. {{ item.name }}
  69. </p>
  70. </div>
  71. </div>
  72. </div>
  73. <div
  74. class="box2"
  75. :style="`${leftList[1].done ? '' : 'height:0px;padding:0;opacity:0'}`"
  76. >
  77. <div class="swiper-container">
  78. <div class="swiper-wrapper" v-if="list.length">
  79. <div
  80. @click="cutGoods(index)"
  81. class="swiper-slide"
  82. v-for="(item, index) in list[0].list"
  83. :class="{ active: acList === index }"
  84. :key="index"
  85. >
  86. <img :src="item.enter.cover" alt="" />
  87. <!-- <p>666</p> -->
  88. <div
  89. class="plan"
  90. v-show="acList === index"
  91. :style="{ width: progress + '%' }"
  92. ></div>
  93. </div>
  94. <div class="swiper-slide" style="pointer-events: none"></div>
  95. </div>
  96. <div class="swiper-scrollbar"></div>
  97. </div>
  98. </div>
  99. <!-- 分享页面 -->
  100. <div class="shareBox" :class="{ shareBoxShow: share }">
  101. <div class="shareMain">
  102. <div class="close" @click="share = false"></div>
  103. <h3>分享</h3>
  104. <p>
  105. 请使用手机扫描二维码或
  106. <br />
  107. 复制分享链接
  108. </p>
  109. <img src="@/assets/img/Goods/Rcode.jpg" alt="" />
  110. <div class="btnn" @click="copyPcTxt">复制分享链接</div>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import Swiper from "./swiper.js";
  117. export default {
  118. name: "Rbottom",
  119. components: {},
  120. props: ["acList", "progress"],
  121. data() {
  122. //这里存放数据
  123. return {
  124. rightList: [
  125. { name: "首页", type: 1 },
  126. { name: "声音", type: 2 },
  127. { name: "点赞", type: 3 },
  128. { name: "分享", type: 4 },
  129. { name: "全屏", type: 5 },
  130. ],
  131. rightType: "",
  132. music: false,
  133. like: false,
  134. share: false,
  135. isFullscreen: false,
  136. // --------------
  137. leftList: [
  138. { name: "自动漫游", type: 1, done: false },
  139. { name: "场景导览", type: 2, done: false },
  140. { name: "全景漫游", type: 3, done: true },
  141. { name: "迷你模型", type: 4, done: false },
  142. { name: "顶部俯视", type: 5, done: false },
  143. ],
  144. list: [],
  145. Swiper: null,
  146. };
  147. },
  148. //监听属性 类似于data概念
  149. computed: {},
  150. //监控data中的数据变化
  151. watch: {
  152. acList(val) {
  153. let temp = val - 2;
  154. if (temp < 0) temp = 0;
  155. this.Swiper.slideTo(temp);
  156. },
  157. music(val) {
  158. let dom = document.querySelector("#bacMusic");
  159. if (val) dom.play();
  160. else dom.pause();
  161. },
  162. },
  163. //方法集合
  164. methods: {
  165. cutGoods(index) {
  166. this.$emit("daoLanCut", index);
  167. this.leftList[0].done = false;
  168. if (window.bacMusic) {
  169. setTimeout(() => {
  170. this.music = true;
  171. }, 100);
  172. }
  173. },
  174. leftCutClick(type) {
  175. this.$emit("cutKankan", type - 1);
  176. if (type === 1) {
  177. let dom = document.querySelector("#bacMusic");
  178. if (!this.leftList[0].done) {
  179. // 防止多次点击自动漫游
  180. let mainApp = document.querySelector("#app");
  181. mainApp.style.pointerEvents = "none";
  182. // 自动漫游开始的时候的音乐播放状态
  183. window.bacMusic = !dom.paused;
  184. setTimeout(() => {
  185. this.music = false;
  186. }, 200);
  187. } else {
  188. if (window.bacMusic) {
  189. setTimeout(() => {
  190. this.music = true;
  191. }, 100);
  192. }
  193. }
  194. this.leftList[1].done = true;
  195. this.leftList[0].done = !this.leftList[0].done;
  196. } else if (type === 2) {
  197. this.leftList[1].done = !this.leftList[1].done;
  198. } else if (type >= 4) {
  199. this.$emit("stopPlay", true);
  200. }
  201. },
  202. // 给父组件调用的控制音乐播放的方法
  203. opMusic(val) {
  204. this.music = val;
  205. },
  206. // 给父组件操作控制左边按钮的方法
  207. leftCut(index) {
  208. if (index > 2) {
  209. if (window.bacMusic) {
  210. setTimeout(() => {
  211. this.music = true;
  212. }, 100);
  213. }
  214. this.leftList.forEach((v, i) => {
  215. if (i === index) v.done = true;
  216. else v.done = false;
  217. });
  218. } else if (index === -1) {
  219. if (window.bacMusic) {
  220. setTimeout(() => {
  221. this.music = true;
  222. }, 100);
  223. }
  224. this.leftList[0].done = false;
  225. } else if (index === 2) {
  226. this.leftList[2].done = true;
  227. this.leftList[3].done = this.leftList[4].done = false;
  228. }
  229. },
  230. // 点击全屏
  231. fullShow() {
  232. let element = document.documentElement;
  233. if (this.isFullscreen) {
  234. if (document.exitFullscreen) {
  235. document.exitFullscreen();
  236. } else if (document.webkitCancelFullScreen) {
  237. document.webkitCancelFullScreen();
  238. } else if (document.mozCancelFullScreen) {
  239. document.mozCancelFullScreen();
  240. } else if (document.msExitFullscreen) {
  241. document.msExitFullscreen();
  242. }
  243. } else {
  244. if (element.requestFullscreen) {
  245. element.requestFullscreen();
  246. } else if (element.webkitRequestFullScreen) {
  247. element.webkitRequestFullScreen();
  248. } else if (element.mozRequestFullScreen) {
  249. element.mozRequestFullScreen();
  250. } else if (element.msRequestFullscreen) {
  251. element.msRequestFullscreen();
  252. }
  253. }
  254. // 改变当前全屏状态
  255. this.isFullscreen = !this.isFullscreen;
  256. },
  257. rightClisk(type) {
  258. if (type === 1) window.location.replace("/YHT/index.html");
  259. else if (type === 2) {
  260. let dom = document.querySelector("#bacMusic");
  261. window.bacMusic = dom.paused;
  262. this.music = !this.music;
  263. this.$emit("stopPlay");
  264. } else if (type === 3) {
  265. if (this.like) return;
  266. this.like = true;
  267. setTimeout(() => {
  268. this.like = false;
  269. }, 2000);
  270. } else if (type === 4) {
  271. this.$emit("stopPlay");
  272. this.share = true;
  273. } else this.fullShow();
  274. },
  275. //点击复制链接
  276. copyPcTxt() {
  277. // 存储传递过来的数据
  278. let OrderNumber = window.location.origin;
  279. // 创建一个input 元素
  280. // createElement() 方法通过指定名称创建一个元素
  281. let newInput = document.createElement("input");
  282. // 讲存储的数据赋值给input的value值
  283. newInput.value = OrderNumber;
  284. // appendChild() 方法向节点添加最后一个子节点。
  285. document.body.appendChild(newInput);
  286. // 选中input元素中的文本
  287. // select() 方法用于选择该元素中的文本。
  288. newInput.select();
  289. // 执行浏览器复制命令
  290. // execCommand方法是执行一个对当前文档,当前选择或者给出范围的命令
  291. document.execCommand("Copy");
  292. // 清空输入框
  293. newInput.remove();
  294. alert("复制成功");
  295. },
  296. // 初始化轮播图
  297. baseSw(data) {
  298. this.list = data;
  299. this.$nextTick(() => {
  300. this.Swiper = new Swiper(".swiper-container", {
  301. slidesPerView: 9,
  302. spaceBetween: 25,
  303. scrollbar: {
  304. el: ".swiper-scrollbar",
  305. },
  306. });
  307. });
  308. },
  309. },
  310. //生命周期 - 创建完成(可以访问当前this实例)
  311. created() {},
  312. //生命周期 - 挂载完成(可以访问DOM元素)
  313. mounted() {
  314. // 监听esc事件
  315. document.addEventListener("webkitfullscreenchange", (e) => {
  316. if (!e.currentTarget.webkitIsFullScreen) this.isFullscreen = false;
  317. });
  318. document.addEventListener("fullscreenchange", (e) => {
  319. if (!document.fullscreenElement) this.isFullscreen = false;
  320. });
  321. document.addEventListener("MSFullscreenChange", (e) => {
  322. if (!document.msFullscreenElement) this.isFullscreen = false;
  323. });
  324. document.addEventListener("mozfullscreenchange", (e) => {
  325. if (!document.mozFullScreenElement) this.isFullscreen = false;
  326. });
  327. },
  328. beforeCreate() {}, //生命周期 - 创建之前
  329. beforeMount() {}, //生命周期 - 挂载之前
  330. beforeUpdate() {}, //生命周期 - 更新之前
  331. updated() {}, //生命周期 - 更新之后
  332. beforeDestroy() {}, //生命周期 - 销毁之前
  333. destroyed() {}, //生命周期 - 销毁完成
  334. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  335. };
  336. </script>
  337. <style lang='less' scoped>
  338. .swiper-scrollbar {
  339. height: 4px;
  340. background-color: #fff;
  341. overflow: hidden;
  342. }
  343. /deep/.swiper-scrollbar-drag {
  344. background-color: #930909;
  345. }
  346. @import "./swiper.css";
  347. .likeAddAnimate-enter-active,
  348. .likeAddAnimate-leave-active {
  349. transition: all 2s ease;
  350. }
  351. .likeAddAnimate-enter,
  352. .likeAddAnimate-leave {
  353. transform: translateY(0) scale(0);
  354. opacity: 0;
  355. }
  356. .likeAddAnimate-enter-to,
  357. .likeAddAnimate-leave-to {
  358. transform: translateY(-50px) scale(1.2);
  359. opacity: 1;
  360. }
  361. .Rbottom {
  362. transition: all 0.5s;
  363. z-index: 10;
  364. position: absolute;
  365. bottom: 24px;
  366. right: 0px;
  367. width: 100%;
  368. .box1 {
  369. padding: 0 25px;
  370. width: 100%;
  371. display: flex;
  372. justify-content: space-between;
  373. .mainrr {
  374. display: flex;
  375. .row {
  376. position: relative;
  377. cursor: pointer;
  378. width: 50px;
  379. text-align: center;
  380. margin-left: 18px;
  381. color: #fff;
  382. & > img {
  383. width: 50px;
  384. }
  385. p {
  386. font-size: 12px;
  387. }
  388. .likeMove {
  389. color: #930909;
  390. position: absolute;
  391. top: 10px;
  392. width: 100%;
  393. text-align: center;
  394. }
  395. }
  396. .active2 {
  397. color: #930909;
  398. font-weight: 700;
  399. p {
  400. font-size: 12px;
  401. }
  402. }
  403. }
  404. .mainll {
  405. .row {
  406. width: 80px;
  407. margin-left: 0;
  408. }
  409. }
  410. }
  411. .box2 {
  412. overflow: hidden;
  413. transition: height 0.5s;
  414. margin-top: 5px;
  415. width: 100%;
  416. height: 150px;
  417. background-color: #d8b275;
  418. padding: 15px 25px 0;
  419. .swiper-container {
  420. cursor: grab;
  421. height: 100%;
  422. .swiper-slide {
  423. cursor: pointer;
  424. height: 120px;
  425. img {
  426. width: 100%;
  427. height: 110px;
  428. object-fit: cover;
  429. }
  430. p {
  431. text-align: center;
  432. height: 30px;
  433. line-height: 30px;
  434. color: #ffffff;
  435. font-size: 14px;
  436. }
  437. .plan {
  438. height: 4px;
  439. background-color: #930909;
  440. }
  441. }
  442. .active {
  443. img {
  444. border: 3px solid #930909;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. .shareBox {
  451. z-index: 11;
  452. position: fixed;
  453. top: 0;
  454. left: 0;
  455. width: 100%;
  456. height: 100%;
  457. opacity: 0;
  458. pointer-events: none;
  459. backdrop-filter: blur(4px);
  460. transition: opacity 0.5s;
  461. .shareMain {
  462. padding: 40px 30px 0;
  463. position: absolute;
  464. top: 50%;
  465. left: 50%;
  466. transform: translate(-50%, -50%);
  467. width: 450px;
  468. height: 650px;
  469. background-image: url("../assets/img/Goods/shareBac.png");
  470. background-size: 100% 100%;
  471. text-align: center;
  472. .close {
  473. width: 48px;
  474. height: 48px;
  475. cursor: pointer;
  476. position: absolute;
  477. right: -24px;
  478. top: -24px;
  479. background-image: url("../assets/img/Goods/shareClose.png");
  480. background-size: 100% 100%;
  481. }
  482. h3 {
  483. text-align: left;
  484. color: #d8b275;
  485. font-size: 24px;
  486. margin-bottom: 50px;
  487. }
  488. p {
  489. font-size: 20px;
  490. color: #ffffff;
  491. margin-bottom: 40px;
  492. }
  493. img {
  494. width: 240px;
  495. margin-bottom: 50px;
  496. }
  497. .btnn {
  498. cursor: pointer;
  499. width: 280px;
  500. margin: 0 auto;
  501. height: 60px;
  502. border-radius: 30px;
  503. border: 2px solid #d8b275;
  504. line-height: 58px;
  505. font-size: 20px;
  506. color: #ffffff;
  507. }
  508. }
  509. }
  510. .shareBoxShow {
  511. opacity: 1;
  512. pointer-events: auto;
  513. }
  514. </style>