<template>
  <el-main class="keep-padding flex justify-center bg-white">
    <div class="w-1200px flex flex-col gap-10px">
      <el-carousel class="rounded-10px" height="300px">
        <el-carousel-item v-for="g of gallery" class="slider-item" :key="g.id">
          <img class="slider-item__img" :src="Neusoft.SMART_PARTY_BASE_URL + g.imageUrl" />
        </el-carousel-item>
      </el-carousel>
      <div class="grid grid-cols-2 gap-10px">
        <main-card class="max-lg-col-span-2" title="社团资讯" to="/club/press"></main-card>
        <main-card class="max-lg-col-span-2" title="社团活动" to="/club"></main-card>
        <main-card class="col-span-2" title="社团列表" to="/club">
          <club-list
            class="min-h-100px"
            v-loading="loadingClubList"
            element-loading-text="正在加载"
            brief
            @load-complete="loadingClubList = false"
          />
        </main-card>
      </div>
    </div>
  </el-main>
</template>
<style lang="scss" scoped>
.slider-item__img {
  @apply w-full h-full select-none rounded-10px;
}
.title {
  @apply h-40px flex justify-center items-center font-bold rounded-full bg-$el-color-primary text-white w-150px p-l-20px p-r-20px;
}
</style>
<script lang="ts" setup>
import { requestRaw } from '@/api';
import ClubList from '@/components/club/ClubList.vue';
import MainCard from '@/components/main/MainCard.vue';
import { Neusoft } from '@/schemas/neusoft';
import { useUserStore } from '@/stores/user.js';
import { ref } from 'vue';
const userStore = useUserStore();
const loadingClubList = ref(true);
const gallery = ref<Neusoft.SmartParty.Gallery[]>();
requestRaw<Neusoft.SmartParty.GalleryResp>({
  url: `${Neusoft.SMART_PARTY_BASE_URL}/system/rotation/list`,
  addAuth: false,
}).then((resp) => {
  if (!resp || !Neusoft.isSucceed(resp)) return;
  gallery.value = resp.rows;
});
</script>
