info.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="main">
  3. <div class="content">
  4. <sub-header />
  5. <div class="left">
  6. <n-tabs type="line" pane-class="tab-content" v-model:value="currentTab">
  7. <template #prefix>
  8. <span class="meta-title">
  9. <img src="@/assets/subtitle_1.png" />
  10. </span>
  11. </template>
  12. <n-tab-pane name="exhibitions" tab="展览" v-infinite-scroll="onLoadMore">
  13. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="3" class="tab-grid">
  14. <template v-for="item in exhibitions">
  15. <n-gi>
  16. <info-box :id="item.id" :title="item.name" :cover="domain + item.thumb" :time="item.publishDate" />
  17. </n-gi>
  18. </template>
  19. </n-grid>
  20. <empty :show="exhibitions.length === 0" :height="500" />
  21. </n-tab-pane>
  22. <!-- <n-tab-pane name="activates" tab="活动">
  23. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="3" class="tab-grid">
  24. <template v-for="item in activates">
  25. <n-gi>
  26. <info-box
  27. :id="item.id"
  28. :title="item.name"
  29. :cover="domain + item.thumb"
  30. :time="item.publishDate"
  31. />
  32. </n-gi>
  33. </template>
  34. </n-grid>
  35. <empty :show="activates.length === 0" :height="500" />
  36. </n-tab-pane> -->
  37. <!-- <n-tab-pane name="news" tab="新闻">
  38. <div>123</div>
  39. <n-grid :x-gap="XGap" :y-gap="YGap" :cols="3" class="tab-grid">
  40. <template v-for="item in news">
  41. <n-gi>
  42. <info-box :id="item.id" :title="item.name" :cover="domain + item.thumb" :time="item.publishDate" />
  43. </n-gi>
  44. </template>
  45. </n-grid>
  46. <empty :show="news.length === 0" :height="500" />
  47. </n-tab-pane> -->
  48. <!-- <n-tab-pane name="notices" tab="通知">
  49. <n-grid :y-gap="YGap" :cols="1" class="tab-grid">
  50. <template v-for="item in notices">
  51. <n-gi>
  52. <notice-box :id="item.id" :title="item.name" :content="item.richText" :time="item.publishDate" />
  53. </n-gi>
  54. </template>
  55. </n-grid>
  56. <empty :show="notices.length === 0" :height="500" />
  57. </n-tab-pane> -->
  58. </n-tabs>
  59. </div>
  60. <side-menu />
  61. </div>
  62. </div>
  63. </template>
  64. <script setup>
  65. import { onMounted, watch, computed } from "vue";
  66. import { vInfiniteScroll } from "@vueuse/components";
  67. import infoBox from "../components/infoBox";
  68. import subHeader from "../components/subHeader";
  69. import sideMenu from "../components/sideMenu";
  70. import noticeBox from "../components/noticeBox";
  71. import empty from "../components/empty.vue";
  72. import { useInfoStore } from "../store/info";
  73. import { useLoadingBar } from "naive-ui";
  74. const infoStore = useInfoStore();
  75. const loadingBar = useLoadingBar();
  76. const domain = ref(import.meta.env.VITE_DOMAIN_URL);
  77. const currentTab = ref("exhibitions");
  78. const news = computed(() => infoStore.news);
  79. const notices = computed(() => infoStore.notices);
  80. const activates = computed(() => infoStore.activates);
  81. const exhibitions = computed(() => infoStore.exhibitions);
  82. const handleTabFetch = async (type) => {
  83. loadingBar.start();
  84. await infoStore.switchTab(type);
  85. loadingBar.finish();
  86. };
  87. watch(
  88. currentTab,
  89. (val) => {
  90. if (val === "news") {
  91. window.open("http://www.qsqyhsjng.com/szjq/jqxw/");
  92. currentTab.value = "exhibitions";
  93. }
  94. if (val === "notices") {
  95. window.open("http://www.qsqyhsjng.com/jqgk/tzgg/");
  96. currentTab.value = "exhibitions";
  97. }
  98. console.log("currentTab", val);
  99. handleTabFetch(val);
  100. },
  101. {
  102. immediate: true,
  103. }
  104. );
  105. const XGap = ref(50);
  106. const YGap = ref(50);
  107. const onLoadMore = () => {
  108. if (infoStore.isLoad) {
  109. infoStore.loadMore(currentTab.value);
  110. }
  111. };
  112. </script>
  113. <style lang="scss" scoped></style>