index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="parimaryExhibtion" :class="{ daolanactive: isShow }">
  3. <div class="p-title">
  4. <div class="ptleft" @click="loadother">
  5. <img
  6. class="pbg"
  7. :src="require(`@/assets/images/project/exb.png`)"
  8. alt=""
  9. />
  10. <img
  11. class="lg"
  12. :src="require(`@/assets/images/project/hospital.png`)"
  13. alt=""
  14. />
  15. <span>当前位置</span>
  16. </div>
  17. <div class="ptright">
  18. <span> {{ currentName.split(" ")[0] }}</span>
  19. </div>
  20. </div>
  21. <div class="exh-con">
  22. <!-- <img :src="require('@/assets/images/map.png')"> -->
  23. </div>
  24. <ul class="exhi-list">
  25. <li :class="{active:item.name == currentName}" @click="handleItem(item)" v-for="(item, i) in list" :key="i">
  26. {{ item.name }}
  27. <img :src="require(`@/assets/images/project/star_active.png`)" alt="" />
  28. </li>
  29. </ul>
  30. <div class="daolan" @click="isShow = !isShow">
  31. <img :src="require('@/assets/images/icon/daolan.png')" />
  32. <span>{{ isShow ? "收起" : "展开" }}导览</span>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import { data, region } from "./data";
  38. export default {
  39. data() {
  40. return {
  41. isShow: false,
  42. currentScene:data[1],
  43. list: data[1].list,
  44. currentName: data[1].current.name,
  45. };
  46. },
  47. computed:{
  48. },
  49. mounted() {
  50. this.$bus.$on("floorchanged",res=>{
  51. this.currentScene = data[res]
  52. this.list = data[res].list
  53. this.currentName= data[res].current.name
  54. })
  55. this.$bus.$on("flyingEnded",res=>{
  56. let retmp =Object.keys(region)
  57. for (let i = 0; i < retmp.length; i++) {
  58. let item = retmp[i];
  59. if(region[item].find(sub=>sub == res.id)) {
  60. this.currentName = item
  61. return
  62. }
  63. }
  64. })
  65. },
  66. methods: {
  67. loadother() {
  68. $.ajax({
  69. url: "static/data/second_floor.json",
  70. method: "GET",
  71. success(res) {
  72. grendCAD(
  73. res,
  74. document.documentElement,
  75. "#4f7d71",
  76. "#fcf5d3",
  77. "1px",
  78. "cad1"
  79. );
  80. },
  81. });
  82. },
  83. handleItem(item) {
  84. this.currentName = item.name;
  85. let { x, y, z, w } = item.quaternion;
  86. item.pano &&
  87. player.blackToPano({
  88. pano: player.model.panos.index[item.pano],
  89. quaternion: new THREE.Quaternion(x, y, z, w),
  90. });
  91. },
  92. },
  93. watch: {
  94. isShow(newVal) {
  95. let css = newVal ? 8 : -260;
  96. $(".cad1").css({ right: css + "px" });
  97. if (window.number == "1149_2") {
  98. $(".cad").css({ right: css - 30 + "px" });
  99. $(".cad1").css({ right: css + "px" });
  100. } else {
  101. $(".cad").css({ right: css + "px" });
  102. }
  103. },
  104. },
  105. };
  106. </script>
  107. <style lang="less" scoped>
  108. .parimaryExhibtion {
  109. width: 280px;
  110. transform: translateX(280px);
  111. transition: all 0.3s ease;
  112. color: #fff;
  113. .daolan {
  114. cursor: pointer;
  115. position: absolute;
  116. right: 280px;
  117. background-color: rgba(103, 97, 86, 0.7);
  118. border-radius: 5px 0px 0px 5px;
  119. top: 24%;
  120. padding: 10px;
  121. > img {
  122. width: 16px;
  123. transform: rotate(180deg);
  124. margin-bottom: 4px;
  125. }
  126. }
  127. .p-title {
  128. position: relative;
  129. margin-bottom: 2px;
  130. .ptleft {
  131. position: absolute;
  132. bottom: 0;
  133. left: 0;
  134. .pbg {
  135. }
  136. .lg {
  137. position: absolute;
  138. left: 10px;
  139. top: 10px;
  140. width: 30px;
  141. }
  142. > span {
  143. width: 72px;
  144. height: 18px;
  145. position: absolute;
  146. left: 46px;
  147. top: 50%;
  148. transform: translateY(-50%);
  149. z-index: 999;
  150. font-size: 18px;
  151. font-weight: 400;
  152. color: #ffffff;
  153. }
  154. }
  155. .ptright {
  156. width: 100%;
  157. height: 40px;
  158. line-height: 40px;
  159. background: rgba(80, 80, 80, 0.7);
  160. > span {
  161. display: inline-block;
  162. width: 50%;
  163. margin-left: 80px;
  164. }
  165. }
  166. }
  167. .exh-con {
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. background-color: rgba(103, 97, 86, 0.7);
  172. border: 2px solid #e2c59a;
  173. padding: 20px 0;
  174. width: 100%;
  175. height: 200px;
  176. > img {
  177. width: 80%;
  178. }
  179. }
  180. .exhi-list {
  181. border: 2px solid #e2c59a;
  182. background-color: rgba(103, 97, 86, 0.7);
  183. border-top: none;
  184. width: 100%;
  185. padding: 20px 0;
  186. > li {
  187. height: 40px;
  188. line-height: 40px;
  189. padding-left: 40px;
  190. cursor: pointer;
  191. text-align: left;
  192. position: relative;
  193. > img {
  194. position: absolute;
  195. left: 10px;
  196. top: 50%;
  197. transform: translateY(-50%);
  198. display: none;
  199. }
  200. &:hover,&.active {
  201. color: #ffe0a6;
  202. > img {
  203. display: inline-block;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. .daolanactive {
  210. transform: translateX(0);
  211. .daolan {
  212. > img {
  213. width: 16px;
  214. transform: rotate(0);
  215. margin-bottom: 4px;
  216. }
  217. }
  218. }
  219. </style>
  220. <style lang="less">
  221. #cad1 {
  222. .sign {
  223. display: none !important;
  224. }
  225. }
  226. .hidemap {
  227. g > g {
  228. &:not(.sign) {
  229. display: none !important;
  230. }
  231. }
  232. }
  233. </style>