index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <script setup lang="ts">
  2. import ModelList from "@/assets/data/Model/index";
  3. import { ModelType } from "@/types/Model/index";
  4. import DownIcon from "@/assets/img/panorama/down.png";
  5. import UpIcon from "@/assets/img/panorama/up.png";
  6. const route = useRoute();
  7. const showList = ref([]);
  8. const currentArea = ref({} as any);
  9. const currentScene = ref({} as any);
  10. const getData = () => {
  11. // 处理数据
  12. const dataList = ModelList.map((item: ModelType) => {
  13. return item.region;
  14. });
  15. const newDataList = dataList.filter(function (value, index, self) {
  16. return self.indexOf(value) === index;
  17. });
  18. newDataList.forEach((region: string) => {
  19. const list = ModelList.filter((item: ModelType) => {
  20. return item.region === region;
  21. });
  22. showList.value.push({
  23. area: region,
  24. list: list,
  25. });
  26. });
  27. currentArea.value = showList.value[0];
  28. currentScene.value = currentArea.value.list[0];
  29. // 获取当前
  30. if (route.query.name) {
  31. currentScene.value = ModelList.find((item: any) => {
  32. return route.query.name === item.name;
  33. });
  34. currentArea.value = showList.value.find((item:any) => {
  35. return item.area === currentScene.value.region
  36. })
  37. } else {
  38. currentArea.value = showList.value[0];
  39. currentScene.value = currentArea.value.list[0];
  40. }
  41. console.log(
  42. showList.value,
  43. newDataList,
  44. route.query.name,
  45. currentArea.value,
  46. currentScene.value
  47. );
  48. };
  49. const currentAreaChange = (item: any) => {
  50. currentArea.value = item;
  51. };
  52. const sceneChange = (item: any) => {
  53. currentScene.value = item;
  54. };
  55. const isShow = ref(true);
  56. onMounted(() => {
  57. getData();
  58. });
  59. </script>
  60. <template>
  61. <div class="detail">
  62. <!-- <div class="map-top">芜湖市优秀文物建筑</div> -->
  63. <iframe
  64. class="ifr"
  65. :src="`https://zzbbh.4dage.com/SWKK/show.html?id=${currentScene.birdId}`"
  66. frameborder="0"
  67. ></iframe>
  68. <div class="mini-tabbar">
  69. <div class="mini-tabbar-top">
  70. <div class="top-left">
  71. <div
  72. class="top-item"
  73. v-for="(item, index) in showList"
  74. :key="index"
  75. @click="currentAreaChange(item)"
  76. >
  77. {{ item.area }}
  78. </div>
  79. </div>
  80. <img
  81. :src="isShow ? DownIcon : UpIcon"
  82. alt=""
  83. @click="
  84. () => {
  85. isShow = !isShow;
  86. }
  87. "
  88. />
  89. </div>
  90. <div class="mini-tabbar-bottom" v-show="isShow">
  91. <div
  92. class="bottom-item"
  93. v-for="(item, index) in currentArea.list"
  94. :key="index"
  95. v-show="item.birdId != ''"
  96. @click="sceneChange(item)"
  97. >
  98. <img
  99. :src="item.swiperImage[0]"
  100. alt=""
  101. />
  102. <div class="item-name">{{ item.name }}</div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <style lang="less" scoped>
  109. .detail {
  110. width: 100%;
  111. height: 100vh;
  112. height: calc(var(--vh, 1vh) * 100);
  113. position: relative;
  114. overflow: hidden;
  115. .map-top {
  116. width: 100%;
  117. height: 8vh;
  118. background: var(--color-bg);
  119. font-size: 1rem;
  120. text-align: center;
  121. line-height: 8vh;
  122. letter-spacing: 3px;
  123. color: #4d4d4d;
  124. }
  125. .ifr {
  126. width: 100%;
  127. height: 100%;
  128. }
  129. .mini-tabbar {
  130. width: 100%;
  131. // height: 22vh;
  132. background: rgb(34 34 34 / 62%);
  133. position: absolute;
  134. bottom: 0;
  135. // border: 1px dotted white;
  136. box-sizing: border-box;
  137. padding: 10px 15px;
  138. transition: height 2s;
  139. &-top {
  140. width: 100%;
  141. display: flex;
  142. align-items: center;
  143. .top-left {
  144. max-width: 90%;
  145. overflow: auto;
  146. display: flex;
  147. width: 90%;
  148. .top-item {
  149. font-size: 0.9rem;
  150. width: 21%;
  151. height: 30px;
  152. background: url(/src\assets\img\panorama\areabg.png);
  153. background-size: 100% 100%;
  154. text-align: center;
  155. line-height: 30px;
  156. color: #685e47;
  157. margin-right: 10px;
  158. font-weight: bold;
  159. }
  160. }
  161. img {
  162. width: 20px;
  163. height: 20px;
  164. }
  165. }
  166. &-bottom {
  167. white-space: nowrap;
  168. overflow-x: scroll;
  169. // 隐藏滚动条
  170. &::-webkit-scrollbar {
  171. display: none;
  172. }
  173. .bottom-item {
  174. display: inline-block;
  175. margin-right: 10px;
  176. box-sizing: border-box;
  177. width: 23%;
  178. height: 18vh;
  179. margin-top: 10px;
  180. img {
  181. width: 100%;
  182. height: 85%;
  183. object-fit: cover;
  184. }
  185. .item-name {
  186. width: 100%;
  187. text-align: center;
  188. font-size: 0.7rem;
  189. text-overflow: ellipsis; /* ellipsis:显示省略符号来代表被修剪的文本 string:使用给定的字符串来代表被修剪的文本*/
  190. white-space: nowrap; /* nowrap:规定段落中的文本不进行换行 */
  191. overflow: hidden;
  192. color: white;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>