func.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="btm-menu">
  3. <img @click.stop="$bus.$emit('changeMenu', 'exhibition')" :src="require(`@/assets/images/proj2022/mobile/menu@2x.png`)" alt="" />
  4. <ul>
  5. <li v-for="(item, i) in menu" :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. </ul>
  12. </div>
  13. </template>
  14. <script>
  15. import { supCount, getsupCount } from "@/config/api";
  16. let menu = [
  17. {
  18. id: "xiangmu",
  19. name: "项目",
  20. img: "project",
  21. cp: "zhanxiang",
  22. },
  23. {
  24. id: "daolan",
  25. name: "导览",
  26. img: "play",
  27. cp: "daolan",
  28. },
  29. {
  30. id: "bgm",
  31. img: "music",
  32. name: "音乐",
  33. },
  34. {
  35. id: "interaction",
  36. name: "互动",
  37. img: "interaction",
  38. cp: "hudong",
  39. },
  40. ];
  41. export default {
  42. props: ["tourStatus"],
  43. data() {
  44. return {
  45. menu,
  46. goodNum: 1099,
  47. isShowGood: false,
  48. isBgm: false,
  49. isShowHuDong: false,
  50. };
  51. },
  52. watch: {
  53. isBgm: {
  54. immediate: true,
  55. handler: function(newVal) {
  56. this.$bus.$emit("toggleHomeBgm", newVal);
  57. // !newVal ? this.$refs.vbgm.pause() : this.$refs.vbgm.play();
  58. },
  59. },
  60. isShowHuDong(newVal){
  61. this.$bus.$emit("changeShowfunc", newVal);
  62. },
  63. tourStatus(newVal) {
  64. if (newVal) {
  65. this.isBgm = false;
  66. } else {
  67. let status = localStorage.getItem("g_bgmstatus");
  68. if (status === "open") {
  69. this.isBgm = true;
  70. }
  71. }
  72. },
  73. },
  74. methods: {
  75. onClick(item) {
  76. if (item.id=='daolan') {
  77. return
  78. }
  79. if (item.id == "xiangmu") {
  80. this.$bus.$emit("emitShowZX", {
  81. show: true,
  82. });
  83. return;
  84. }
  85. if (item.id == "interaction") {
  86. this.isShowHuDong = !this.isShowHuDong
  87. return;
  88. }
  89. item.path && this.$router.push(item.path);
  90. item.cp && this.$bus.$emit("opencp", item.cp);
  91. if (item.id == "bgm") {
  92. this.isBgm = !this.isBgm;
  93. localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
  94. }
  95. item.id == "zan" && this.dianzan();
  96. },
  97. dianzan() {
  98. if (this.isShowGood) return;
  99. getsupCount((res) => {
  100. this.goodNum = res.data;
  101. this.isShowGood = true;
  102. setTimeout(() => {
  103. this.isShowGood = false;
  104. }, 2500);
  105. supCount(() => {});
  106. });
  107. },
  108. toggle() {
  109. let fn = this.tourStatus ? "stopTour" : "startAndPlay";
  110. this.$bus.$emit("ifrMessage", {
  111. events: "toggleTour",
  112. data: fn,
  113. });
  114. },
  115. },
  116. mounted() {
  117. this.isBgm = true;
  118. localStorage.setItem("g_bgmstatus", this.isBgm ? "open" : "close");
  119. this.$nextTick(() => {
  120. this.$bus.$on("toggleBGM", (data) => {
  121. if (!data) {
  122. this.isBgm = data;
  123. } else {
  124. let status = localStorage.getItem("g_bgmstatus");
  125. if (status === "open") {
  126. this.isBgm = data;
  127. }
  128. }
  129. });
  130. });
  131. },
  132. };
  133. </script>
  134. <style lang="less" scoped>
  135. .smenu {
  136. width: 100%;
  137. .sdaolan,
  138. .stoptour {
  139. position: fixed;
  140. cursor: pointer;
  141. bottom: 113px;
  142. width: 45px;
  143. height: 45px;
  144. left: 14px;
  145. border-radius: 50%;
  146. overflow: hidden;
  147. background: rgba(0, 0, 0, 0.4);
  148. &::before {
  149. backdrop-filter: blur(10px) brightness(60%);
  150. }
  151. .daolan {
  152. position: absolute;
  153. top: 52%;
  154. left: 50%;
  155. transform: translate(-50%, -50%);
  156. text-align: center;
  157. > img {
  158. width: 20px;
  159. }
  160. }
  161. }
  162. .stoptour {
  163. .daolan {
  164. position: absolute;
  165. top: 54%;
  166. left: 50%;
  167. transform: translate(-50%, -50%);
  168. text-align: center;
  169. > img {
  170. width: 24px;
  171. }
  172. }
  173. }
  174. .btm-menu {
  175. position: fixed;
  176. bottom: 0%;
  177. left: 0%;
  178. z-index: 999;
  179. width: 100%;
  180. height: 103px;
  181. background-image: url("~@/assets/images/proj2022/mobile/tab@2x.png");
  182. background-size: 100% auto;
  183. background-repeat: no-repeat;
  184. background-position: bottom left;
  185. > img {
  186. position: absolute;
  187. top: -10px;
  188. left: 10px;
  189. width: 12%;
  190. }
  191. .brightness {
  192. &::before {
  193. backdrop-filter: blur(10px) brightness(60%);
  194. }
  195. }
  196. > ul {
  197. width: 100%;
  198. height: 50%;
  199. display: flex;
  200. justify-content: flex-end;
  201. align-items: center;
  202. text-align: center;
  203. z-index: 9999;
  204. position: absolute;
  205. bottom: 10px;
  206. left: 0;
  207. > li {
  208. display: inline-block;
  209. padding: 0 0;
  210. width: 10%;
  211. margin: 0 5%;
  212. > div {
  213. > img {
  214. width: 100%;
  215. opacity: 0.6;
  216. }
  217. > span {
  218. font-size: 12px;
  219. color: rgba(255, 255, 255, 0.6);
  220. transform: scale(0.9) translateY(-10px);
  221. display: inline-block;
  222. }
  223. }
  224. .active {
  225. position: relative;
  226. &::after {
  227. content: "";
  228. width: 20px;
  229. height: 20px;
  230. display: inline-block;
  231. position: absolute;
  232. background-color: #fff;
  233. border-radius: 50%;
  234. top: 10%;
  235. left: 50%;
  236. transform: translateX(-50%);
  237. filter: blur(7px);
  238. }
  239. > img {
  240. opacity: 1;
  241. }
  242. > span {
  243. color: rgba(255, 255, 255, 1);
  244. }
  245. }
  246. }
  247. }
  248. }
  249. }
  250. .likeAddAnimate-enter-active,
  251. .likeAddAnimate-leave-active {
  252. transition: all 2.5s ease;
  253. }
  254. .likeAddAnimate-enter,
  255. .likeAddAnimate-leave {
  256. transform: translate(-50%, 0) scale(0);
  257. opacity: 0;
  258. }
  259. .likeAddAnimate-enter-to,
  260. .likeAddAnimate-leave-to {
  261. transform: translate(-50%, -80px) scale(1.2);
  262. opacity: 1;
  263. }
  264. .good {
  265. position: fixed;
  266. bottom: 60px;
  267. left: 50%;
  268. display: flex;
  269. .pic {
  270. width: 35px;
  271. > img {
  272. width: 100%;
  273. height: 100%;
  274. }
  275. }
  276. .num {
  277. margin-top: 10px;
  278. margin-left: 10px;
  279. }
  280. }
  281. .noshow {
  282. position: fixed;
  283. top: -100px;
  284. left: -100px;
  285. opacity: 0;
  286. visibility: hidden;
  287. }
  288. </style>