<template>
  <!-- 文化概况 - 民间习俗 -->
   <CommonListPage
    :title="'民间习俗'"
    :prevPage="{ title: '文化概况' }"
    :dropDownNames="[]"
    :showSearch="true"
    :tagsData="tagsData"
    :pageSize="8"
    :defaultSelectTag="245"
    :load="loadData"
    :loadDetail="loadDetail"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { GetContentListParams } from '@/api/CommonContent';
import CustomContent from '@/api/introduction/CustomContent';

async function loadDetail(id: number, item: any) {
  return await CustomContent.getContentDetail(id);
}
async function loadData(
  page: number, 
  pageSize: number,
  selectedTag: number,
  searchText: string,
  dropDownValues: number[]
) {

  const res = await CustomContent.getContentList(new GetContentListParams().setSelfValues({
    mainBodyColumnId: selectedTag,
    keywords: searchText,
  }), page, pageSize);

  return { 
    page: page,
    total: res.total,
    data: res.list.map((item, index) => {
      return {
        id: item.id,
        title: item.title,
        desc: item.desc,
        image: item.image,
      };
    }),
  }
}

//子分类
const tagsData = ref([
  { id: 245, name: '全部' },
  { id: 246, name: '婚丧嫁娶' },
  { id: 111, name: '民俗节庆' },
  { id: 248, name: '信仰' },
]);
</script>

<style>
</style>

