<template>
  <CommonListPage 
    title="闽南美食"
    itemType="image-large-2"
    :detailsPage="[
      '/pages/inhert/intangible/details',
      '/pages/article/details',
    ]"
    showTotal
    :dropDownNames="dropdownNames"
    :load="loadData" 
  />
<!--   
    :tabs="[
      { id: 0, name: '非遗美食' },
      { id: 1, name: '美食资讯' },
    ]" -->
</template>

<script setup lang="ts">
import { ref } from 'vue';
import CommonListPage, { type DropDownNames } from '@/pages/article/common/CommonListPage.vue';
import CommonContent, { GetContentListParams } from '@/api/CommonContent';
import ProjectsContent from '@/api/inheritor/ProjectsContent';

const dropdownNames = ref<DropDownNames[]>([]);

async function loadData(
  page: number, 
  pageSize: number,
  searchText: string,
  dropDownValues: number[],
  tabSelect: number,
) {
  let res;
  switch (tabSelect) {
    /*case 0:
       res = await ProjectsContent.getContentList(new GetContentListParams()
        .setKeywords('美食 ' + searchText)
      , page, pageSize);
      res.list.forEach((item) => {
        item.bottomTags = [
          item.levelText, 
          item.ichTypeText, 
          item.batchText,
          item.regionText,
        ]
      })
      break;
    case 1: */
    default:
      res = await CommonContent.getContentList(new GetContentListParams()
        .setKeywords(searchText)
        .setModelId(8)
        .setMainBodyColumnId(103)
      , page, pageSize);
      break;
  }
  return { list: res.list, total: res.total }
}
</script>