list.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="museum-list">
  3. <div class="mcon">
  4. <p v-if="list.length>0">{{list[0].cityName}} {{currentId === 'museum' ? '博物馆' : '虚拟场景'}}数量:{{list.length}}</p>
  5. <ul>
  6. <li @click="onClickItem(item)" v-for="(item,i) in list" :key="i">
  7. {{item.name}}
  8. </li>
  9. </ul>
  10. </div>
  11. <ul class="select">
  12. <li @click="onClickSelect({id:'museum'})" :class="{ active: currentId == 'museum' }">
  13. <span></span>
  14. <span>博物馆</span>
  15. </li>
  16. <li @click="onClickSelect({id:'scene'})" :class="{ active: currentId == 'scene' }">
  17. <span></span>
  18. <span>虚拟场景</span>
  19. </li>
  20. </ul>
  21. </div>
  22. </template>
  23. <script setup>
  24. import { ref, onMounted, watch, nextTick } from "vue";
  25. import { getMuseumList, getExhibitionList } from "@/config/api";
  26. import { useRoute,useRouter } from "vue-router";
  27. const route = useRoute();
  28. const router = useRouter();
  29. const currentId = ref('')
  30. const list = ref([])
  31. const onClickSelect = (data) => {
  32. currentId.value = data.id
  33. }
  34. const onClickItem = data => {
  35. if (data.name === '广东省博物馆') {
  36. router.push({name: 'gdmuseum'})
  37. } else {
  38. router.push({name:'exhibition',query:{id:data.id}})
  39. }
  40. }
  41. const getList = () => {
  42. let getData = currentId.value == 'museum' ? getMuseumList : getExhibitionList
  43. getData({
  44. "cityId": route.params.id,
  45. "pageNum": 1,
  46. "pageSize": 1000,
  47. "searchKey": ""
  48. }, data => {
  49. list.value = data.data.records
  50. })
  51. }
  52. watch(currentId, () => {
  53. getList()
  54. })
  55. onMounted(() => {
  56. if (route.query.type) {
  57. currentId.value = route.query.type
  58. router.replace({name: route.name, query: {}})
  59. } else {
  60. currentId.value = 'museum'
  61. }
  62. getList()
  63. })
  64. </script>
  65. <style lang="scss" scoped>
  66. .museum-list {
  67. background: #E8E3D1;
  68. color: #333333;
  69. .mcon {
  70. width: 1400px;
  71. margin: 0 auto;
  72. padding-top: 50px;
  73. >p {
  74. font-size: 24px;
  75. }
  76. >ul {
  77. display: flex;
  78. flex-wrap: wrap;
  79. >li {
  80. width: 270px;
  81. height: 50px;
  82. margin: 40px 104px 0 0;
  83. line-height: 50px;
  84. border-radius: 50px;
  85. border: 1px solid #333333;
  86. text-align: center;
  87. cursor: pointer;
  88. &:nth-of-type(4n) {
  89. margin-right: 0;
  90. }
  91. &:hover,
  92. &.active {
  93. color: var(--main-color);
  94. border-color: var(--main-color);
  95. }
  96. }
  97. }
  98. }
  99. .select {
  100. width: 400px;
  101. display: flex;
  102. padding: 10px 0;
  103. justify-content: center;
  104. background: var(--main-color);
  105. border-radius: 50px;
  106. position: absolute;
  107. bottom: 55px;
  108. left: 50%;
  109. transform: translateX(-50%);
  110. color: #fff;
  111. >li {
  112. display: flex;
  113. align-items: center;
  114. margin: 0 40px;
  115. cursor: pointer;
  116. >span {
  117. margin-right: 6px;
  118. display: inline-block;
  119. &:first-of-type {
  120. width: 20px;
  121. height: 20px;
  122. position: relative;
  123. border-radius: 50%;
  124. background: #fff;
  125. }
  126. }
  127. &.active {
  128. >span {
  129. &:first-of-type {
  130. &::before {
  131. content: "";
  132. position: absolute;
  133. width: 10px;
  134. height: 10px;
  135. background: var(--font-active);
  136. border-radius: 50%;
  137. top: 50%;
  138. left: 50%;
  139. transform: translate(-50%, -50%);
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. @media screen and (max-width: 1000px) {
  148. .museum-list {
  149. color: #333333;
  150. width: 100%;
  151. .mcon {
  152. width: 90%;
  153. padding-top: 20px;
  154. >p {
  155. font-size: 18px;
  156. }
  157. >ul {
  158. display: flex;
  159. flex-wrap: wrap;
  160. justify-content: space-between;
  161. >li {
  162. width: 48%;
  163. height: 40px;
  164. margin: 10px 0;
  165. line-height: 40px;
  166. border: 1px solid #999;
  167. color: #999;
  168. }
  169. }
  170. }
  171. .select {
  172. width: 90%;
  173. display: flex;
  174. padding: 10px 0;
  175. justify-content: space-evenly;
  176. position: absolute;
  177. bottom: 22px;
  178. > li {
  179. margin: 0;
  180. }
  181. }
  182. }
  183. }
  184. </style>