exhibition.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="main">
  3. <div class="content">
  4. <sub-header />
  5. <div class="left">
  6. <!-- {{ exhibitionList }} -->
  7. <n-tabs type="line" pane-class="tab-content" v-model:value="currentTab">
  8. <template #prefix>
  9. <span class="meta-title">
  10. <img src="@/assets/subtitle_2.png" />
  11. </span>
  12. </template>
  13. <n-tab-pane name="all" tab="全部展览">
  14. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
  15. <template v-for="item in exhibitionList">
  16. <n-gi>
  17. <!-- {{ item }} -->
  18. <exhibition-box
  19. :id="item.id"
  20. :title="item.name"
  21. :cover="domain + item.thumb"
  22. :content="item.richText"
  23. :location="item.address"
  24. :type="item.type"
  25. isHasVR
  26. />
  27. </n-gi>
  28. </template>
  29. </n-grid>
  30. <empty :show="exhibitionList.length === 0" :height="500" />
  31. </n-tab-pane>
  32. <n-tab-pane name="long" tab="常设展览">
  33. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
  34. <template v-for="item in exhibitionList">
  35. <n-gi>
  36. <exhibition-box
  37. :id="item.id"
  38. :title="item.name"
  39. :cover="domain + item.thumb"
  40. :content="item.richText"
  41. :location="item.address"
  42. :type="item.type"
  43. :isHasVR="item.link.length > 0"
  44. />
  45. </n-gi>
  46. </template>
  47. </n-grid>
  48. <empty :show="exhibitionList.length === 0" :height="500" />
  49. </n-tab-pane>
  50. <n-tab-pane name="topic" tab="专题展览">
  51. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
  52. <template v-for="item in exhibitionList">
  53. <n-gi>
  54. <exhibition-box
  55. :id="item.id"
  56. :title="item.name"
  57. :cover="domain + item.thumb"
  58. :content="item.richText"
  59. :location="item.address"
  60. :type="item.type"
  61. :isHasVR="item.link.length > 0"
  62. />
  63. </n-gi>
  64. </template>
  65. </n-grid>
  66. <empty :show="exhibitionList.length === 0" :height="500" />
  67. </n-tab-pane>
  68. <n-tab-pane name="temp" tab="临时展览">
  69. <n-grid :y-gap="YGap" :cols="1" class="tab-grid">
  70. <template v-for="item in exhibitionList">
  71. <n-gi>
  72. <exhibition-box
  73. :id="item.id"
  74. :title="item.name"
  75. :cover="domain + item.thumb"
  76. :content="item.richText"
  77. :location="item.address"
  78. :type="item.type"
  79. :isHasVR="item.link.length > 0"
  80. />
  81. </n-gi>
  82. </template>
  83. </n-grid>
  84. <empty :show="exhibitionList.length === 0" :height="500" />
  85. </n-tab-pane>
  86. </n-tabs>
  87. </div>
  88. <side-menu />
  89. </div>
  90. </div>
  91. </template>
  92. <script setup>
  93. import { computed, watch } from "vue";
  94. import subHeader from "../components/subHeader";
  95. import sideMenu from "../components/sideMenu";
  96. import exhibitionBox from "../components/exhibitionBox";
  97. import { useExhibitionStore } from "../store/exhibition";
  98. import empty from "../components/empty.vue";
  99. const exhibitionStore = useExhibitionStore();
  100. const domain = ref(import.meta.env.VITE_DOMAIN_URL);
  101. const exhibitionList = computed(() => exhibitionStore.lists);
  102. const XGap = ref(50);
  103. const YGap = ref(50);
  104. const currentTab = ref("all");
  105. watch(
  106. currentTab,
  107. (val) => {
  108. console.log("val", val);
  109. exhibitionStore.getExhibitionList(1, val);
  110. },
  111. {
  112. immediate: true,
  113. }
  114. );
  115. </script>
  116. <style lang="scss" scoped>
  117. :deep(.n-tabs) {
  118. --n-tab-font-size: 1.25rem !important;
  119. --n-tab-gap: 60px !important;
  120. --n-pane-padding-top: 3.125rem !important;
  121. --n-pane-padding-bottom: 3.125rem !important;
  122. height: 100%;
  123. overflow: hidden;
  124. .n-tab-pane {
  125. overflow-y: scroll;
  126. }
  127. .n-tabs-bar {
  128. height: 0.25rem;
  129. border-radius: 1.875rem !important;
  130. }
  131. }
  132. // .tab-content {
  133. // width: calc(100% - 12rem);
  134. // margin: 0 auto;
  135. // &::-webkit-scrollbar {
  136. // display: none;
  137. // }
  138. // }
  139. </style>