<template>
  <div class="main">
    <div class="content">
      <sub-header />
      <div class="left">
        <!-- {{ exhibitionList }} -->

        <n-tabs type="line" pane-class="tab-content" v-model:value="currentTab">
          <template #prefix>
            <span class="meta-title">
              <img src="@/assets/subtitle_2.png" />
            </span>
          </template>
          <n-tab-pane name="all" tab="全部展览">
            <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
              <template v-for="item in exhibitionList">
                <n-gi>
                  <!-- {{ item }} -->
                  <exhibition-box
                    :id="item.id"
                    :title="item.name"
                    :cover="domain + item.thumb"
                    :content="item.richText"
                    :location="item.address"
                    :type="item.type"
                    isHasVR
                  />
                </n-gi>
              </template>
            </n-grid>
            <empty :show="exhibitionList.length === 0" :height="500" />
          </n-tab-pane>
          <n-tab-pane name="long" tab="常设展览">
            <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
              <template v-for="item in exhibitionList">
                <n-gi>
                  <exhibition-box
                    :id="item.id"
                    :title="item.name"
                    :cover="domain + item.thumb"
                    :content="item.richText"
                    :location="item.address"
                    :type="item.type"
                    :isHasVR="item.link.length > 0"
                  />
                </n-gi>
              </template>
            </n-grid>
            <empty :show="exhibitionList.length === 0" :height="500" />
          </n-tab-pane>
          <n-tab-pane name="topic" tab="专题展览">
            <n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
              <template v-for="item in exhibitionList">
                <n-gi>
                  <exhibition-box
                    :id="item.id"
                    :title="item.name"
                    :cover="domain + item.thumb"
                    :content="item.richText"
                    :location="item.address"
                    :type="item.type"
                    :isHasVR="item.link.length > 0"
                  />
                </n-gi>
              </template>
            </n-grid>
            <empty :show="exhibitionList.length === 0" :height="500" />
          </n-tab-pane>
          <n-tab-pane name="temp" tab="临时展览">
            <n-grid :y-gap="YGap" :cols="1" class="tab-grid">
              <template v-for="item in exhibitionList">
                <n-gi>
                  <exhibition-box
                    :id="item.id"
                    :title="item.name"
                    :cover="domain + item.thumb"
                    :content="item.richText"
                    :location="item.address"
                    :type="item.type"
                    :isHasVR="item.link.length > 0"
                  />
                </n-gi>
              </template>
            </n-grid>
            <empty :show="exhibitionList.length === 0" :height="500" />
          </n-tab-pane>
        </n-tabs>
      </div>
      <side-menu />
    </div>
  </div>
</template>

<script setup>
import { computed, watch } from "vue";
import subHeader from "../components/subHeader";
import sideMenu from "../components/sideMenu";
import exhibitionBox from "../components/exhibitionBox";
import { useExhibitionStore } from "../store/exhibition";
import empty from "../components/empty.vue";

const exhibitionStore = useExhibitionStore();
const domain = ref(import.meta.env.VITE_DOMAIN_URL);
const exhibitionList = computed(() => exhibitionStore.lists);



const XGap = ref(50);
const YGap = ref(50);

const currentTab = ref("all");

watch(
  currentTab,
  (val) => {
    console.log("val", val);
    exhibitionStore.getExhibitionList(1, val);
  },
  {
    immediate: true,
  }
);
</script>

<style lang="scss" scoped>
:deep(.n-tabs) {
  --n-tab-font-size: 1.25rem !important;
  --n-tab-gap: 60px !important;
  --n-pane-padding-top: 3.125rem !important;
  --n-pane-padding-bottom: 3.125rem !important;
  height: 100%;
  overflow: hidden;
  .n-tab-pane {
    overflow-y: scroll;
  }
  .n-tabs-bar {
    height: 0.25rem;
    border-radius: 1.875rem !important;
  }
}
// .tab-content {
//   width: calc(100% - 12rem);
//   margin: 0 auto;
//   &::-webkit-scrollbar {
//     display: none;
//   }
// }
</style>
