index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="parimaryExhibtion" :class="{ daolanactive: isShow }">
  3. <div class="p-title">
  4. <div class="p-left">{{ Mylangue ? "当前位置" : "Current Position" }}</div>
  5. <div class="p-right">{{ Mylangue ? current.name : current.name2 }}</div>
  6. </div>
  7. <div class="exh-con">
  8. <!-- <img :src="require('@/assets/images/map.png')" /> -->
  9. </div>
  10. <ul class="exhi-list">
  11. <li
  12. @click="handleItem(item.Logo)"
  13. v-for="(item, i) in list"
  14. :key="i"
  15. :class="{ active: item.id === current.id }"
  16. >
  17. {{ Mylangue ? item.name : item.name2 }}
  18. </li>
  19. </ul>
  20. <div class="daolan" @click="isShow = !isShow">
  21. <img :src="require('@/assets/images/icon/daolan.png')" />
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. isShow: true,
  30. list: [
  31. {
  32. id: 1,
  33. name: "负一楼",
  34. name2: "-1F",
  35. pano: "56fa4a8ee09542e69e0e5e763cf3a4eb",
  36. Logo: "1173",
  37. },
  38. {
  39. id: 2,
  40. name: "一楼",
  41. name2: "1F",
  42. Logo: "1171",
  43. pano: "bd279aa2ee3445658d5949ccdc3d0dec",
  44. },
  45. {
  46. id: 3,
  47. name: "二楼",
  48. name2: "2F",
  49. Logo: "1172",
  50. pano: "b2431912b20d4df7b81f47821fca6d1a",
  51. },
  52. ],
  53. current: {},
  54. };
  55. },
  56. methods: {
  57. isShowHide() {
  58. this.isShow = false;
  59. },
  60. // 封装一个隐藏地图的方法,让父组件调用 ↑
  61. handleItem(val) {
  62. // 中文版
  63. if (this.Mylangue) {
  64. window.location.href =
  65. window.location.origin + window.location.pathname + `#/?m=${val}`;
  66. } else
  67. window.location.href =
  68. window.location.origin + window.location.pathname + `#/?m=${val}_1`;
  69. location.reload(true);
  70. },
  71. },
  72. watch: {
  73. isShow(newVal) {
  74. let css = newVal ? "0px" : "-310px";
  75. $(".cad").css({ right: css });
  76. // 展开地图的时候隐藏移动端的菜单
  77. if (newVal) this.$emit("meanMHide");
  78. },
  79. },
  80. mounted() {
  81. this.list.forEach((v) => {
  82. if (window.location.href.includes(v.Logo)) {
  83. this.current = v;
  84. this.$nextTick(() => {
  85. if (v.id === 3) {
  86. // 二楼的线粗细
  87. $("body").addClass("bodyMap2");
  88. $("body").removeClass("bodyMap1");
  89. } else {
  90. // 负一楼和一楼的地图线 粗细
  91. $("body").addClass("bodyMap1");
  92. $("body").removeClass("bodyMap2");
  93. }
  94. });
  95. }
  96. });
  97. },
  98. };
  99. </script>
  100. <style lang="less" scoped>
  101. .parimaryExhibtion {
  102. width: 300px;
  103. transform: translateX(300px);
  104. transition: all 0.3s ease;
  105. color: #fff;
  106. .daolan {
  107. cursor: pointer;
  108. position: absolute;
  109. right: 300px;
  110. background: rgba(0, 0, 0, 0.4);
  111. border-radius: 10px 0px 0px 10px;
  112. border-left: 5px solid #68a0c5;
  113. top: 24%;
  114. padding: 15px 5px;
  115. > img {
  116. width: 16px;
  117. transform: rotate(180deg);
  118. margin-bottom: 4px;
  119. }
  120. }
  121. .p-title {
  122. transform: translateX(-8px);
  123. position: relative;
  124. height: 60px;
  125. color: #fff;
  126. .p-left {
  127. opacity: 0;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. width: 150px;
  132. height: 60px;
  133. background: url("../../assets/img/mapt.png");
  134. background-size: 100% 100%;
  135. font-size: 16px;
  136. padding-top: 10px;
  137. }
  138. .p-right {
  139. border-radius: 8px 22px 0 0;
  140. position: absolute;
  141. bottom: 0;
  142. left: 142px;
  143. width: calc(100% - 134px);
  144. height: 45px;
  145. background-color: rgba(104, 160, 197, 0.5);
  146. flex: 1;
  147. display: flex;
  148. justify-content: center;
  149. align-items: center;
  150. font-size: 16px;
  151. }
  152. }
  153. .exh-con {
  154. background: rgba(0, 0, 0, 0.4);
  155. width: 100%;
  156. height: 200px;
  157. border: 2px solid #68a0c5;
  158. }
  159. .exhi-list {
  160. width: 100%;
  161. display: flex;
  162. > li {
  163. // text-align: center;
  164. background: rgba(0, 0, 0, 0.4);
  165. border-radius: 0 0 5px 5px;
  166. flex: 1;
  167. height: 40px;
  168. line-height: 40px;
  169. text-align: center;
  170. cursor: pointer;
  171. &:hover {
  172. background: #165491;
  173. }
  174. }
  175. .active {
  176. background: #165491;
  177. pointer-events: none;
  178. }
  179. }
  180. }
  181. .exh-con {
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. > img {
  186. width: 80%;
  187. }
  188. }
  189. .daolanactive {
  190. transform: translateX(0);
  191. .p-left {
  192. opacity: 1 !important;
  193. }
  194. .daolan {
  195. > img {
  196. width: 16px;
  197. transform: rotate(0);
  198. margin-bottom: 4px;
  199. }
  200. }
  201. }
  202. @media screen and (max-width: 600px) {
  203. .parimaryExhibtion {
  204. transform: translateX(255px) scale(0.7);
  205. }
  206. .daolanactive {
  207. transform: translateX(45px) scale(0.7);
  208. }
  209. }
  210. </style>