123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- <template>
- <div class="btm-menu">
- <img @click.stop="$bus.$emit('changeMenu', 'exhibition')" :src="require(`@/assets/images/proj2022/mobile/menu.png`)" alt="" />
- <ul>
- <li v-for="(item, i) in fixMenu" :key="i">
- <div :class="{ active: (i == 3 && isShowHuDong) || (item.id == 'bgm' && isBgm) }" @click="onClick(item)">
- <img :src="require(`@/assets/images/proj2022/mobile/menu/${item.img}.png`)" alt="" />
- <span>{{ item.name }}</span>
- </div>
- </li>
- <transition name="likeAddAnimate">
- <div class="good" v-show="isShowGood">
- <div class="pic">
- <img :src="require(`@/assets/images/proj2022/mobile/like_${theme}.png`)" alt="" />
- </div>
- <div class="num">+{{ goodNum + 1 }}</div>
- </div>
- </transition>
- </ul>
- </div>
- </template>
- <script>
- import { supCount, getsupCount } from "@/config/api";
- let menu = [
- {
- id: "xiangmu",
- name: "项目",
- img: "project",
- cp: "zhanxiang",
- },
- {
- id: "daolan",
- name: "导览",
- img: "play",
- cp: "daolan",
- },
- {
- id: "bgm",
- img: "music",
- name: "音乐",
- },
- {
- id: "interaction",
- name: "互动",
- img: "interaction",
- cp: "hudong",
- },
- ];
- let landmenu = [
- {
- id: "xiangmu",
- name: "项目",
- img: "project",
- cp: "zhanxiang",
- },
- {
- id: "daolan",
- name: "导览",
- img: "play",
- cp: "daolan",
- },
- {
- id: "bgm",
- img: "music",
- name: "音乐",
- },
- {
- id: "daka",
- name: "打卡",
- img: "record",
- cp: "daka",
- },
- {
- id: "content",
- name: "评论",
- img: "message",
- cp: "vcontent",
- },
- {
- id: "zan",
- img: "like",
- name: "点赞",
- },
- {
- id: "qrcode",
- name: "分享",
- img: "share",
- cp: "qrcode",
- },
- ];
- export default {
- props: ["tourStatus"],
- data() {
- let bgmAudio = new Audio();
- bgmAudio.src = require(`@/assets/audio/bgm.mp3`);
- bgmAudio.loop = true;
- return {
- menu,
- goodNum: 0,
- isShowGood: false,
- isBgm: false,
- bgmAudio,
- isShowHuDong: false,
- };
- },
- computed: {
- fixMenu() {
- return this.g_isLandscape ? landmenu : menu;
- },
- },
- watch: {
- isBgm: {
- immediate: true,
- handler: function(newVal) {
- !newVal ? this.bgmAudio.pause() : this.bgmAudio.play();
- },
- },
- isShowHuDong(newVal) {
- this.$bus.$emit("changeShowfunc", newVal);
- },
- tourStatus(newVal) {
- if (newVal) {
- this.isBgm = false;
- } else {
- let status = localStorage.getItem("g_bgmstatus");
- if (status === "open") {
- this.isBgm = true;
- } else {
- this.isBgm = false;
- }
- }
- },
- },
- beforeDestroy() {
- this.bgmAudio.pause();
- this.bgmAudio = null;
- },
- methods: {
- onClick(item) {
- if (item.id == "daolan") {
- this.$emit("play");
- console.log(11111);
- return;
- }
- if (item.id == "xiangmu") {
- this.$bus.$emit("emitShowZX", {
- show: true,
- });
- return;
- }
- if (item.id == "interaction") {
- this.isShowHuDong = !this.isShowHuDong;
- return;
- }
- item.path && this.$router.push(item.path);
- item.cp && this.$bus.$emit("opencp", item.cp);
- if (item.id == "bgm") {
- this.isBgm = !this.isBgm;
- localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
- }
- item.id == "zan" && this.dianzan();
- },
- dianzan() {
- if (this.isShowGood) return;
- getsupCount((res) => {
- this.goodNum = res.data;
- this.isShowGood = true;
- setTimeout(() => {
- this.isShowGood = false;
- }, 2500);
- supCount(() => {});
- });
- },
- toggle() {
- let fn = this.tourStatus ? "stopTour" : "startAndPlay";
- this.$bus.$emit("ifrMessage", {
- events: "toggleTour",
- data: fn,
- });
- },
- },
- mounted() {
- this.isBgm = false;
- localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
- this.$nextTick(() => {
- setTimeout(() => {
- if (this.bgmAudio.paused) {
- this.isBgm = false;
- localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
- }
- this.$bus.$on("toggleBGM", (data) => {
- if (!data) {
- this.isBgm = data;
- } else {
- let status = localStorage.getItem("g_bgmstatus");
- if (status === "open") {
- this.isBgm = data;
- }
- }
- });
- });
- this.$bus.$on("isShowHuDong", (data) => {
- this.isShowHuDong = data;
- });
- });
- },
- };
- </script>
- <style lang="less" scoped>
- .smenu {
- width: 100%;
- .sdaolan,
- .stoptour {
- position: fixed;
- cursor: pointer;
- bottom: 113px;
- width: 45px;
- height: 45px;
- left: 14px;
- border-radius: 50%;
- overflow: hidden;
- background: rgba(0, 0, 0, 0.4);
- &::before {
- backdrop-filter: blur(10px) brightness(60%);
- }
- .daolan {
- position: absolute;
- top: 52%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- > img {
- width: 20px;
- }
- }
- }
- .stoptour {
- .daolan {
- position: absolute;
- top: 54%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- > img {
- width: 24px;
- }
- }
- }
- .btm-menu {
- position: fixed;
- bottom: 0%;
- left: 0%;
- z-index: 999;
- width: 100%;
- height: 103px;
- background-image: url("~@/assets/images/proj2022/mobile/tab.png");
- background-size: 100% auto;
- background-repeat: no-repeat;
- background-position: bottom left;
- > img {
- position: absolute;
- top: -10px;
- left: 10px;
- width: 12%;
- }
- .brightness {
- &::before {
- backdrop-filter: blur(10px) brightness(60%);
- }
- }
- > ul {
- width: 100%;
- height: 50%;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- text-align: center;
- z-index: 9999;
- position: absolute;
- bottom: 10px;
- left: 0;
- > li {
- display: inline-block;
- padding: 0 0;
- width: 10%;
- margin: 0 5%;
- > div {
- > img {
- width: 100%;
- opacity: 0.6;
- }
- > span {
- font-size: 12px;
- color: rgba(255, 255, 255, 0.6);
- transform: scale(0.9) translateY(-10px);
- display: inline-block;
- }
- }
- .active {
- position: relative;
- &::after {
- content: "";
- width: 20px;
- height: 20px;
- display: inline-block;
- position: absolute;
- background-color: #fff;
- border-radius: 50%;
- top: 10%;
- left: 50%;
- transform: translateX(-50%);
- filter: blur(7px);
- }
- > img {
- opacity: 1;
- }
- > span {
- color: rgba(255, 255, 255, 1);
- }
- }
- }
- }
- }
- }
- .likeAddAnimate-enter-active,
- .likeAddAnimate-leave-active {
- transition: all 2.5s ease;
- }
- .likeAddAnimate-enter,
- .likeAddAnimate-leave {
- transform: translate(-50%, 0) scale(0);
- opacity: 0;
- }
- .likeAddAnimate-enter-to,
- .likeAddAnimate-leave-to {
- transform: translate(-50%, -60px) scale(1.1);
- opacity: 1;
- }
- .good {
- position: absolute;
- bottom: 0px;
- right: 10%;
- display: flex;
- .pic {
- width: 35px;
- > img {
- width: 100%;
- height: 100%;
- }
- }
- .num {
- margin-top: 10px;
- }
- }
- .noshow {
- position: fixed;
- top: -100px;
- left: -100px;
- opacity: 0;
- visibility: hidden;
- }
- /*横屏*/
- @media screen and (orientation: landscape) {
- .smenu {
- width: 100%;
- .sdaolan,
- .stoptour {
- position: fixed;
- cursor: pointer;
- bottom: 113px;
- width: 45px;
- height: 45px;
- left: 14px;
- border-radius: 50%;
- overflow: hidden;
- background: rgba(0, 0, 0, 0.4);
- &::before {
- backdrop-filter: blur(10px) brightness(60%);
- }
- .daolan {
- position: absolute;
- top: 52%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- > img {
- width: 20px;
- }
- }
- }
- .stoptour {
- .daolan {
- position: absolute;
- top: 54%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- > img {
- width: 24px;
- }
- }
- }
- .btm-menu {
- position: fixed;
- bottom: 0%;
- left: 0%;
- z-index: 999;
- width: 100%;
- height: 110px !important;
- background-image: url("~@/assets/images/proj2022/mobile/hengping.png") !important;
- background-size: 100% auto;
- background-repeat: no-repeat;
- background-position: bottom left;
- > img {
- position: absolute;
- top: 0;
- left: 10px;
- width: 60px !important;
- }
- .brightness {
- &::before {
- backdrop-filter: blur(10px) brightness(60%);
- }
- }
- > ul {
- width: 76% !important;
- height: 50%;
- display: flex;
- justify-content: flex-end;
- align-items: flex-end !important;
- text-align: center;
- z-index: 9999;
- position: absolute;
- bottom: 0 !important;
- left: 50%;
- transform: translateX(-50%) !important;
- > li {
- display: inline-block;
- padding: 0 0;
- width: 10%;
- margin: 0 5%;
- > div {
- > img {
- width: 100%;
- opacity: 0.6;
- }
- > span {
- font-size: 12px;
- color: rgba(255, 255, 255, 0.6);
- transform: scale(0.9) translateY(-10px);
- display: inline-block;
- }
- }
- .active {
- position: relative;
- &::after {
- content: "";
- width: 20px;
- height: 20px;
- display: inline-block;
- position: absolute;
- background-color: #fff;
- border-radius: 50%;
- top: 10%;
- left: 50%;
- transform: translateX(-50%);
- filter: blur(7px);
- }
- > img {
- opacity: 1;
- }
- > span {
- color: rgba(255, 255, 255, 1);
- }
- }
- }
- }
- }
- }
- }
- </style>
|