func.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div class="btm-menu">
  3. <img @click.stop="$bus.$emit('changeMenu', 'exhibition')" :src="require(`@/assets/images/proj2022/mobile/menu.png`)" alt="" />
  4. <ul>
  5. <li v-for="(item, i) in fixMenu" :key="i">
  6. <div :class="{ active: (i == 3 && isShowHuDong) || (item.id == 'bgm' && isBgm) }" @click="onClick(item)">
  7. <img :src="require(`@/assets/images/proj2022/mobile/menu/${item.img}.png`)" alt="" />
  8. <span>{{ item.name }}</span>
  9. </div>
  10. </li>
  11. <transition name="likeAddAnimate">
  12. <div class="good" v-show="isShowGood">
  13. <div class="pic">
  14. <img :src="require(`@/assets/images/proj2022/mobile/like_${theme}.png`)" alt="" />
  15. </div>
  16. <div class="num">+{{ goodNum + 1 }}</div>
  17. </div>
  18. </transition>
  19. </ul>
  20. </div>
  21. </template>
  22. <script>
  23. import { supCount, getsupCount } from "@/config/api";
  24. let menu = [
  25. {
  26. id: "xiangmu",
  27. name: "项目",
  28. img: "project",
  29. cp: "zhanxiang",
  30. },
  31. {
  32. id: "daolan",
  33. name: "导览",
  34. img: "play",
  35. cp: "daolan",
  36. },
  37. {
  38. id: "bgm",
  39. img: "music",
  40. name: "音乐",
  41. },
  42. {
  43. id: "interaction",
  44. name: "互动",
  45. img: "interaction",
  46. cp: "hudong",
  47. },
  48. ];
  49. let landmenu = [
  50. {
  51. id: "xiangmu",
  52. name: "项目",
  53. img: "project",
  54. cp: "zhanxiang",
  55. },
  56. {
  57. id: "daolan",
  58. name: "导览",
  59. img: "play",
  60. cp: "daolan",
  61. },
  62. {
  63. id: "bgm",
  64. img: "music",
  65. name: "音乐",
  66. },
  67. {
  68. id: "daka",
  69. name: "打卡",
  70. img: "record",
  71. cp: "daka",
  72. },
  73. {
  74. id: "content",
  75. name: "评论",
  76. img: "message",
  77. cp: "vcontent",
  78. },
  79. {
  80. id: "zan",
  81. img: "like",
  82. name: "点赞",
  83. },
  84. {
  85. id: "qrcode",
  86. name: "分享",
  87. img: "share",
  88. cp: "qrcode",
  89. },
  90. ];
  91. export default {
  92. props: ["tourStatus"],
  93. data() {
  94. let bgmAudio = new Audio();
  95. bgmAudio.src = require(`@/assets/audio/bgm.mp3`);
  96. bgmAudio.loop = true;
  97. return {
  98. menu,
  99. goodNum: 0,
  100. isShowGood: false,
  101. isBgm: false,
  102. bgmAudio,
  103. isShowHuDong: false,
  104. };
  105. },
  106. computed: {
  107. fixMenu() {
  108. return this.g_isLandscape ? landmenu : menu;
  109. },
  110. },
  111. watch: {
  112. isBgm: {
  113. immediate: true,
  114. handler: function(newVal) {
  115. !newVal ? this.bgmAudio.pause() : this.bgmAudio.play();
  116. },
  117. },
  118. isShowHuDong(newVal) {
  119. this.$bus.$emit("changeShowfunc", newVal);
  120. },
  121. tourStatus(newVal) {
  122. if (newVal) {
  123. this.isBgm = false;
  124. } else {
  125. let status = localStorage.getItem("g_bgmstatus");
  126. if (status === "open") {
  127. this.isBgm = true;
  128. } else {
  129. this.isBgm = false;
  130. }
  131. }
  132. },
  133. },
  134. beforeDestroy() {
  135. this.bgmAudio.pause();
  136. this.bgmAudio = null;
  137. },
  138. methods: {
  139. onClick(item) {
  140. if (item.id == "daolan") {
  141. this.$emit("play");
  142. console.log(11111);
  143. return;
  144. }
  145. if (item.id == "xiangmu") {
  146. this.$bus.$emit("emitShowZX", {
  147. show: true,
  148. });
  149. return;
  150. }
  151. if (item.id == "interaction") {
  152. this.isShowHuDong = !this.isShowHuDong;
  153. return;
  154. }
  155. item.path && this.$router.push(item.path);
  156. item.cp && this.$bus.$emit("opencp", item.cp);
  157. if (item.id == "bgm") {
  158. this.isBgm = !this.isBgm;
  159. localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
  160. }
  161. item.id == "zan" && this.dianzan();
  162. },
  163. dianzan() {
  164. if (this.isShowGood) return;
  165. getsupCount((res) => {
  166. this.goodNum = res.data;
  167. this.isShowGood = true;
  168. setTimeout(() => {
  169. this.isShowGood = false;
  170. }, 2500);
  171. supCount(() => {});
  172. });
  173. },
  174. toggle() {
  175. let fn = this.tourStatus ? "stopTour" : "startAndPlay";
  176. this.$bus.$emit("ifrMessage", {
  177. events: "toggleTour",
  178. data: fn,
  179. });
  180. },
  181. },
  182. mounted() {
  183. this.isBgm = false;
  184. localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
  185. this.$nextTick(() => {
  186. setTimeout(() => {
  187. if (this.bgmAudio.paused) {
  188. this.isBgm = false;
  189. localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
  190. }
  191. this.$bus.$on("toggleBGM", (data) => {
  192. if (!data) {
  193. this.isBgm = data;
  194. } else {
  195. let status = localStorage.getItem("g_bgmstatus");
  196. if (status === "open") {
  197. this.isBgm = data;
  198. }
  199. }
  200. });
  201. });
  202. this.$bus.$on("isShowHuDong", (data) => {
  203. this.isShowHuDong = data;
  204. });
  205. });
  206. },
  207. };
  208. </script>
  209. <style lang="less" scoped>
  210. .smenu {
  211. width: 100%;
  212. .sdaolan,
  213. .stoptour {
  214. position: fixed;
  215. cursor: pointer;
  216. bottom: 113px;
  217. width: 45px;
  218. height: 45px;
  219. left: 14px;
  220. border-radius: 50%;
  221. overflow: hidden;
  222. background: rgba(0, 0, 0, 0.4);
  223. &::before {
  224. backdrop-filter: blur(10px) brightness(60%);
  225. }
  226. .daolan {
  227. position: absolute;
  228. top: 52%;
  229. left: 50%;
  230. transform: translate(-50%, -50%);
  231. text-align: center;
  232. > img {
  233. width: 20px;
  234. }
  235. }
  236. }
  237. .stoptour {
  238. .daolan {
  239. position: absolute;
  240. top: 54%;
  241. left: 50%;
  242. transform: translate(-50%, -50%);
  243. text-align: center;
  244. > img {
  245. width: 24px;
  246. }
  247. }
  248. }
  249. .btm-menu {
  250. position: fixed;
  251. bottom: 0%;
  252. left: 0%;
  253. z-index: 999;
  254. width: 100%;
  255. height: 103px;
  256. background-image: url("~@/assets/images/proj2022/mobile/tab.png");
  257. background-size: 100% auto;
  258. background-repeat: no-repeat;
  259. background-position: bottom left;
  260. > img {
  261. position: absolute;
  262. top: -10px;
  263. left: 10px;
  264. width: 12%;
  265. }
  266. .brightness {
  267. &::before {
  268. backdrop-filter: blur(10px) brightness(60%);
  269. }
  270. }
  271. > ul {
  272. width: 100%;
  273. height: 50%;
  274. display: flex;
  275. justify-content: flex-end;
  276. align-items: center;
  277. text-align: center;
  278. z-index: 9999;
  279. position: absolute;
  280. bottom: 10px;
  281. left: 0;
  282. > li {
  283. display: inline-block;
  284. padding: 0 0;
  285. width: 10%;
  286. margin: 0 5%;
  287. > div {
  288. > img {
  289. width: 100%;
  290. opacity: 0.6;
  291. }
  292. > span {
  293. font-size: 12px;
  294. color: rgba(255, 255, 255, 0.6);
  295. transform: scale(0.9) translateY(-10px);
  296. display: inline-block;
  297. }
  298. }
  299. .active {
  300. position: relative;
  301. &::after {
  302. content: "";
  303. width: 20px;
  304. height: 20px;
  305. display: inline-block;
  306. position: absolute;
  307. background-color: #fff;
  308. border-radius: 50%;
  309. top: 10%;
  310. left: 50%;
  311. transform: translateX(-50%);
  312. filter: blur(7px);
  313. }
  314. > img {
  315. opacity: 1;
  316. }
  317. > span {
  318. color: rgba(255, 255, 255, 1);
  319. }
  320. }
  321. }
  322. }
  323. }
  324. }
  325. .likeAddAnimate-enter-active,
  326. .likeAddAnimate-leave-active {
  327. transition: all 2.5s ease;
  328. }
  329. .likeAddAnimate-enter,
  330. .likeAddAnimate-leave {
  331. transform: translate(-50%, 0) scale(0);
  332. opacity: 0;
  333. }
  334. .likeAddAnimate-enter-to,
  335. .likeAddAnimate-leave-to {
  336. transform: translate(-50%, -60px) scale(1.1);
  337. opacity: 1;
  338. }
  339. .good {
  340. position: absolute;
  341. bottom: 0px;
  342. right: 10%;
  343. display: flex;
  344. .pic {
  345. width: 35px;
  346. > img {
  347. width: 100%;
  348. height: 100%;
  349. }
  350. }
  351. .num {
  352. margin-top: 10px;
  353. }
  354. }
  355. .noshow {
  356. position: fixed;
  357. top: -100px;
  358. left: -100px;
  359. opacity: 0;
  360. visibility: hidden;
  361. }
  362. /*横屏*/
  363. @media screen and (orientation: landscape) {
  364. .smenu {
  365. width: 100%;
  366. .sdaolan,
  367. .stoptour {
  368. position: fixed;
  369. cursor: pointer;
  370. bottom: 113px;
  371. width: 45px;
  372. height: 45px;
  373. left: 14px;
  374. border-radius: 50%;
  375. overflow: hidden;
  376. background: rgba(0, 0, 0, 0.4);
  377. &::before {
  378. backdrop-filter: blur(10px) brightness(60%);
  379. }
  380. .daolan {
  381. position: absolute;
  382. top: 52%;
  383. left: 50%;
  384. transform: translate(-50%, -50%);
  385. text-align: center;
  386. > img {
  387. width: 20px;
  388. }
  389. }
  390. }
  391. .stoptour {
  392. .daolan {
  393. position: absolute;
  394. top: 54%;
  395. left: 50%;
  396. transform: translate(-50%, -50%);
  397. text-align: center;
  398. > img {
  399. width: 24px;
  400. }
  401. }
  402. }
  403. .btm-menu {
  404. position: fixed;
  405. bottom: 0%;
  406. left: 0%;
  407. z-index: 999;
  408. width: 100%;
  409. height: 110px !important;
  410. background-image: url("~@/assets/images/proj2022/mobile/hengping.png") !important;
  411. background-size: 100% auto;
  412. background-repeat: no-repeat;
  413. background-position: bottom left;
  414. > img {
  415. position: absolute;
  416. top: 0;
  417. left: 10px;
  418. width: 60px !important;
  419. }
  420. .brightness {
  421. &::before {
  422. backdrop-filter: blur(10px) brightness(60%);
  423. }
  424. }
  425. > ul {
  426. width: 76% !important;
  427. height: 50%;
  428. display: flex;
  429. justify-content: flex-end;
  430. align-items: flex-end !important;
  431. text-align: center;
  432. z-index: 9999;
  433. position: absolute;
  434. bottom: 0 !important;
  435. left: 50%;
  436. transform: translateX(-50%) !important;
  437. > li {
  438. display: inline-block;
  439. padding: 0 0;
  440. width: 10%;
  441. margin: 0 5%;
  442. > div {
  443. > img {
  444. width: 100%;
  445. opacity: 0.6;
  446. }
  447. > span {
  448. font-size: 12px;
  449. color: rgba(255, 255, 255, 0.6);
  450. transform: scale(0.9) translateY(-10px);
  451. display: inline-block;
  452. }
  453. }
  454. .active {
  455. position: relative;
  456. &::after {
  457. content: "";
  458. width: 20px;
  459. height: 20px;
  460. display: inline-block;
  461. position: absolute;
  462. background-color: #fff;
  463. border-radius: 50%;
  464. top: 10%;
  465. left: 50%;
  466. transform: translateX(-50%);
  467. filter: blur(7px);
  468. }
  469. > img {
  470. opacity: 1;
  471. }
  472. > span {
  473. color: rgba(255, 255, 255, 1);
  474. }
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. </style>