<template>
  <div class="lg:w-screen-lg sm:flex xl:p-0 p-4 mb-10 m-auto  relative">
    <el-row :gutter="24" class="flex w-full">
        <el-col v-for="(item,index) in list" :key="index" :span="6" :xs="24" class="mb-6">
          <nuxt-link :to="item.path">
            <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-green-50 cursor-pointer h-[200px] flex items-center justify-center">
              <div class="flex-1 px-4 py-5 sm:p-6 !p-4">
                <div class="text-gray-700 dark:text-white text-base font-semibold  flex flex-col gap-1.5">
                  <el-space class="flex-1 cursor-pointer flex items-center flex-col">
                    <el-image v-if="item.icon" :src="item.icon" class="w-[40px]" />
                    <span class="py-3 text-lg">{{ item.title }}</span>
                  </el-space>
                </div>
              </div>
            </el-card>
          </nuxt-link>
        </el-col>
    </el-row>
  </div>
  <div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs">
    没有更多了
  </div>
</template>

<script setup lang="ts">
import {loginAdminByToken} from "~/utils/common";
import {useServerRequest} from "~/composables/useServerRequest";
import type {ApiResult, PageResult} from "~/api";
import type {Company, CompanyParam} from "~/api/system/company/model";
import {pageCompanyAll} from "~/api/system/company";
import {listCmsNavigation} from "~/api/cms/cmsNavigation";
import type {CmsNavigation} from "~/api/cms/cmsNavigation/model";
import {navigateTo} from "#imports";

const props = withDefaults(
    defineProps<{
      param?: CompanyParam;
      disabled?: boolean;
      title?: string;
      comments?: string;
      fit?: any;
    }>(),
    {
      fit: 'cover'
    }
);

const emit = defineEmits<{
  (e: 'done'): void;
}>();

const list = ref<CmsNavigation[]>([]);

// 请求数据
const reload = async () => {
  listCmsNavigation({
    parentId: 2828
  }).then(data => {
    list.value = data;
  })
}
reload();
</script>
